aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp16
-rw-r--r--sound/mixer.h9
-rw-r--r--sound/mods/protracker.cpp3
-rw-r--r--sound/softsynth/mt32.cpp4
4 files changed, 17 insertions, 15 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 5e26c04f66..ad203ece5b 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -119,23 +119,20 @@ Mixer::Mixer() {
for (i = 0; i != NUM_CHANNELS; i++)
_channels[i] = 0;
- _mixerReady = _syst->setSoundCallback(mixCallback, this);
- _outputRate = (uint)_syst->getOutputSampleRate();
-
- if (_outputRate == 0)
- error("OSystem returned invalid sample rate");
-
- debug(1, "Output sample rate: %d Hz", _outputRate);
+ _mixerReady = false;
}
Mixer::~Mixer() {
- _syst->clearSoundCallback();
stopAll(true);
delete _premixChannel;
_premixChannel = 0;
}
+uint Mixer::getOutputRate() const {
+ return (uint)_syst->getOutputSampleRate();
+}
+
bool Mixer::isPaused() {
return _paused;
}
@@ -238,6 +235,9 @@ void Mixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *in
void Mixer::mix(int16 *buf, uint len) {
Common::StackLock lock(_mutex);
+
+ // Since the mixer callback has been called, the mixer must be ready...
+ _mixerReady = true;
// zero the buf
memset(buf, 0, 2 * len * sizeof(int16));
diff --git a/sound/mixer.h b/sound/mixer.h
index 34fd54c0ed..b799345558 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -94,8 +94,6 @@ private:
Channel *_premixChannel;
- uint _outputRate;
-
int _volumeForSoundType[4];
bool _paused;
@@ -292,9 +290,9 @@ public:
*
* @return the output sample rate in Hz
*/
- uint getOutputRate() const { return _outputRate; }
+ uint getOutputRate() const;
-private:
+protected:
void insertChannel(SoundHandle *handle, Channel *chan);
/**
@@ -302,6 +300,9 @@ private:
*/
void mix(int16 * buf, uint len);
+ // FIXME: temporary "public" to allow access to mixCallback
+ // from within OSystem::makeMixer()
+public:
/**
* The mixer callback function, passed on to OSystem::setSoundCallback().
* This simply calls the mix() method.
diff --git a/sound/mods/protracker.cpp b/sound/mods/protracker.cpp
index 591c0276ac..74733d5c15 100644
--- a/sound/mods/protracker.cpp
+++ b/sound/mods/protracker.cpp
@@ -42,7 +42,8 @@ void ProtrackerPlayer::init(OSystem *system) {
// subclass and hook that with the mixer. See also the
// code used by other softsynths (sound/softsynth/emumidi.h).
- _system->setSoundCallback(&audioCallback, this);
+// _system->setSoundCallback(&audioCallback, this);
+error("ProtrackerPlayer::init -- setSoundCallback is no more");
}
void ProtrackerPlayer::start() {
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 70ce6bcf8b..422231828d 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -424,10 +424,10 @@ void MidiDriver_ThreadedMT32::close() {
void MidiDriver_ThreadedMT32::setTimerCallback(void *timer_param, TimerManager::TimerProc timer_proc) {
if (!_timer_proc || !timer_proc) {
if (_timer_proc)
- g_timer->removeTimerProc(_timer_proc);
+ _vm->_timer->removeTimerProc(_timer_proc);
_timer_proc = timer_proc;
if (timer_proc)
- g_timer->installTimerProc(timer_proc, getBaseTempo(), timer_param);
+ _vm->_timer->installTimerProc(timer_proc, getBaseTempo(), timer_param);
}
}