[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.49,1.50 mixer.cpp,1.146,1.147 mixer.h,1.67,1.68
Max Horn
fingolfin at users.sourceforge.net
Wed Dec 24 09:43:04 CET 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv8868/sound
Modified Files:
audiostream.cpp mixer.cpp mixer.h
Log Message:
o Added SoundMixer::isReady()
o Removed SoundMixer::bindToSystem()
o In scumm, replaced _silentMixer, _silentDigitalImuse and _noDigitalSamples by SoundMixer::isReady()
Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- audiostream.cpp 21 Dec 2003 00:26:36 -0000 1.49
+++ audiostream.cpp 24 Dec 2003 17:42:22 -0000 1.50
@@ -218,7 +218,7 @@
else if (is16Bit || stereo)
assert((len & 1) == 0);
- // Verify the stream has not been finalized (by a call to finish()) yet
+ // Verify that the stream has not yet been finalized (by a call to finish())
assert(!_finalized);
if (_end + len > _bufferEnd) {
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- mixer.cpp 24 Dec 2003 00:25:17 -0000 1.146
+++ mixer.cpp 24 Dec 2003 17:42:22 -0000 1.147
@@ -101,22 +101,27 @@
SoundMixer::SoundMixer() {
- _syst = 0;
- _mutex = 0;
+ _syst = OSystem::instance();
+ _mutex = _syst->create_mutex();
_premixParam = 0;
_premixProc = 0;
int i = 0;
- _outputRate = 0;
+ _outputRate = (uint) _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
+
+ if (_outputRate == 0)
+ error("OSystem returned invalid sample rate");
_globalVolume = 0;
_musicVolume = 0;
_paused = false;
-
+
for (i = 0; i != NUM_CHANNELS; i++)
_channels[i] = 0;
+
+ _mixerReady = _syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT);
}
SoundMixer::~SoundMixer() {
@@ -125,17 +130,6 @@
delete _channels[i];
}
_syst->delete_mutex(_mutex);
-}
-
-bool SoundMixer::bindToSystem(OSystem *syst) {
- _syst = syst;
- _mutex = _syst->create_mutex();
- _outputRate = (uint) syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
-
- if (_outputRate == 0)
- error("OSystem returned invalid sample rate");
-
- return syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT);
}
void SoundMixer::setupPremix(PremixProc *proc, void *param) {
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- mixer.h 24 Dec 2003 00:25:17 -0000 1.67
+++ mixer.h 24 Dec 2003 17:42:22 -0000 1.68
@@ -82,17 +82,22 @@
int _musicVolume;
bool _paused;
-
+
Channel *_channels[NUM_CHANNELS];
+ bool _mixerReady;
+
public:
SoundMixer();
~SoundMixer();
- /** bind to the OSystem object => mixer will be
- * invoked automatically when samples need
- * to be generated */
- bool bindToSystem(OSystem *syst);
+ /**
+ * Is the mixer ready and setup? This may not be the case on systems which
+ * don't support digital sound output. In that case, the mixer proc may
+ * never be called. That in turn can cause breakage in games which use the
+ * premix callback for syncing. In particular, the Adlib MIDI emulation...
+ */
+ bool isReady() const { return _mixerReady; };
/**
* Set the premix procedure. This is mainly used for the adlib music, but
More information about the Scummvm-git-logs
mailing list