summaryrefslogtreecommitdiffstats
path: root/src/audio_core/cubeb_sink.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-04 06:03:12 +0200
committerbunnei <bunneidev@gmail.com>2018-08-05 00:22:58 +0200
commit1dee8ceda1e5ecd5ebaee464b1450f323e82305f (patch)
tree97275d9a1c055d067053831f50a09ab9628ebf8e /src/audio_core/cubeb_sink.cpp
parentaudio_core: Port codec code from Citra for ADPCM decoding. (diff)
downloadyuzu-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.cpp11
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));
}
}