mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 07:35:45 +00:00
sink: Change EnqueueSamples to take a pointer to a buffer instead of a std::vector
This commit is contained in:
parent
12f38bf3fe
commit
559ca8ae8a
5 changed files with 9 additions and 9 deletions
|
@ -71,14 +71,12 @@ unsigned int SDL2Sink::GetNativeSampleRate() const {
|
|||
return impl->sample_rate;
|
||||
}
|
||||
|
||||
void SDL2Sink::EnqueueSamples(const std::vector<s16>& samples) {
|
||||
void SDL2Sink::EnqueueSamples(const s16* samples, size_t sample_count) {
|
||||
if (impl->audio_device_id <= 0)
|
||||
return;
|
||||
|
||||
ASSERT_MSG(samples.size() % 2 == 0, "Samples must be in interleaved stereo PCM16 format (size must be a multiple of two)");
|
||||
|
||||
SDL_LockAudioDevice(impl->audio_device_id);
|
||||
impl->queue.emplace_back(samples);
|
||||
impl->queue.emplace_back(samples, samples + sample_count * 2);
|
||||
SDL_UnlockAudioDevice(impl->audio_device_id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue