From ed1739f4197b98043bd6ae1a2a181e3f410279d7 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Mon, 16 May 2011 15:09:01 +0200 Subject: AUDIO: Clarify required parameters for mixCallback. Also, add an assert() to make invalid lengths obvious. --- audio/mixer.cpp | 2 ++ audio/mixer_intern.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 3482bd30c9..fb4fffb8d8 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -257,6 +257,8 @@ int MixerImpl::mixCallback(byte *samples, uint len) { Common::StackLock lock(_mutex); int16 *buf = (int16 *)samples; + // we store stereo, 16-bit samples + assert(len % 4 == 0); len >>= 2; // Since the mixer callback has been called, the mixer must be ready... diff --git a/audio/mixer_intern.h b/audio/mixer_intern.h index 05e519c64c..a04eb55c5b 100644 --- a/audio/mixer_intern.h +++ b/audio/mixer_intern.h @@ -126,6 +126,8 @@ public: * the backend (e.g. from an audio mixing thread). All the actual mixing * work is done from here. * + * @param samples Sample buffer, in which stereo 16-bit samples will be stored. + * @param len Length of the provided buffer to fill (in bytes, should be divisible by 4). * @return number of sample pairs processed (which can still be silence!) */ int mixCallback(byte *samples, uint len); -- cgit v1.2.3