diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-04 06:03:12 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-08-05 00:22:58 +0200 |
commit | 1dee8ceda1e5ecd5ebaee464b1450f323e82305f (patch) | |
tree | 97275d9a1c055d067053831f50a09ab9628ebf8e /src/audio_core/cubeb_sink.cpp | |
parent | audio_core: Port codec code from Citra for ADPCM decoding. (diff) | |
download | yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar.gz yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar.bz2 yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar.lz yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar.xz yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.tar.zst yuzu-1dee8ceda1e5ecd5ebaee464b1450f323e82305f.zip |
Diffstat (limited to 'src/audio_core/cubeb_sink.cpp')
-rw-r--r-- | src/audio_core/cubeb_sink.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 0b0e9a053..1501ef1f4 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -61,25 +61,24 @@ public: cubeb_stream_destroy(stream_backend); } - void EnqueueSamples(u32 num_channels, const s16* samples, size_t sample_count) override { + void EnqueueSamples(u32 num_channels, const std::vector<s16>& samples) override { if (!ctx) { return; } - queue.reserve(queue.size() + sample_count * GetNumChannels()); + queue.reserve(queue.size() + samples.size() * GetNumChannels()); if (is_6_channel) { // Downsample 6 channels to 2 - const size_t sample_count_copy_size = sample_count * num_channels * 2; + const size_t sample_count_copy_size = samples.size() * 2; queue.reserve(sample_count_copy_size); - for (size_t i = 0; i < sample_count * num_channels; i += num_channels) { + for (size_t i = 0; i < samples.size(); i += num_channels) { queue.push_back(samples[i]); queue.push_back(samples[i + 1]); } } else { // Copy as-is - std::copy(samples, samples + sample_count * GetNumChannels(), - std::back_inserter(queue)); + std::copy(samples.begin(), samples.end(), std::back_inserter(queue)); } } |