diff --git a/CMakeLists.txt b/CMakeLists.txt index 48e73f6..024b551 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") endif() # ── Options ─────────────────────────────────────────────────────────────────── -# The M0 skeleton compiles with NO third-party dependencies: every subsystem is a -# stub that returns VC_ERR_NOT_IMPLEMENTED. As each subsystem is built out, flip -# VOICECAT_USE_VCPKG_DEPS=ON so CMake pulls the real libraries (mbedTLS, libsodium, -# opus, protobuf, ...) via the vcpkg toolchain (see vcpkg.json / docs/tech-stack.md). -option(VOICECAT_USE_VCPKG_DEPS "Link real third-party deps via vcpkg" OFF) option(VOICECAT_BUILD_SERVER "Build voicecat-server" ON) option(VOICECAT_BUILD_TOOLS "Build the vccli headless test client" ON) option(VOICECAT_BUILD_TESTS "Build tests" ON) @@ -60,9 +55,7 @@ endif() if(VOICECAT_BUILD_TOOLS) add_subdirectory(tools/vccli) - if(VOICECAT_USE_VCPKG_DEPS) - add_subdirectory(tools/voicecat-admin) - endif() + add_subdirectory(tools/voicecat-admin) endif() if(VOICECAT_BUILD_TESTS) @@ -71,5 +64,4 @@ if(VOICECAT_BUILD_TESTS) endif() message(STATUS "VoiceCat ${PROJECT_VERSION} configured " - "(vcpkg deps: ${VOICECAT_USE_VCPKG_DEPS}, " - "server: ${VOICECAT_BUILD_SERVER}, tools: ${VOICECAT_BUILD_TOOLS})") + "(server: ${VOICECAT_BUILD_SERVER}, tools: ${VOICECAT_BUILD_TOOLS})") diff --git a/CMakePresets.json b/CMakePresets.json index dede54c..6499bf9 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -12,17 +12,6 @@ "VOICECAT_USE_VCPKG_DEPS": "ON" } }, - { - "name": "skeleton", - "displayName": "Skeleton (no third-party deps)", - "description": "Builds the stub skeleton with just a C++20 compiler — no vcpkg needed. Subsystems return VC_ERR_NOT_IMPLEMENTED. Good for 'does the repo even build' smoke checks. Runs 2 tests (smoke + frame_codec).", - "generator": "Ninja", - "binaryDir": "${sourceDir}/build/skeleton", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "VOICECAT_USE_VCPKG_DEPS": "OFF" - } - }, { "name": "dev", "displayName": "Dev (full real-deps build, vcpkg)", @@ -130,7 +119,6 @@ } ], "buildPresets": [ - { "name": "skeleton", "configurePreset": "skeleton" }, { "name": "dev", "configurePreset": "dev" }, { "name": "release", "configurePreset": "release" }, { "name": "server-release", "configurePreset": "server-release" }, @@ -140,7 +128,6 @@ { "name": "apple-ios-sim", "configurePreset": "apple-ios-sim" } ], "testPresets": [ - { "name": "skeleton", "configurePreset": "skeleton", "output": { "outputOnFailure": true } }, { "name": "dev", "configurePreset": "dev", "output": { "outputOnFailure": true } }, { "name": "release", "configurePreset": "release", "output": { "outputOnFailure": true } } ] diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index fd6797e..7d3d500 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -42,8 +42,7 @@ set_target_properties(voicecat PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON) -if(VOICECAT_USE_VCPKG_DEPS) - find_package(protobuf CONFIG REQUIRED) +find_package(protobuf CONFIG REQUIRED) find_package(unofficial-sodium CONFIG REQUIRED) find_package(MbedTLS CONFIG REQUIRED) find_package(asio CONFIG REQUIRED) @@ -129,4 +128,3 @@ if(VOICECAT_USE_VCPKG_DEPS) # Signal to C++ code that the real networking/crypto stack is available. target_compile_definitions(voicecat PUBLIC VOICECAT_HAS_NET) -endif() diff --git a/core/include/voicecat.h b/core/include/voicecat.h index 3702aec..5f93c6e 100644 --- a/core/include/voicecat.h +++ b/core/include/voicecat.h @@ -8,13 +8,9 @@ * Design: docs/architecture.md §4. Everything here is async + event-driven — calls return * immediately and results/state changes arrive via the vc_callbacks.on_event callback. * - * STATUS: real, behind VOICECAT_HAS_NET (the `dev`/`release`/`server-release` presets — - * vcpkg deps on; see docs/building.md). As of M3, control plane, voice, multi-stream, device - * enumeration, VAD/PTT, and stereo playback all work for real via core/src/core/client.cpp. - * The no-deps `skeleton` preset still links a stub vc_client that returns VC_ERR_NOT_IMPLEMENTED - * for everything below `connect`, purely to keep that skeleton build green. webrtc AEC/NS/AGC - * remains an inert passthrough regardless of preset (no Windows/MSVC port upstream — - * docs/voice.md §8/§11, PROGRESS.md). + * STATUS: real. Control plane, voice, multi-stream, device enumeration, VAD/PTT, and stereo + * playback all work via core/src/core/client.cpp. webrtc AEC/NS/AGC remains an inert passthrough + * (no Windows/MSVC port upstream — docs/voice.md §8/§11, PROGRESS.md). */ #ifndef VOICECAT_H #define VOICECAT_H @@ -56,7 +52,7 @@ extern "C" { /* ── Result codes ─────────────────────────────────────────────────────────── */ typedef enum vc_result { VC_OK = 0, - VC_ERR_NOT_IMPLEMENTED = 1, /* skeleton stub */ + VC_ERR_NOT_IMPLEMENTED = 1, VC_ERR_INVALID_ARG = 2, VC_ERR_NOT_CONNECTED = 3, VC_ERR_ALREADY = 4, diff --git a/core/src/audio/apm_processor.cpp b/core/src/audio/apm_processor.cpp index 00acfd1..09a7cf8 100644 --- a/core/src/audio/apm_processor.cpp +++ b/core/src/audio/apm_processor.cpp @@ -5,9 +5,7 @@ #include #include -#ifdef VOICECAT_HAS_NS #include "rnnoise.h" -#endif namespace voicecat::audio { @@ -19,15 +17,6 @@ int64_t steady_now_ms() { } } // namespace -// ── ApmPassthrough ──────────────────────────────────────────────────────────── -// No-op: returns true (VAD always open), does not modify PCM. -// Replaced by WebrtcApmProcessor when VOICECAT_HAS_APM is defined. -class ApmPassthrough final : public ApmProcessor { - public: - void process_render(const int16_t*, int, int) override {} - bool process_capture(int16_t*, int, int) override { return true; } -}; - // ── EnergyVadProcessor ────────────────────────────────────────────────────── // Lightweight, dependency-free energy/RMS VAD — see apm_processor.h's create_vad() doc comment // for why this exists instead of a real APM. No AEC (process_render is a no-op); doesn't modify @@ -62,7 +51,6 @@ class EnergyVadProcessor final : public ApmProcessor { int64_t last_voice_ms_ = 0; // epoch start -> gate begins closed until first loud frame }; -#ifdef VOICECAT_HAS_NS // ── RnnoiseProcessor ───────────────────────────────────────────────────────── // Real noise suppression via vendored RNNoise (third_party/rnnoise; docs/voice.md §10-11). // RNNoise is a mono, 48 kHz, fixed 480-sample (10 ms) speech denoiser; our engine clock is fixed @@ -103,14 +91,9 @@ class RnnoiseProcessor final : public ApmProcessor { float in_[kFrame]; float out_[kFrame]; }; -#endif // VOICECAT_HAS_NS std::unique_ptr ApmProcessor::create() { -#ifdef VOICECAT_HAS_NS return std::make_unique(); -#else - return std::make_unique(); -#endif } std::unique_ptr ApmProcessor::create_vad(float rms_threshold, diff --git a/core/src/audio/audio_engine.cpp b/core/src/audio/audio_engine.cpp index 65566a7..c689bef 100644 --- a/core/src/audio/audio_engine.cpp +++ b/core/src/audio/audio_engine.cpp @@ -1,7 +1,5 @@ -#ifdef VOICECAT_HAS_AUDIO #define MINIAUDIO_IMPLEMENTATION #include -#endif #include "audio/audio_engine.h" @@ -41,7 +39,6 @@ constexpr int32_t kStarveSamples = 48000 * 120 / 1000; // reseed when clock // defense-in-depth against any future regression that skips remove_stream. constexpr int32_t kPlcCapSamples = 48000 * 2; // 2 s @ 48 kHz -#ifdef VOICECAT_HAS_AUDIO // device_id encoding (DeviceInfo::id / AudioParams::*_device_id): a hex string of the raw // ma_device_id bytes. Opaque on purpose — names aren't guaranteed unique, and this is the only // stable handle miniaudio accepts back for device selection. Internal contract only; never @@ -76,7 +73,6 @@ bool hex_decode_device_id(const std::string& hex, ma_device_id* out) { } return true; } -#endif // VOICECAT_HAS_AUDIO } // namespace // ── JitterBuffer ───────────────────────────────────────────────────────────── @@ -197,19 +193,14 @@ AudioEngine::AudioEngine() = default; AudioEngine::~AudioEngine() { stop(); -#ifdef VOICECAT_HAS_AUDIO stop_loopback_capture(); // loopback has an independent lifecycle — close it before the context if (context_inited_) { ma_context_uninit(&context_); context_inited_ = false; } -#endif -#ifdef VOICECAT_HAS_OPUS if (dred_dec_) { opus_dred_decoder_destroy(dred_dec_); dred_dec_ = nullptr; } -#endif } -#ifdef VOICECAT_HAS_AUDIO ma_context_config AudioEngine::make_context_config() { ma_context_config cfg = ma_context_config_init(); // iOS: leave AVAudioSession entirely to the Swift layer (IOSAudioRouter). See the @@ -219,7 +210,6 @@ ma_context_config AudioEngine::make_context_config() { cfg.coreaudio.noAudioSessionDeactivate = MA_TRUE; // don't setActive(false) on device uninit return cfg; } -#endif bool AudioEngine::start(const AudioParams& p, CaptureCallback capture_cb) { if (running_.load()) return false; @@ -227,14 +217,11 @@ bool AudioEngine::start(const AudioParams& p, CaptureCallback capture_cb) { capture_cb_ = std::move(capture_cb); frame_samples_ = static_cast(p.sample_rate / 1000 * p.frame_ms); running_.store(true, std::memory_order_release); -#ifdef VOICECAT_HAS_OPUS if (!dred_dec_) { int err = 0; dred_dec_ = opus_dred_decoder_create(&err); // null on failure — DRED silently disabled } -#endif -#ifdef VOICECAT_HAS_AUDIO // Pre-allocate capture accumulators before the devices start so on_capture / on_loopback // never allocate on the RT thread. count=0 means "empty"; the buf is sized to exactly one // encoder frame so a memcpy into it can never overrun. The mic accumulator is sized to @@ -247,9 +234,7 @@ bool AudioEngine::start(const AudioParams& p, CaptureCallback capture_cb) { capture_accum_.count = 0; loopback_accum_.buf.assign(static_cast(frame_samples_), 0); loopback_accum_.count = 0; -#endif -#ifdef VOICECAT_HAS_AUDIO // Own the ma_context (lazily, reused across restarts) so miniaudio does not touch // AVAudioSession on iOS — the Swift IOSAudioRouter is the sole session owner. Without // this, ma_device_init(nullptr, ...) below would reset the session category to Record/ @@ -342,14 +327,12 @@ bool AudioEngine::start(const AudioParams& p, CaptureCallback capture_cb) { mixer_timer_stop_.store(false, std::memory_order_release); mixer_timer_thread_ = std::thread([this] { run_mixer_timer(); }); } -#endif // VOICECAT_HAS_AUDIO return true; } std::vector AudioEngine::enumerate_devices(bool capture) { std::vector result; -#ifdef VOICECAT_HAS_AUDIO // Use the no-AVAudioSession-management config here too: device enumeration runs at // SessionState init (refreshDevices) and on settings views, and a default-config context // would call setCategory()/setActive() on iOS, disrupting the session the Swift layer owns. @@ -377,16 +360,12 @@ std::vector AudioEngine::enumerate_devices(bool capture) { } ma_context_uninit(&ctx); -#else - (void)capture; -#endif // VOICECAT_HAS_AUDIO return result; } void AudioEngine::stop() { if (!running_.exchange(false)) return; -#ifdef VOICECAT_HAS_AUDIO // External playback: stop + join the mixer-timer thread before tearing down state it reads. mixer_timer_stop_.store(true, std::memory_order_release); if (mixer_timer_thread_.joinable()) mixer_timer_thread_.join(); @@ -400,11 +379,9 @@ void AudioEngine::stop() { ma_device_uninit(&playback_device_); playback_started_ = false; } -#endif } bool AudioEngine::suspend() { -#ifdef VOICECAT_HAS_AUDIO if (!running_.load(std::memory_order_acquire)) return true; // External playback: pause the mixer timer (there is no playback device to stop). This // matches the VPIO renderer going down during an AVAudioSession interruption. @@ -416,13 +393,9 @@ bool AudioEngine::suspend() { if (capture_started_) ok &= (ma_device_stop(&capture_device_) == MA_SUCCESS); if (playback_started_) ok &= (ma_device_stop(&playback_device_) == MA_SUCCESS); return ok; -#else - return true; -#endif } bool AudioEngine::resume() { -#ifdef VOICECAT_HAS_AUDIO if (!running_.load(std::memory_order_acquire)) return true; // External playback: relaunch the mixer timer (mixer_scratch_ is still sized from start()). if (external_playback_ && !mixer_timer_thread_.joinable()) { @@ -433,9 +406,6 @@ bool AudioEngine::resume() { if (capture_started_) ok &= (ma_device_start(&capture_device_) == MA_SUCCESS); if (playback_started_) ok &= (ma_device_start(&playback_device_) == MA_SUCCESS); return ok; -#else - return true; -#endif } void AudioEngine::inject_capture(int kind, const int16_t* pcm, size_t samples_per_channel, @@ -530,12 +500,10 @@ void AudioEngine::remove_stream(uint32_t ssrc) { std::lock_guard lk(streams_mu_); auto it = streams_.find(ssrc); if (it != streams_.end()) { -#ifdef VOICECAT_HAS_OPUS if (it->second.dred_state_) { opus_dred_free(it->second.dred_state_); it->second.dred_state_ = nullptr; } -#endif streams_.erase(it); } } @@ -590,7 +558,6 @@ int32_t AudioEngine::stream_playout_depth_samples(uint32_t ssrc) const { return static_cast(*newest - it->second.playout_ts); } -#ifdef VOICECAT_HAS_OPUS void AudioEngine::init_recv_stream(uint32_t ssrc, const codec::OpusParams& p, uint32_t user_id, uint32_t stream_id, bool is_voice) { std::lock_guard lk(streams_mu_); @@ -616,7 +583,6 @@ void AudioEngine::init_recv_stream(uint32_t ssrc, const codec::OpusParams& p, stream.dred_state_ = opus_dred_alloc(&err); // null on failure — falls back to PLC } } -#endif void AudioEngine::set_pcm_sink(PcmSink cb, void* user) { pcm_sink_user_.store(user, std::memory_order_relaxed); @@ -628,8 +594,6 @@ void AudioEngine::set_mixed_output_sink(MixedSink cb, void* user) { mixed_sink_.store(cb, std::memory_order_release); } -#ifdef VOICECAT_HAS_AUDIO - void AudioEngine::capture_data_cb(ma_device* dev, void* /*out*/, const void* in, ma_uint32 frame_count) { auto* self = static_cast(dev->pUserData); @@ -678,7 +642,6 @@ void AudioEngine::on_playback(int16_t* out, ma_uint32 frames) { std::unique_lock lk(streams_mu_, std::try_to_lock); if (!lk) return; // contended: emit silence this period -#ifdef VOICECAT_HAS_OPUS std::vector mix(frames * pb_channels, 0); for (auto& [ssrc, stream] : streams_) { @@ -747,7 +710,6 @@ void AudioEngine::on_playback(int16_t* out, ma_uint32 frames) { // embeds in the next packet) → PLC comfort noise. DRED and FEC both need the // *next* packet already buffered, so copy it once and try each in turn. n = -1; -#ifdef VOICECAT_HAS_OPUS uint32_t next_ts = stream.playout_ts + static_cast(frame_samples); size_t psz = stream.jitter.try_copy_front_payload( next_ts, stream.dred_payload_scratch_.data(), @@ -777,7 +739,6 @@ void AudioEngine::on_playback(int16_t* out, ma_uint32 frames) { stream.dred_payload_scratch_.data(), static_cast(psz), stream.decode_scratch.data(), frame_samples, /*fec=*/true); } -#endif // 3. PLC: synthesize a continuation when no redundancy is available. if (n <= 0) { n = stream.decoder.decode(nullptr, 0, stream.decode_scratch.data(), @@ -858,10 +819,6 @@ void AudioEngine::on_playback(int16_t* out, ma_uint32 frames) { int32_t s = static_cast(static_cast(mix[i]) * ovol); out[i] = static_cast(std::clamp(s, -32768, 32767)); } -#else - (void)out; - (void)frames; -#endif } // External-playback timer (iOS VPIO): with no hardware playback device to "pull" frames, this @@ -986,11 +943,4 @@ bool AudioEngine::start_loopback_capture(int /*kind*/, int /*channels*/) { retur void AudioEngine::stop_loopback_capture() {} #endif // VOICECAT_HAS_LOOPBACK -#endif // VOICECAT_HAS_AUDIO - -#ifndef VOICECAT_HAS_AUDIO -bool AudioEngine::start_loopback_capture(int /*kind*/, int /*channels*/) { return false; } -void AudioEngine::stop_loopback_capture() {} -#endif - } // namespace voicecat::audio diff --git a/core/src/audio/audio_engine.h b/core/src/audio/audio_engine.h index 5eea5e0..069a8ca 100644 --- a/core/src/audio/audio_engine.h +++ b/core/src/audio/audio_engine.h @@ -25,14 +25,10 @@ #include #include -#ifdef VOICECAT_HAS_AUDIO // miniaudio single-header — MINIAUDIO_IMPLEMENTATION defined in audio_engine.cpp #include -#endif -#ifdef VOICECAT_HAS_OPUS #include "codec/opus_codec.h" -#endif #include "audio/apm_processor.h" @@ -222,7 +218,6 @@ class AudioEngine { // bounded-depth invariant. Returns 0 if the stream is unknown or not yet playing out. int32_t stream_playout_depth_samples(uint32_t ssrc) const; -#ifdef VOICECAT_HAS_OPUS // Configure the Opus decoder for an incoming ssrc (must be called before // push_recv_frame for that ssrc). user_id/stream_id identify the source for the // pcm_sink_ callback. is_voice marks a MIC stream so the receive-side NR pass knows it may @@ -230,7 +225,6 @@ class AudioEngine { // Thread-safe. void init_recv_stream(uint32_t ssrc, const codec::OpusParams& p, uint32_t user_id, uint32_t stream_id, bool is_voice); -#endif // External PCM tap: callback fired once per decoded Opus frame per remote stream, on the // playback (RT) thread. Matching signature to vc_pcm_sink_cb (cast at the C-ABI boundary). @@ -254,7 +248,6 @@ class AudioEngine { // is samples per channel; total samples written = samples_per_channel * channels. void inject_capture(int kind, const int16_t* pcm, size_t samples_per_channel, int channels); -#ifdef VOICECAT_HAS_AUDIO // TEST-ONLY — exposes the playback mixer without a real ma_device, so tests can verify // stereo mixing end-to-end (no audio hardware needed). Same logic the real playback // callback uses; safe to call any time after start() (no ma_device touched). @@ -312,7 +305,6 @@ class AudioEngine { } } } -#endif #ifdef VOICECAT_HAS_LOOPBACK // TEST-ONLY — drives the loopback accumulator directly with an explicit callback, the @@ -354,7 +346,6 @@ class AudioEngine { #endif private: -#ifdef VOICECAT_HAS_AUDIO static void capture_data_cb(ma_device*, void*, const void*, ma_uint32); static void playback_data_cb(ma_device*, void*, const void*, ma_uint32); void on_capture(const int16_t* pcm, ma_uint32 frames); @@ -403,7 +394,6 @@ class AudioEngine { bool loopback_started_ = false; int loopback_kind_ = 0; int loopback_channels_ = 1; // channel count the loopback device was opened with -#endif #endif AudioParams params_{}; @@ -441,9 +431,7 @@ class AudioEngine { // Per remote stream (protected by streams_mu_). struct RemoteStream { JitterBuffer jitter; -#ifdef VOICECAT_HAS_OPUS codec::OpusDecoder decoder; -#endif float gain = 1.0f; bool mute = false; uint32_t playout_ts = 0; @@ -484,9 +472,7 @@ class AudioEngine { // DRED: pre-allocated scratch for loss recovery. dred_state_ is per-stream; see // AudioEngine::dred_dec_ (shared). Allocated in init_recv_stream(); freed in remove_stream(). -#ifdef VOICECAT_HAS_OPUS ::OpusDRED* dred_state_ = nullptr; -#endif std::vector dred_payload_scratch_; // pre-sized to 4000 bytes // In-band FEC: whether the sender negotiated OPUS_SET_INBAND_FEC for this stream. @@ -574,9 +560,7 @@ class AudioEngine { std::atomic mixed_sink_user_{nullptr}; bool external_playback_ = false; -#ifdef VOICECAT_HAS_OPUS ::OpusDREDDecoder* dred_dec_ = nullptr; // shared DRED decoder; null if unsupported -#endif static constexpr int64_t kTalkHangoverMs = 300; }; diff --git a/core/src/codec/opus_codec.cpp b/core/src/codec/opus_codec.cpp index a2e85cc..cbf5b80 100644 --- a/core/src/codec/opus_codec.cpp +++ b/core/src/codec/opus_codec.cpp @@ -2,8 +2,6 @@ namespace voicecat::codec { -#ifdef VOICECAT_HAS_OPUS - // Map an intended channel/capture sample rate (Hz) to the Opus max-bandwidth constant. The // codec always runs at 48 kHz internally (docs/voice.md §3); this caps the bandwidth the // encoder will select so a channel can request narrowband/wideband audio for low-bitrate rooms. @@ -103,16 +101,4 @@ void OpusDecoder::destroy() { if (dec_) { opus_decoder_destroy(dec_); dec_ = nullptr; } } -#else // !VOICECAT_HAS_OPUS — stubs - -bool OpusEncoder::init(const OpusParams&) { err_ = "OPUS not compiled in"; return false; } -int OpusEncoder::encode(const int16_t*, int, uint8_t*, int) { return -1; } -void OpusEncoder::destroy() {} - -bool OpusDecoder::init(const OpusParams&) { err_ = "OPUS not compiled in"; return false; } -int OpusDecoder::decode(const uint8_t*, int, int16_t*, int, bool) { return -1; } -void OpusDecoder::destroy() {} - -#endif // VOICECAT_HAS_OPUS - } // namespace voicecat::codec diff --git a/core/src/codec/opus_codec.h b/core/src/codec/opus_codec.h index df8ec9b..9f297c9 100644 --- a/core/src/codec/opus_codec.h +++ b/core/src/codec/opus_codec.h @@ -10,9 +10,7 @@ #include #include -#ifdef VOICECAT_HAS_OPUS #include -#endif namespace voicecat::codec { @@ -73,11 +71,7 @@ class OpusEncoder { const char* error_string() const { return err_; } private: -#ifdef VOICECAT_HAS_OPUS ::OpusEncoder* enc_ = nullptr; -#else - void* enc_ = nullptr; -#endif int frame_samples_ = 0; int channels_ = 1; const char* err_ = nullptr; @@ -104,10 +98,8 @@ class OpusDecoder { // Decode a lost frame using pre-parsed DRED state from the next received packet. // dred_offset=0 means the frame immediately before the next packet. // Returns frame_samples on success, -1 if DRED unavailable or decode failed. -#ifdef VOICECAT_HAS_OPUS int decode_dred(::OpusDRED* dred, int32_t dred_offset, int16_t* out_pcm, int max_samples); ::OpusDecoder* raw() const { return dec_; } -#endif void destroy(); @@ -117,11 +109,7 @@ class OpusDecoder { const char* error_string() const { return err_; } private: -#ifdef VOICECAT_HAS_OPUS ::OpusDecoder* dec_ = nullptr; -#else - void* dec_ = nullptr; -#endif int frame_samples_ = 0; int channels_ = 1; const char* err_ = nullptr; diff --git a/core/src/core/client.cpp b/core/src/core/client.cpp index df87959..be9840e 100644 --- a/core/src/core/client.cpp +++ b/core/src/core/client.cpp @@ -1,7 +1,5 @@ #include "core/client.h" -#ifdef VOICECAT_HAS_NET - #ifdef _WIN32 # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN @@ -1867,7 +1865,6 @@ vc_result vc_client::test_inject_capture(uint32_t stream_id, const int16_t* pcm, } vc_result vc_client::list_devices(vc_device_kind kind, vc_device_list* out) { -#ifdef VOICECAT_HAS_AUDIO // Works in any connection state — device pickers need to populate pre-connect. auto devices = voicecat::audio::AudioEngine::enumerate_devices(kind == VC_DEVICE_INPUT); @@ -1885,12 +1882,6 @@ vc_result vc_client::list_devices(vc_device_kind kind, vc_device_list* out) { out->items = items; out->count = devices.size(); return VC_OK; -#else - (void)kind; - out->items = nullptr; - out->count = 0; - return VC_ERR_NOT_IMPLEMENTED; -#endif } // ── M4: channel/user/stream snapshot getters ───────────────────────────────── @@ -2209,102 +2200,3 @@ void vc_client::run_talk_timer() { std::this_thread::sleep_for(std::chrono::milliseconds(kTalkPollMs)); } } - -#else // !VOICECAT_HAS_NET - -// ── M0 stub implementations ─────────────────────────────────────────────────── - -vc_client::vc_client(const vc_config& cfg, vc_callbacks cb) : cfg_(cfg), cb_(cb) {} -vc_client::~vc_client() = default; - -void vc_client::emit(const vc_event& ev) const { - if (cb_.on_event) cb_.on_event(cb_.user, &ev); -} - -vc_result vc_client::connect(const char*, uint16_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::disconnect() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::authenticate_guest(const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::authenticate_user(const char*, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::join_channel(uint32_t, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::leave_channel() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::join_voice() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::leave_voice() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::stream_start(const vc_stream_desc&, uint32_t*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::stream_stop(uint32_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_input_device(uint32_t, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_capture_channels(uint32_t, uint32_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_input_mode(vc_input_mode) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_vad_threshold(float) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_input_gain(float) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_input_noise_reduction(bool) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_push_to_talk(bool) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_self_mute(bool, bool) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_remote_stream(uint32_t, uint32_t, float, bool, bool) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::get_remote_stream(uint32_t, uint32_t, vc_remote_stream_state*) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::send_text(vc_text_scope, uint32_t, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::list_devices(vc_device_kind, vc_device_list* out) { - out->items = nullptr; - out->count = 0; - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::get_stream_audio_config(uint32_t, uint32_t, vc_audio_config*) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::stream_feed_pcm(uint32_t, const int16_t*, size_t, uint32_t) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::set_pcm_sink(vc_pcm_sink_cb, void*) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::set_mixed_output_sink(vc_mixed_output_cb, void*) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::set_external_playback(bool) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::test_inject_capture(uint32_t, const int16_t*, size_t) { - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::list_channels(vc_channel_list* out) { - out->items = nullptr; - out->count = 0; - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::list_users(vc_user_list* out) { - out->items = nullptr; - out->count = 0; - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::list_user_streams(uint32_t, vc_stream_summary_list* out) { - out->items = nullptr; - out->count = 0; - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::confirm_server_identity(bool) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::get_server_identity_display(char*, size_t, size_t* out_len) { - if (out_len) *out_len = 0; - return VC_ERR_NOT_IMPLEMENTED; -} -vc_result vc_client::kick_user(uint32_t, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::ban_user(uint32_t, const char*, uint64_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_permission(uint32_t, const vc_permissions*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::set_server_mute(uint32_t, bool, bool) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::move_user(uint32_t, uint32_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::create_channel(const vc_channel_info*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::edit_channel(const vc_channel_info*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::delete_channel(uint32_t) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::create_account(const char*, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::reset_password(const char*, const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::delete_account(const char*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::list_accounts() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::get_account_list(vc_account_list*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::get_permissions(vc_permissions*) { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::audio_suspend() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::audio_resume() { return VC_ERR_NOT_IMPLEMENTED; } -vc_result vc_client::audio_restart() { return VC_ERR_NOT_IMPLEMENTED; } - -#endif // VOICECAT_HAS_NET diff --git a/core/src/core/client.h b/core/src/core/client.h index d9bf0b1..a6ce288 100644 --- a/core/src/core/client.h +++ b/core/src/core/client.h @@ -6,8 +6,6 @@ #include "voicecat.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -29,8 +27,6 @@ #include "session/session.h" #include "proto/voicecat.pb.h" -#endif // VOICECAT_HAS_NET - struct vc_client { vc_client(const vc_config& cfg, vc_callbacks cb); ~vc_client(); @@ -118,11 +114,7 @@ struct vc_client { vc_result get_permissions(vc_permissions* out); vc_connection_state state() const { -#ifdef VOICECAT_HAS_NET return state_net_.load(std::memory_order_acquire); -#else - return state_; -#endif } private: @@ -131,7 +123,6 @@ struct vc_client { vc_config cfg_{}; vc_callbacks cb_{}; -#ifdef VOICECAT_HAS_NET // ── M1: TCP/TLS control channel ───────────────────────────────────────────── std::atomic state_net_{VC_STATE_DISCONNECTED}; @@ -339,12 +330,8 @@ struct vc_client { // capture callback never allocates or races this pointer. std::unique_ptr mic_ns_; - // teardown_voice() is called both from run_io()'s own cleanup (on the io_thread_, when - // the read loop exits) and from disconnect() (on the caller's thread) -- without - // serializing those two call sites, both can see udp_thread_/talk_timer_thread_ as - // joinable() at the same time and race to join() the same std::thread object (UB; an - // intermittent "No such process" std::system_error on Windows is the typical symptom). - // This mutex makes teardown_voice() idempotent under concurrent calls. + // teardown_voice() is called from run_io() and disconnect() concurrently; this mutex + // makes it idempotent (avoids a double-join race on udp_thread_/talk_timer_thread_). std::mutex teardown_mu_; // ── io_thread_ entry point ────────────────────────────────────────────────── @@ -432,10 +419,6 @@ struct vc_client { // Convenience event emitters. void emit_error(vc_result r, const char* text); void emit_disconnected(vc_result r, const char* reason); - -#else // !VOICECAT_HAS_NET - vc_connection_state state_{VC_STATE_DISCONNECTED}; -#endif }; #endif // VOICECAT_CORE_CLIENT_H diff --git a/core/src/core/worker_pool.h b/core/src/core/worker_pool.h index a8b5fbc..73cca0c 100644 --- a/core/src/core/worker_pool.h +++ b/core/src/core/worker_pool.h @@ -4,13 +4,10 @@ * Used for Argon2id password hashing (deliberately slow) and TLS handshakes so * neither blocks the net thread. Real-time audio threads never use this. * - * Requires VOICECAT_HAS_NET (Asio). Undefined when building without deps. */ #ifndef VOICECAT_CORE_WORKER_POOL_H #define VOICECAT_CORE_WORKER_POOL_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -37,5 +34,4 @@ class WorkerPool { } // namespace voicecat -#endif // VOICECAT_HAS_NET #endif // VOICECAT_CORE_WORKER_POOL_H diff --git a/core/src/crypto/crypto.cpp b/core/src/crypto/crypto.cpp index 61cc893..1fa071d 100644 --- a/core/src/crypto/crypto.cpp +++ b/core/src/crypto/crypto.cpp @@ -1,7 +1,5 @@ #include "crypto/crypto.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -406,5 +404,3 @@ long SodiumMediaCrypto::open(const uint8_t* sealed, size_t len, const uint8_t* a } } // namespace voicecat::crypto - -#endif // VOICECAT_HAS_NET diff --git a/core/src/crypto/crypto.h b/core/src/crypto/crypto.h index 2b89064..a739216 100644 --- a/core/src/crypto/crypto.h +++ b/core/src/crypto/crypto.h @@ -12,8 +12,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -186,25 +184,4 @@ class SodiumMediaCrypto final : public MediaCrypto { } // namespace voicecat::crypto -#else // !VOICECAT_HAS_NET — skeleton stubs - -namespace voicecat::crypto { - -class MediaCrypto { - public: - virtual ~MediaCrypto() = default; - virtual long seal(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t) = 0; - virtual long open(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t) = 0; -}; - -class SodiumMediaCrypto final : public MediaCrypto { - public: - long seal(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t) override { return -1; } - long open(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t) override { return -1; } - uint64_t peek_send_counter() const { return 0; } -}; - -} // namespace voicecat::crypto - -#endif // VOICECAT_HAS_NET #endif // VOICECAT_CRYPTO_CRYPTO_H diff --git a/core/src/crypto/tofu_store.cpp b/core/src/crypto/tofu_store.cpp index fe2fdf6..3756579 100644 --- a/core/src/crypto/tofu_store.cpp +++ b/core/src/crypto/tofu_store.cpp @@ -1,7 +1,5 @@ #include "crypto/tofu_store.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -93,5 +91,3 @@ void TofuStore::save() const { } } // namespace voicecat::crypto - -#endif // VOICECAT_HAS_NET diff --git a/core/src/crypto/tofu_store.h b/core/src/crypto/tofu_store.h index f923c70..9a923f5 100644 --- a/core/src/crypto/tofu_store.h +++ b/core/src/crypto/tofu_store.h @@ -7,8 +7,6 @@ #ifndef VOICECAT_CRYPTO_TOFU_STORE_H #define VOICECAT_CRYPTO_TOFU_STORE_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -62,5 +60,4 @@ class TofuStore { } // namespace voicecat::crypto -#endif // VOICECAT_HAS_NET #endif // VOICECAT_CRYPTO_TOFU_STORE_H diff --git a/core/src/net/transport.cpp b/core/src/net/transport.cpp index 79b6790..a952c47 100644 --- a/core/src/net/transport.cpp +++ b/core/src/net/transport.cpp @@ -1,7 +1,5 @@ #include "net/transport.h" -#ifdef VOICECAT_HAS_NET - #include #include "crypto/crypto.h" @@ -483,5 +481,3 @@ asio::ip::udp::endpoint UdpMediaChannel::local_endpoint() const { } } // namespace voicecat::net - -#endif // VOICECAT_HAS_NET diff --git a/core/src/net/transport.h b/core/src/net/transport.h index b8185da..e2f9690 100644 --- a/core/src/net/transport.h +++ b/core/src/net/transport.h @@ -4,9 +4,8 @@ * Design: docs/architecture.md (Net thread), docs/protocol.md §1 (framing). * Implementation uses standalone Asio for sockets and timers. * - * The real classes are compiled only when VOICECAT_HAS_NET is defined (dev/release/ - * server-release — vcpkg deps on). The skeleton-preset stub definitions below keep the - * no-deps build green. + * Design: docs/architecture.md (Net thread), docs/protocol.md §1 (framing). + * Implementation uses standalone Asio for sockets and timers. */ #ifndef VOICECAT_NET_TRANSPORT_H #define VOICECAT_NET_TRANSPORT_H @@ -14,8 +13,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #define ASIO_STANDALONE 1 #include @@ -226,21 +223,4 @@ class UdpMediaChannel { } // namespace voicecat::net -#else // !VOICECAT_HAS_NET — skeleton stubs for the dev preset - -namespace voicecat::net { - -class TcpControlChannel { - public: - bool connected() const { return false; } -}; - -class UdpMediaChannel { - public: - bool bound() const { return false; } -}; - -} // namespace voicecat::net - -#endif // VOICECAT_HAS_NET #endif // VOICECAT_NET_TRANSPORT_H diff --git a/core/src/protocol/envelope.cpp b/core/src/protocol/envelope.cpp index d7c731b..b76dde7 100644 --- a/core/src/protocol/envelope.cpp +++ b/core/src/protocol/envelope.cpp @@ -1,7 +1,5 @@ #include "protocol/envelope.h" -#ifdef VOICECAT_HAS_NET - #include "protocol/protocol.h" #include @@ -30,5 +28,3 @@ uint64_t next_request_id() { } } // namespace voicecat::protocol - -#endif // VOICECAT_HAS_NET diff --git a/core/src/protocol/envelope.h b/core/src/protocol/envelope.h index 25b8eaa..6f0ef97 100644 --- a/core/src/protocol/envelope.h +++ b/core/src/protocol/envelope.h @@ -5,13 +5,10 @@ * envelopes without touching proto types directly. All callers that do need * the proto types can #include the generated header alongside this one. * - * Requires VOICECAT_HAS_NET (protobuf codegen). */ #ifndef VOICECAT_PROTOCOL_ENVELOPE_H #define VOICECAT_PROTOCOL_ENVELOPE_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -35,5 +32,4 @@ uint64_t next_request_id(); } // namespace voicecat::protocol -#endif // VOICECAT_HAS_NET #endif // VOICECAT_PROTOCOL_ENVELOPE_H diff --git a/core/src/session/session.cpp b/core/src/session/session.cpp index 0644b28..b33c59d 100644 --- a/core/src/session/session.cpp +++ b/core/src/session/session.cpp @@ -23,8 +23,6 @@ std::pair SessionModel::find_user_by_ssrc(uint32_t s return {nullptr, nullptr}; } -#ifdef VOICECAT_HAS_NET - namespace { void copy_channel_audio(Channel& ch, const voicecat::v1::AudioConfig& a) { @@ -160,6 +158,4 @@ void SessionModel::apply_channel_event(const voicecat::v1::ChannelEvent& ev) { } } -#endif // VOICECAT_HAS_NET - } // namespace voicecat::session diff --git a/core/src/session/session.h b/core/src/session/session.h index ecf39b7..d3c9b70 100644 --- a/core/src/session/session.h +++ b/core/src/session/session.h @@ -12,9 +12,7 @@ #include #include -#ifdef VOICECAT_HAS_NET #include "proto/voicecat.pb.h" -#endif namespace voicecat::session { @@ -88,11 +86,9 @@ class SessionModel { // Returns {nullptr, nullptr} if not found. std::pair find_user_by_ssrc(uint32_t ssrc) const; -#ifdef VOICECAT_HAS_NET void apply_snapshot(const voicecat::v1::ServerStateSnapshot& snap); void apply_user_event(const voicecat::v1::UserEvent& ev); void apply_channel_event(const voicecat::v1::ChannelEvent& ev); -#endif private: std::vector channels_; diff --git a/docs/building.md b/docs/building.md index 46f3e44..924ee1d 100644 --- a/docs/building.md +++ b/docs/building.md @@ -24,8 +24,7 @@ and *how to drive the binaries by hand*. | Preset | Binary dir | Deps | Build type | Server | Tools | Tests | Strip | Platform | What it's for | |--------|-----------|------|------------|--------|-------|-------|-------|----------|---------------| | `vcpkg-common` | — | vcpkg | — | — | — | — | — | all | Hidden base. Sets the vcpkg toolchain wrapper ([`cmake/voicecat-toolchain.cmake`](../cmake/voicecat-toolchain.cmake)) which auto-resolves the triplet from the host platform. Not used directly. | -| `skeleton` | `build/skeleton` | none | Debug | ON | ON | ON | no | all | The M0 skeleton. Compiles with just a C++20 compiler — no `VCPKG_ROOT` needed. Subsystems are stubs (`VC_ERR_NOT_IMPLEMENTED`). Good for "does the repo even build" sanity checks. Runs 2 tests (smoke + frame_codec). | -| `dev` | `build/dev` | vcpkg | Debug | ON | ON | ON | no | all | **The one you actually want.** Day-to-day development: real protocol, crypto, voice, server — everything. Builds server + tools + tests (21 tests). Works on Windows, Linux, and macOS (triplet auto-resolved). | +| `dev` | `build/dev` | vcpkg | Debug | ON | ON | ON | no | all | **The one you actually want.** Day-to-day development: real protocol, crypto, voice, server — everything. Builds server + tools + tests (29 tests). Works on Windows, Linux, and macOS (triplet auto-resolved). | | `release` | `build/release` | vcpkg | Release | ON | ON | ON | no | all | Optimized build with the full test suite. Use to run tests against optimized code, profile, or catch optimizer-sensitive bugs. Symbols kept (not stripped) so stack traces and profiling remain useful. | | `server-release` | `build/server-release` | vcpkg | Release | ON | ON | OFF | **yes** | all | Production-shaped build for deployment. Optimized + stripped binaries (`-s`), no tests. This is what you'd ship/run — see [docs/deployment.md](deployment.md). | | `windows-client` | `build/windows-client` | vcpkg | Release | OFF | OFF | OFF | no | Windows | Produces a redistributable `voicecat.dll` for the C# WinForms client (M4). Static MinGW runtime — no `libgcc_s_seh-1.dll` etc. See [clients/windows/README.md](../clients/windows/README.md). | @@ -33,10 +32,9 @@ and *how to drive the binaries by hand*. | `apple-ios` | `build/apple-ios` | vcpkg | Release | OFF | OFF | OFF | no | macOS→iOS | **Scaffolding** — cross-compiled static `libvoicecat.a` for iOS device (`arm64-ios`). One XCFramework slice. Not yet CI-validated. | | `apple-ios-sim` | `build/apple-ios-sim` | vcpkg | Release | OFF | OFF | OFF | no | macOS→iOS sim | **Scaffolding** — cross-compiled static `libvoicecat.a` for iOS simulator (`arm64-ios-sim`). One XCFramework slice. Not yet CI-validated. | -So in practice there are three presets that matter for day-to-day work: +So in practice there are two presets that matter for day-to-day work: - **`dev`** — everything: real protocol, real voice, real manual testing. This is the loop you run constantly. - **`release`** — same suite, optimized. Run it when you want to check optimized behavior or profile. -- **`skeleton`** — fast no-deps build to confirm the stub path still compiles (CI smoke check). The rest are purpose-specific: `server-release` for deployment, `windows-client` for the DLL, `apple-*` for Apple platform slices. @@ -63,9 +61,9 @@ The preset set was cleaned up on 2026-06-18 (see `PROGRESS.md`). The old names m | Old name | New name | Notes | |----------|----------|-------| -| `dev` | `skeleton` | Renamed to reflect its actual purpose (no-deps stub smoke check). | | `m1-dev` | `dev` | Renamed — the project is past M5, so milestone-named presets were misleading. This is now the default development preset. | | `m2-dev` | *(dropped)* | Was cache-identical to `m1-dev` (same flags, same triplet, only the binary dir differed). Removed. | +| `skeleton` | *(dropped)* | Removed — was a no-deps stub build mode used during M0. All subsystems are now fully implemented; the stub `#ifdef` scaffolding has been deleted. | | `server-release` | `server-release` | Unchanged name; now stripped (`-s`) and auto-triplet. | | *(new)* | `release` | New: optimized build with tests on, symbols kept. | | `windows-client` | `windows-client` | Unchanged name; triplet now auto-resolved. | @@ -77,7 +75,7 @@ was run. ## 2. One-time setup for the real-deps presets -`dev`, `release`, `server-release`, `windows-client`, and `apple-*` all need `VCPKG_ROOT` +All presets except `vcpkg-common` need `VCPKG_ROOT` pointing at a bootstrapped vcpkg checkout: ```bash diff --git a/server/src/conn_session.cpp b/server/src/conn_session.cpp index f868c51..b147889 100644 --- a/server/src/conn_session.cpp +++ b/server/src/conn_session.cpp @@ -1,7 +1,5 @@ #include "conn_session.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -845,5 +843,3 @@ void ConnSession::send_disconnect_and_close(uint32_t code, const std::string& re } } // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/conn_session.h b/server/src/conn_session.h index 8475207..d0aeacc 100644 --- a/server/src/conn_session.h +++ b/server/src/conn_session.h @@ -11,8 +11,6 @@ #ifndef VOICECAT_SERVER_CONN_SESSION_H #define VOICECAT_SERVER_CONN_SESSION_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -184,5 +182,4 @@ class ConnSession : public std::enable_shared_from_this { } // namespace voicecat::server -#endif // VOICECAT_HAS_NET #endif // VOICECAT_SERVER_CONN_SESSION_H diff --git a/server/src/db.cpp b/server/src/db.cpp index a7efb29..e8795b1 100644 --- a/server/src/db.cpp +++ b/server/src/db.cpp @@ -1,7 +1,5 @@ #include "db.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -612,5 +610,3 @@ int64_t Database::now_unix() const { } } // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/db.h b/server/src/db.h index 4061b58..2f999b9 100644 --- a/server/src/db.h +++ b/server/src/db.h @@ -9,8 +9,6 @@ #ifndef VOICECAT_SERVER_DB_H #define VOICECAT_SERVER_DB_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -152,5 +150,4 @@ class Database { } // namespace voicecat::server -#endif // VOICECAT_HAS_NET #endif // VOICECAT_SERVER_DB_H diff --git a/server/src/identity.cpp b/server/src/identity.cpp index 3aab1ff..10d5c64 100644 --- a/server/src/identity.cpp +++ b/server/src/identity.cpp @@ -1,7 +1,5 @@ #include "identity.h" -#ifdef VOICECAT_HAS_NET - #include #include @@ -35,5 +33,3 @@ bool ServerIdentityManager::init(const std::filesystem::path& data_dir, } } // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/identity.h b/server/src/identity.h index 1146592..1b2e2a0 100644 --- a/server/src/identity.h +++ b/server/src/identity.h @@ -7,8 +7,6 @@ #ifndef VOICECAT_SERVER_IDENTITY_H #define VOICECAT_SERVER_IDENTITY_H -#ifdef VOICECAT_HAS_NET - #include #include @@ -36,5 +34,4 @@ class ServerIdentityManager { } // namespace voicecat::server -#endif // VOICECAT_HAS_NET #endif // VOICECAT_SERVER_IDENTITY_H diff --git a/server/src/media_relay.cpp b/server/src/media_relay.cpp index c138806..9aa1b2d 100644 --- a/server/src/media_relay.cpp +++ b/server/src/media_relay.cpp @@ -1,7 +1,5 @@ #include "media_relay.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -179,5 +177,3 @@ void MediaRelay::on_udp_frame(const uint8_t* data, size_t len, } } // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/media_relay.h b/server/src/media_relay.h index 708fcb5..381ff75 100644 --- a/server/src/media_relay.h +++ b/server/src/media_relay.h @@ -16,8 +16,6 @@ #ifndef VOICECAT_SERVER_MEDIA_RELAY_H #define VOICECAT_SERVER_MEDIA_RELAY_H -#ifdef VOICECAT_HAS_NET - #include #define ASIO_STANDALONE 1 @@ -71,5 +69,4 @@ class MediaRelay { } // namespace voicecat::server -#endif // VOICECAT_HAS_NET #endif // VOICECAT_SERVER_MEDIA_RELAY_H diff --git a/server/src/server.cpp b/server/src/server.cpp index fa03a86..f4d34f7 100644 --- a/server/src/server.cpp +++ b/server/src/server.cpp @@ -3,8 +3,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #define ASIO_STANDALONE 1 #include #include @@ -224,21 +222,3 @@ void Server::stop() { } } // namespace voicecat::server - -#else // !VOICECAT_HAS_NET - -namespace voicecat::server { - -int Server::run() { - std::fprintf(stderr, "[server] stub: VOICECAT_HAS_NET not defined (build with dev preset)\n"); - std::printf(" server_name : %s\n", cfg_.server_name.c_str()); - std::printf(" data_dir : %s\n", cfg_.data_dir.c_str()); - std::printf(" bind_port : %u\n", cfg_.bind_port); - return 0; -} - -void Server::stop() {} - -} // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/session_registry.cpp b/server/src/session_registry.cpp index 28fa92a..47ebe0c 100644 --- a/server/src/session_registry.cpp +++ b/server/src/session_registry.cpp @@ -1,7 +1,5 @@ #include "session_registry.h" -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -554,5 +552,3 @@ std::optional SessionRegistry::channel_audio_config( } } // namespace voicecat::server - -#endif // VOICECAT_HAS_NET diff --git a/server/src/session_registry.h b/server/src/session_registry.h index a79ea9f..03a9ef5 100644 --- a/server/src/session_registry.h +++ b/server/src/session_registry.h @@ -8,8 +8,6 @@ #ifndef VOICECAT_SERVER_SESSION_REGISTRY_H #define VOICECAT_SERVER_SESSION_REGISTRY_H -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -223,4 +221,3 @@ class SessionRegistry { } // namespace voicecat::server #endif // VOICECAT_SERVER_SESSION_REGISTRY_H -#endif // VOICECAT_SERVER_SESSION_REGISTRY_H diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0d432cd..be6da1b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,7 +6,6 @@ target_link_libraries(test_smoke PRIVATE voicecat::voicecat) target_compile_features(test_smoke PRIVATE cxx_std_20) add_test(NAME smoke COMMAND test_smoke) -# frame_codec has no third-party deps; runs under both skeleton and dev. # Needs core/src on the include path to reach internal headers (protocol/, session/, etc.). add_executable(test_frame_codec test_frame_codec.cpp) target_link_libraries(test_frame_codec PRIVATE voicecat::voicecat) @@ -14,8 +13,7 @@ target_compile_features(test_frame_codec PRIVATE cxx_std_20) target_include_directories(test_frame_codec PRIVATE ${CMAKE_SOURCE_DIR}/core/src) add_test(NAME frame_codec COMMAND test_frame_codec) -if(VOICECAT_USE_VCPKG_DEPS) - set(VC_TEST_INTERNAL_INCLUDES +set(VC_TEST_INTERNAL_INCLUDES ${CMAKE_SOURCE_DIR}/core/src ${CMAKE_SOURCE_DIR}/server/src ${CMAKE_BINARY_DIR}/core/generated) # protobuf-generated headers @@ -247,4 +245,3 @@ if(VOICECAT_USE_VCPKG_DEPS) target_include_directories(test_recv_noise_reduction PRIVATE ${VC_TEST_INTERNAL_INCLUDES}) add_test(NAME recv_noise_reduction COMMAND test_recv_noise_reduction) set_tests_properties(recv_noise_reduction PROPERTIES TIMEOUT 90) -endif() diff --git a/tests/test_channel_samplerate.cpp b/tests/test_channel_samplerate.cpp index b0ac596..0150869 100644 --- a/tests/test_channel_samplerate.cpp +++ b/tests/test_channel_samplerate.cpp @@ -14,8 +14,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -309,12 +307,3 @@ int main() { std::printf("channel_samplerate: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("channel_samplerate: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_channel_user_list_abi.cpp b/tests/test_channel_user_list_abi.cpp index 58e11fc..2282433 100644 --- a/tests/test_channel_user_list_abi.cpp +++ b/tests/test_channel_user_list_abi.cpp @@ -21,8 +21,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -333,12 +331,3 @@ int main() { std::printf("channel_user_list_abi: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("channel_user_list_abi: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_disconnect_left.cpp b/tests/test_disconnect_left.cpp index 9b7a95a..603b065 100644 --- a/tests/test_disconnect_left.cpp +++ b/tests/test_disconnect_left.cpp @@ -9,8 +9,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -210,12 +208,3 @@ int main() { std::printf("disconnect_left: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("disconnect_left: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_dred_toggle.cpp b/tests/test_dred_toggle.cpp index f7843e1..001fc84 100644 --- a/tests/test_dred_toggle.cpp +++ b/tests/test_dred_toggle.cpp @@ -9,8 +9,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -268,12 +266,3 @@ int main() { std::printf("dred_toggle: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("dred_toggle: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_external_pcm.cpp b/tests/test_external_pcm.cpp index 710fe10..51d4fc1 100644 --- a/tests/test_external_pcm.cpp +++ b/tests/test_external_pcm.cpp @@ -15,8 +15,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -445,12 +443,3 @@ int main() { std::printf("external_pcm: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("external_pcm: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_frame_ms_reframe.cpp b/tests/test_frame_ms_reframe.cpp index b052a0a..655da9b 100644 --- a/tests/test_frame_ms_reframe.cpp +++ b/tests/test_frame_ms_reframe.cpp @@ -17,8 +17,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -318,12 +316,3 @@ int main() { std::printf("frame_ms_reframe: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("frame_ms_reframe: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m1_integration.cpp b/tests/test_m1_integration.cpp index 4805fce..7f33cfc 100644 --- a/tests/test_m1_integration.cpp +++ b/tests/test_m1_integration.cpp @@ -10,8 +10,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -255,12 +253,3 @@ int main() { std::printf("m1_integration: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m1_integration: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m2_voice.cpp b/tests/test_m2_voice.cpp index 6887d4d..10d3b29 100644 --- a/tests/test_m2_voice.cpp +++ b/tests/test_m2_voice.cpp @@ -14,8 +14,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -53,9 +51,7 @@ #include "server.h" #include "db.h" -#ifdef VOICECAT_HAS_OPUS #include "codec/opus_codec.h" -#endif using namespace voicecat; using namespace voicecat::net; @@ -441,7 +437,6 @@ int main() { constexpr int kFramesToSend = 50; constexpr int kFrameSamples = 960; // 20 ms @48 kHz -#ifdef VOICECAT_HAS_OPUS voicecat::codec::OpusEncoder enc; { voicecat::codec::OpusParams p; @@ -450,24 +445,17 @@ int main() { p.fec = true; CHECK(enc.init(p)); } -#endif std::vector aead_buf(4096); // scratch for (int i = 0; i < kFramesToSend; ++i) { auto pcm = make_sine_frame(i, kFrameSamples); -#ifdef VOICECAT_HAS_OPUS uint8_t opus_buf[1000]; int opus_len = enc.encode(pcm.data(), kFrameSamples, opus_buf, sizeof(opus_buf)); if (opus_len <= 0) continue; const uint8_t* payload = opus_buf; size_t payload_len = static_cast(opus_len); -#else - // Fallback: use raw PCM as synthetic payload - const uint8_t* payload = reinterpret_cast(pcm.data()); - size_t payload_len = pcm.size() * sizeof(int16_t); -#endif // Build the voice frame header (AAD). VoiceFrame hdr; @@ -494,9 +482,7 @@ int main() { std::this_thread::sleep_for(std::chrono::milliseconds(20)); } -#ifdef VOICECAT_HAS_OPUS enc.destroy(); -#endif // ── B collects received frames (2s window after last send) ──────────────── int recv_count = 0, decrypt_ok = 0; @@ -541,12 +527,3 @@ int main() { std::printf("m2_voice: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m2_voice: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m3_multistream.cpp b/tests/test_m3_multistream.cpp index b7f0804..8557665 100644 --- a/tests/test_m3_multistream.cpp +++ b/tests/test_m3_multistream.cpp @@ -20,8 +20,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -387,12 +385,3 @@ int main() { std::printf("m3_multistream: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m3_multistream: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m5_admin_accounts.cpp b/tests/test_m5_admin_accounts.cpp index 4f8791c..3003b14 100644 --- a/tests/test_m5_admin_accounts.cpp +++ b/tests/test_m5_admin_accounts.cpp @@ -13,8 +13,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -265,12 +263,3 @@ int main() { std::printf("m5_admin_accounts: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m5_admin_accounts: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m5_channel_crud.cpp b/tests/test_m5_channel_crud.cpp index 15a28b1..c9a15cf 100644 --- a/tests/test_m5_channel_crud.cpp +++ b/tests/test_m5_channel_crud.cpp @@ -12,8 +12,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -308,12 +306,3 @@ int main() { std::printf("m5_channel_crud: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m5_channel_crud: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m5_kick_ban_move_mute.cpp b/tests/test_m5_kick_ban_move_mute.cpp index b723993..d9b8aab 100644 --- a/tests/test_m5_kick_ban_move_mute.cpp +++ b/tests/test_m5_kick_ban_move_mute.cpp @@ -10,8 +10,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -320,12 +318,3 @@ int main() { std::printf("m5_kick_ban_move_mute: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m5_kick_ban_move_mute: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_m5_permissions.cpp b/tests/test_m5_permissions.cpp index 7ddce6f..e37dade 100644 --- a/tests/test_m5_permissions.cpp +++ b/tests/test_m5_permissions.cpp @@ -12,8 +12,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -255,12 +253,3 @@ int main() { std::printf("m5_permissions: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("m5_permissions: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_opus_codec.cpp b/tests/test_opus_codec.cpp index 5670a57..bf86c25 100644 --- a/tests/test_opus_codec.cpp +++ b/tests/test_opus_codec.cpp @@ -20,14 +20,6 @@ static int g_failures = 0; ++g_failures; \ }} while (0) -#ifndef VOICECAT_HAS_OPUS - -int main() { - std::printf("opus_codec: VOICECAT_HAS_OPUS not defined — skipped\n"); - return 0; -} - -#else static constexpr int kSampleRate = 48000; static constexpr int kFrameMs = 20; @@ -145,5 +137,3 @@ int main() { std::printf("opus_codec: %d test(s) FAILED\n", g_failures); return 1; } - -#endif // VOICECAT_HAS_OPUS diff --git a/tests/test_reaper_timeout.cpp b/tests/test_reaper_timeout.cpp index 30fe340..5229898 100644 --- a/tests/test_reaper_timeout.cpp +++ b/tests/test_reaper_timeout.cpp @@ -13,8 +13,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -195,12 +193,3 @@ int main() { std::printf("reaper_timeout: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("reaper_timeout: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_smoke.cpp b/tests/test_smoke.cpp index 906b2b2..d8e11c1 100644 --- a/tests/test_smoke.cpp +++ b/tests/test_smoke.cpp @@ -1,9 +1,8 @@ /* - * test_smoke — verifies the core links and the C ABI behaves as specified for M0. + * test_smoke — verifies the core links and the C ABI behaves as specified. * * This is intentionally a behavior test, not a "does it compile" check: it asserts the - * documented contract (version present, handle lifecycle, invalid-arg guards, and that - * unimplemented calls report VC_ERR_NOT_IMPLEMENTED rather than crashing). + * documented contract (version present, handle lifecycle, invalid-arg guards). */ #include #include @@ -25,8 +24,6 @@ int main() { CHECK(vc_version_string() != nullptr); CHECK(std::strlen(vc_version_string()) > 0); CHECK(std::strcmp(vc_result_string(VC_OK), "ok") == 0); - CHECK(std::strcmp(vc_result_string(VC_ERR_NOT_IMPLEMENTED), "not implemented") == 0); - // Null-config create is rejected; valid create yields a handle. vc_callbacks cb{}; CHECK(vc_client_create(nullptr, cb) == nullptr); @@ -43,34 +40,26 @@ int main() { CHECK(vc_connect(c, nullptr, 1) == VC_ERR_INVALID_ARG); CHECK(vc_send_text(c, VC_TEXT_CHANNEL, 0, nullptr) == VC_ERR_INVALID_ARG); - // Under skeleton preset: NOT_IMPLEMENTED. Under dev: VC_OK (async connect). vc_result rc_connect = vc_connect(c, "127.0.0.1", 8384); - CHECK(rc_connect == VC_ERR_NOT_IMPLEMENTED || rc_connect == VC_OK); + CHECK(rc_connect == VC_OK); - // Auth before connected (or on a stub) → NOT_CONNECTED or NOT_IMPLEMENTED. + // Auth before connected → NOT_CONNECTED. { vc_config cfg2 = cfg; vc_client* c2 = vc_client_create(&cfg2, cb); vc_result rc_auth = vc_authenticate_guest(c2, "nick"); - CHECK(rc_auth == VC_ERR_NOT_IMPLEMENTED || rc_auth == VC_ERR_NOT_CONNECTED); + CHECK(rc_auth == VC_ERR_NOT_CONNECTED); vc_client_destroy(c2); } - // join_channel before connected → NOT_CONNECTED or NOT_IMPLEMENTED. + // join_channel before connected → NOT_CONNECTED. vc_result rc_join = vc_join_channel(c, 1, nullptr); - CHECK(rc_join == VC_ERR_NOT_IMPLEMENTED || rc_join == VC_ERR_NOT_CONNECTED); + CHECK(rc_join == VC_ERR_NOT_CONNECTED); vc_device_list dl{}; vc_result rc_devices = vc_list_devices(c, VC_DEVICE_INPUT, &dl); -#ifdef VOICECAT_HAS_AUDIO - // Real device enumeration is wired up once miniaudio is linked in (post-M3 follow-up). - // Never assert count > 0 here — a headless CI build agent may legitimately report zero - // audio devices; only that the call itself succeeded. + // Never assert count > 0 — a headless CI agent may report zero audio devices. CHECK(rc_devices == VC_OK); -#else - CHECK(rc_devices == VC_ERR_NOT_IMPLEMENTED); - CHECK(dl.count == 0); -#endif vc_free_device_list(&dl); vc_client_destroy(c); diff --git a/tests/test_tofu_flow.cpp b/tests/test_tofu_flow.cpp index 8ca8d4a..bf902da 100644 --- a/tests/test_tofu_flow.cpp +++ b/tests/test_tofu_flow.cpp @@ -19,8 +19,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -374,12 +372,3 @@ int main() { std::printf("tofu_flow: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("tofu_flow: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_vad_ptt_devices.cpp b/tests/test_vad_ptt_devices.cpp index 5a90d40..85b79fd 100644 --- a/tests/test_vad_ptt_devices.cpp +++ b/tests/test_vad_ptt_devices.cpp @@ -18,8 +18,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -35,12 +33,8 @@ #include "server.h" #include "db.h" -#ifdef VOICECAT_HAS_AUDIO #include "audio/audio_engine.h" -#endif -#ifdef VOICECAT_HAS_OPUS #include "codec/opus_codec.h" -#endif // ── Event tracking (same shape as test_m3_multistream.cpp) ────────────────────── @@ -159,7 +153,6 @@ static void test_device_enumeration() { for (vc_device_kind kind : {VC_DEVICE_INPUT, VC_DEVICE_OUTPUT}) { vc_device_list dl{}; vc_result r = vc_list_devices(c, kind, &dl); -#ifdef VOICECAT_HAS_AUDIO CHECK(r == VC_OK); // Headless CI build agents may legitimately report zero devices — never assert // count > 0, only that the call itself succeeded and the list is well-formed. @@ -167,9 +160,6 @@ static void test_device_enumeration() { CHECK(dl.items[i].id != nullptr); CHECK(dl.items[i].name != nullptr); } -#else - CHECK(r == VC_ERR_NOT_IMPLEMENTED); -#endif vc_free_device_list(&dl); vc_free_device_list(&dl); // idempotent — must not crash on a second call } @@ -179,7 +169,6 @@ static void test_device_enumeration() { } // ── 4. Stereo playback mixer (white-box, no audio hardware needed) ────────────── -#if defined(VOICECAT_HAS_AUDIO) && defined(VOICECAT_HAS_OPUS) static void test_stereo_mix() { voicecat::audio::AudioEngine engine; voicecat::audio::AudioParams p; @@ -245,7 +234,7 @@ static void test_stereo_mix() { // and mixes — asserting L != R across the frame. A mono-downmixed-then-upmixed bitstream would // have L == R. Mirrors test_stereo_mix but routes the encode side through the loopback // accumulator path that the fix touches (feed_loopback_for_test → on_loopback's accumulator). -#if defined(VOICECAT_HAS_LOOPBACK) && defined(VOICECAT_HAS_OPUS) +#if defined(VOICECAT_HAS_LOOPBACK) static void test_loopback_stereo_capture() { voicecat::audio::AudioEngine engine; voicecat::audio::AudioParams p; @@ -382,14 +371,12 @@ static void test_playout_resync() { engine.stop(); std::printf("test_playout_resync: ok (energy=%lld)\n", static_cast(energy)); } -#endif // VOICECAT_HAS_AUDIO && VOICECAT_HAS_OPUS // ── 5. Capture-frame accumulation (white-box, no audio hardware needed) ────────── // Regression for the capture-side analogue of the playback ring fix: miniaudio's capture // callback fires at the hardware period (commonly 480 samples on WASAPI shared mode), while // opus_encode() requires exactly frame_samples_ (960). Sub-frame chunks must be accumulated; // the callback must receive exactly 960-sample frames regardless of input chunk size. -#ifdef VOICECAT_HAS_AUDIO static void test_capture_frame_accumulation() { voicecat::audio::AudioEngine engine; voicecat::audio::AudioParams p; @@ -436,7 +423,6 @@ static void test_capture_frame_accumulation() { engine.stop(); std::printf("test_capture_frame_accumulation: ok (callbacks=%d)\n", call_count.load()); } -#endif // VOICECAT_HAS_AUDIO // ── 2/3. VAD + PTT gate, through the real ABI against a real server ───────────── static void test_vad_and_ptt_gate() { @@ -601,7 +587,6 @@ static void test_vad_and_ptt_gate() { // downmix). Mirrors test_loopback_stereo_capture but routes through the mic capture // accumulator (feed_capture_for_test with channels=2) instead of the loopback path. // This is the headless CI test for the iOS stereo built-in mic feature (Part D). -#if defined(VOICECAT_HAS_AUDIO) && defined(VOICECAT_HAS_OPUS) static void test_stereo_mic_capture() { voicecat::audio::AudioEngine engine; voicecat::audio::AudioParams p; @@ -674,7 +659,6 @@ static void test_stereo_mic_capture() { std::printf("test_stereo_mic_capture: ok (total_diff=%lld, seen_channels=%d)\n", static_cast(total_diff), seen_channels); } -#endif // ── 6. Stereo mic capture on a MONO channel (downmix safety) ────────────────── // A stereo mic (vc_set_capture_channels=2) can be enabled while on a mono channel. The mic @@ -683,7 +667,6 @@ static void test_stereo_mic_capture() { // opus_encode makes it read 2× the samples it should (wrong pitch / garbage). This mirrors that // fold and proves the result is a valid mono bitstream that decodes to the expected averaged // signal, rather than half-length junk. -#if defined(VOICECAT_HAS_AUDIO) && defined(VOICECAT_HAS_OPUS) static void test_stereo_mic_mono_channel() { voicecat::codec::OpusParams mono_params; mono_params.stereo = false; // mono channel — encoder is mono @@ -727,11 +710,9 @@ static void test_stereo_mic_mono_channel() { std::printf("test_stereo_mic_mono_channel: ok (opus_len=%d, energy=%lld)\n", opus_len, static_cast(energy)); } -#endif int main() { test_device_enumeration(); -#if defined(VOICECAT_HAS_AUDIO) && defined(VOICECAT_HAS_OPUS) test_stereo_mix(); #if defined(VOICECAT_HAS_LOOPBACK) test_loopback_stereo_capture(); @@ -739,10 +720,7 @@ int main() { test_stereo_mic_capture(); test_stereo_mic_mono_channel(); test_playout_resync(); -#endif -#ifdef VOICECAT_HAS_AUDIO test_capture_frame_accumulation(); -#endif test_vad_and_ptt_gate(); if (g_failures == 0) { @@ -752,12 +730,3 @@ int main() { std::printf("vad_ptt_devices: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("vad_ptt_devices: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tests/test_voice_client_abi.cpp b/tests/test_voice_client_abi.cpp index a823182..93625b6 100644 --- a/tests/test_voice_client_abi.cpp +++ b/tests/test_voice_client_abi.cpp @@ -9,8 +9,6 @@ */ #include -#ifdef VOICECAT_HAS_NET - #include #include #include @@ -253,12 +251,3 @@ int main() { std::printf("voice_client_abi: %d failure(s)\n", g_failures); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::printf("voice_client_abi: SKIP (VOICECAT_HAS_NET not defined)\n"); - return 0; -} - -#endif // VOICECAT_HAS_NET diff --git a/tools/voicecat-admin/src/main.cpp b/tools/voicecat-admin/src/main.cpp index c9069d1..e419964 100644 --- a/tools/voicecat-admin/src/main.cpp +++ b/tools/voicecat-admin/src/main.cpp @@ -14,8 +14,6 @@ #include #include -#ifdef VOICECAT_HAS_NET - #include "db.h" using namespace voicecat::server; @@ -141,12 +139,3 @@ int main(int argc, char** argv) { print_usage(argv[0]); return 1; } - -#else // !VOICECAT_HAS_NET - -int main() { - std::fprintf(stderr, "voicecat-admin requires VOICECAT_HAS_NET (build with dev preset)\n"); - return 1; -} - -#endif // VOICECAT_HAS_NET