[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.126,1.127 mixer.h,1.53,1.54
Max Horn
fingolfin at users.sourceforge.net
Thu Sep 18 09:03:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv24117/sound
Modified Files:
mixer.cpp mixer.h
Log Message:
changed & documented the premixer semantics
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- mixer.cpp 16 Sep 2003 07:06:17 -0000 1.126
+++ mixer.cpp 18 Sep 2003 16:01:33 -0000 1.127
@@ -160,7 +160,7 @@
return syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT);
}
-void SoundMixer::setupPremix(void *param, PremixProc *proc) {
+void SoundMixer::setupPremix(PremixProc *proc, void *param) {
StackLock lock(_mutex);
_premixParam = param;
_premixProc = proc;
@@ -279,12 +279,7 @@
StackLock lock(_mutex);
if (_premixProc && !_paused) {
- int i;
_premixProc(_premixParam, buf, len);
- // Convert mono data from the premix proc to stereo
- for (i = (len - 1); i >= 0; i--) {
- buf[2 * i] = buf[2 * i + 1] = buf[i];
- }
} else {
// zero the buf out
memset(buf, 0, 2 * len * sizeof(int16));
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- mixer.h 7 Sep 2003 20:23:38 -0000 1.53
+++ mixer.h 18 Sep 2003 16:01:33 -0000 1.54
@@ -83,8 +83,14 @@
* to be generated */
bool bindToSystem(OSystem *syst);
- /** Premix procedure, useful when using fmopl adlib */
- void setupPremix(void * param, PremixProc * proc);
+ /**
+ * Set the premix procedure. This is mainly used for the adlib music, but is not limited
+ * to it. The premix proc is invoked by the mixer whenever it needs to generate any
+ * data, before any other mixing takes place. The premixer than has a chanve to fill
+ * the mix buffer with data (usually music samples). It should generate the specified
+ * number of 16bit stereo samples (i.e. len * 4 bytes).
+ */
+ void setupPremix(PremixProc *proc, void *param);
// start playing a raw sound
int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
More information about the Scummvm-git-logs
mailing list