From 53843ba872e3e76c05e8bf9a86d1876914e1ba89 Mon Sep 17 00:00:00 2001 From: Ellen Poe Date: Fri, 27 Aug 2021 10:27:58 -0700 Subject: Require AudioStream::mix to return the number of frames successfully mixed --- servers/audio/effects/audio_stream_generator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'servers/audio/effects/audio_stream_generator.cpp') 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() { -- cgit v1.2.3