diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/audio_core/cubeb_sink.cpp | 7 | ||||
-rw-r--r-- | src/audio_core/null_sink.h | 4 | ||||
-rw-r--r-- | src/audio_core/sink_stream.h | 2 | ||||
-rw-r--r-- | src/audio_core/stream.cpp | 1 |
5 files changed, 15 insertions, 0 deletions
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index 82e4850f7..de5c291ce 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt @@ -24,6 +24,7 @@ add_library(audio_core STATIC create_target_directory_groups(audio_core) target_link_libraries(audio_core PUBLIC common core) +target_link_libraries(audio_core PRIVATE SoundTouch) if(ENABLE_CUBEB) target_link_libraries(audio_core PRIVATE cubeb) diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 5a1177d0c..0f77fd162 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -85,6 +85,13 @@ public: } } + size_t SamplesInQueue(u32 num_channels) const { + if (!ctx) + return 0; + + return queue.size() / num_channels; + } + u32 GetNumChannels() const { return num_channels; } diff --git a/src/audio_core/null_sink.h b/src/audio_core/null_sink.h index f235d93e5..fbb1bc225 100644 --- a/src/audio_core/null_sink.h +++ b/src/audio_core/null_sink.h @@ -21,6 +21,10 @@ public: private: struct NullSinkStreamImpl final : SinkStream { void EnqueueSamples(u32 /*num_channels*/, const std::vector<s16>& /*samples*/) override {} + + size_t SamplesInQueue(u32 /*num_channels*/) const override { + return 0; + } } null_sink_stream; }; diff --git a/src/audio_core/sink_stream.h b/src/audio_core/sink_stream.h index 41b6736d8..743a743a3 100644 --- a/src/audio_core/sink_stream.h +++ b/src/audio_core/sink_stream.h @@ -25,6 +25,8 @@ public: * @param samples Samples in interleaved stereo PCM16 format. */ virtual void EnqueueSamples(u32 num_channels, const std::vector<s16>& samples) = 0; + + virtual std::size_t SamplesInQueue(u32 num_channels) const = 0; }; using SinkStreamPtr = std::unique_ptr<SinkStream>; diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index dbae75d8c..49c6efc85 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp @@ -90,6 +90,7 @@ void Stream::PlayNextBuffer() { queued_buffers.pop(); VolumeAdjustSamples(active_buffer->Samples()); + sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); CoreTiming::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {}); |