aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-12-24 17:42:22 +0000
committerMax Horn2003-12-24 17:42:22 +0000
commit859a9c01290dc6022f99c7fd99ff91d62a3153dc (patch)
tree34a40bd53ce6c75e3685ec837c4da4c0a38d01f7 /sound
parent5665d137f6bae488ac19539acdcfe441f514a9d6 (diff)
downloadscummvm-rg350-859a9c01290dc6022f99c7fd99ff91d62a3153dc.tar.gz
scummvm-rg350-859a9c01290dc6022f99c7fd99ff91d62a3153dc.tar.bz2
scummvm-rg350-859a9c01290dc6022f99c7fd99ff91d62a3153dc.zip
o Added SoundMixer::isReady()
o Removed SoundMixer::bindToSystem() o In scumm, replaced _silentMixer, _silentDigitalImuse and _noDigitalSamples by SoundMixer::isReady() svn-id: r11893
Diffstat (limited to 'sound')
-rw-r--r--sound/audiostream.cpp2
-rw-r--r--sound/mixer.cpp24
-rw-r--r--sound/mixer.h15
3 files changed, 20 insertions, 21 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index 8ac57481ee..f3bf3552f9 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -218,7 +218,7 @@ void WrappedMemoryStream<stereo, is16Bit, isUnsigned>::append(const byte *data,
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) {
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 1d0e13a0c1..1549424720 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -101,22 +101,27 @@ public:
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() {
@@ -127,17 +132,6 @@ SoundMixer::~SoundMixer() {
_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) {
Common::StackLock lock(_mutex);
_premixParam = param;
diff --git a/sound/mixer.h b/sound/mixer.h
index d1bd379408..9001245e0e 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -82,17 +82,22 @@ private:
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