diff options
author | Ellen Poe <ellenhp@google.com> | 2021-08-27 10:27:58 -0700 |
---|---|---|
committer | Ellen Poe <ellenhp@google.com> | 2021-08-27 10:27:58 -0700 |
commit | 53843ba872e3e76c05e8bf9a86d1876914e1ba89 (patch) | |
tree | 890e4ddaa3dd8c4e3124c3d140f6b5b2a4e88adc /servers/audio/effects/audio_stream_generator.cpp | |
parent | 460e0ce314dbc6d14945cdc7d44e964d4e5c16ec (diff) |
Require AudioStream::mix to return the number of frames successfully mixed
Diffstat (limited to 'servers/audio/effects/audio_stream_generator.cpp')
-rw-r--r-- | servers/audio/effects/audio_stream_generator.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index bced2997ce..edb5c6d2dd 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -138,7 +138,7 @@ void AudioStreamGeneratorPlayback::clear_buffer() { mixed = 0; } -void AudioStreamGeneratorPlayback::_mix_internal(AudioFrame *p_buffer, int p_frames) { +int AudioStreamGeneratorPlayback::_mix_internal(AudioFrame *p_buffer, int p_frames) { int read_amount = buffer.data_left(); if (p_frames < read_amount) { read_amount = p_frames; @@ -156,6 +156,7 @@ void AudioStreamGeneratorPlayback::_mix_internal(AudioFrame *p_buffer, int p_fra } mixed += p_frames / generator->get_mix_rate(); + return read_amount < p_frames ? read_amount : p_frames; } float AudioStreamGeneratorPlayback::get_stream_sampling_rate() { |