diff options
author | merry <git@mary.rs> | 2022-04-02 20:49:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-02 20:49:21 +0100 |
commit | 7f1e66e94be9a207bf5ec21cd6f02562bde25eca (patch) | |
tree | 5bb1a72eb10bf424ceef8af7ee6ca64849d43268 /src/audio_core/cubeb_sink.cpp | |
parent | 1e47252214d956d049b0726d015576877e682fd1 (diff) | |
parent | faf6a9876c394664d647355726290014b24efffc (diff) |
Merge pull request #8134 from Tachi107/remove-time-stretcher
audio_core: remove time stretcher
Diffstat (limited to 'src/audio_core/cubeb_sink.cpp')
-rw-r--r-- | src/audio_core/cubeb_sink.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 93c35e7858..13de3087c1 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -7,7 +7,6 @@ #include <cstring> #include "audio_core/cubeb_sink.h" #include "audio_core/stream.h" -#include "audio_core/time_stretch.h" #include "common/assert.h" #include "common/logging/log.h" #include "common/ring_buffer.h" @@ -23,8 +22,7 @@ class CubebSinkStream final : public SinkStream { public: CubebSinkStream(cubeb* ctx_, u32 sample_rate, u32 num_channels_, cubeb_devid output_device, const std::string& name) - : ctx{ctx_}, num_channels{std::min(num_channels_, 6u)}, time_stretch{sample_rate, - num_channels} { + : ctx{ctx_}, num_channels{std::min(num_channels_, 6u)} { cubeb_stream_params params{}; params.rate = sample_rate; @@ -131,7 +129,6 @@ private: Common::RingBuffer<s16, 0x10000> queue; std::array<s16, 2> last_frame{}; std::atomic<bool> should_flush{}; - TimeStretcher time_stretch; static long DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer, void* output_buffer, long num_frames); @@ -205,25 +202,7 @@ long CubebSinkStream::DataCallback([[maybe_unused]] cubeb_stream* stream, void* const std::size_t num_channels = impl->GetNumChannels(); const std::size_t samples_to_write = num_channels * num_frames; - std::size_t samples_written; - - /* - if (Settings::values.enable_audio_stretching.GetValue()) { - const std::vector<s16> in{impl->queue.Pop()}; - const std::size_t num_in{in.size() / num_channels}; - s16* const out{reinterpret_cast<s16*>(buffer)}; - const std::size_t out_frames = - impl->time_stretch.Process(in.data(), num_in, out, num_frames); - samples_written = out_frames * num_channels; - - if (impl->should_flush) { - impl->time_stretch.Flush(); - impl->should_flush = false; - } - } else { - samples_written = impl->queue.Pop(buffer, samples_to_write); - }*/ - samples_written = impl->queue.Pop(buffer, samples_to_write); + const std::size_t samples_written = impl->queue.Pop(buffer, samples_to_write); if (samples_written >= num_channels) { std::memcpy(&impl->last_frame[0], buffer + (samples_written - num_channels) * sizeof(s16), |