aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Milburn2011-05-16 15:09:01 +0200
committerAlyssa Milburn2011-05-16 15:09:05 +0200
commited1739f4197b98043bd6ae1a2a181e3f410279d7 (patch)
treeaca9a56ccf6cf89318da8f1ab7aff134d9325f0c
parentffd0b20af745286c3bb2107b5b6c12a355dc4e89 (diff)
downloadscummvm-rg350-ed1739f4197b98043bd6ae1a2a181e3f410279d7.tar.gz
scummvm-rg350-ed1739f4197b98043bd6ae1a2a181e3f410279d7.tar.bz2
scummvm-rg350-ed1739f4197b98043bd6ae1a2a181e3f410279d7.zip
AUDIO: Clarify required parameters for mixCallback.
Also, add an assert() to make invalid lengths obvious.
-rw-r--r--audio/mixer.cpp2
-rw-r--r--audio/mixer_intern.h2
2 files changed, 4 insertions, 0 deletions
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);