aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/saga/interface.cpp10
-rw-r--r--engines/saga/music.cpp6
-rw-r--r--engines/saga/puzzle.cpp26
-rw-r--r--engines/scumm/dialogs.cpp2
-rw-r--r--engines/scumm/he/sound_he.cpp36
-rw-r--r--engines/scumm/he/sound_he.h2
-rw-r--r--engines/scumm/imuse_digi/dimuse.cpp20
-rw-r--r--engines/scumm/imuse_digi/dimuse.h3
-rw-r--r--engines/scumm/imuse_digi/dimuse_script.cpp8
-rw-r--r--engines/scumm/imuse_digi/dimuse_track.cpp4
-rw-r--r--engines/scumm/player_mod.cpp4
-rw-r--r--engines/scumm/player_mod.h2
-rw-r--r--engines/scumm/player_nes.cpp4
-rw-r--r--engines/scumm/player_nes.h2
-rw-r--r--engines/scumm/player_v1.cpp3
-rw-r--r--engines/scumm/player_v1.h2
-rw-r--r--engines/scumm/player_v2.cpp4
-rw-r--r--engines/scumm/player_v2.h2
-rw-r--r--engines/scumm/player_v2a.cpp4
-rw-r--r--engines/scumm/player_v2a.h2
-rw-r--r--engines/scumm/player_v3a.cpp4
-rw-r--r--engines/scumm/player_v3a.h2
-rw-r--r--engines/scumm/scumm.cpp22
-rw-r--r--engines/scumm/sound.cpp35
-rw-r--r--engines/scumm/sound.h7
-rw-r--r--engines/sword2/controls.cpp2
-rw-r--r--sound/audiocd.cpp14
-rw-r--r--sound/audiocd.h6
-rw-r--r--sound/mididrv.cpp9
-rw-r--r--sound/mixer.h4
-rw-r--r--sound/mpu401.cpp7
-rw-r--r--sound/softsynth/mt32.cpp2
32 files changed, 136 insertions, 124 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index e0d905a015..0ff1396a49 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -546,8 +546,8 @@ void Interface::textInputRepeatCallback(void *refCon) {
void Interface::textInputStartRepeat(uint16 ascii) {
if (!_textInputRepeatPhase) {
_textInputRepeatPhase = 1;
- Common::g_timer->removeTimerProc(&textInputRepeatCallback);
- Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this);
+ _vm->_timer->removeTimerProc(&textInputRepeatCallback);
+ _vm->_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this);
}
_textInputRepeatChar = ascii;
@@ -556,8 +556,8 @@ void Interface::textInputStartRepeat(uint16 ascii) {
void Interface::textInputRepeat() {
if (_textInputRepeatPhase == 1) {
_textInputRepeatPhase = 2;
- Common::g_timer->removeTimerProc(&textInputRepeatCallback);
- Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this);
+ _vm->_timer->removeTimerProc(&textInputRepeatCallback);
+ _vm->_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this);
} else if (_textInputRepeatPhase == 2) {
processAscii(_textInputRepeatChar, true);
}
@@ -565,7 +565,7 @@ void Interface::textInputRepeat() {
void Interface::processKeyUp(uint16 ascii) {
if (_textInputRepeatPhase) {
- Common::g_timer->removeTimerProc(&textInputRepeatCallback);
+ _vm->_timer->removeTimerProc(&textInputRepeatCallback);
_textInputRepeatPhase = 0;
}
}
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index bacf726626..f4af44f826 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -346,7 +346,7 @@ void Music::musicVolumeGauge() {
_player->setVolume(volume);
if (_currentVolumePercent == 100) {
- Common::g_timer->removeTimerProc(&musicVolumeGaugeCallback);
+ _vm->_timer->removeTimerProc(&musicVolumeGaugeCallback);
_currentVolume = _targetVolume;
}
}
@@ -361,12 +361,12 @@ void Music::setVolume(int volume, int time) {
if (time == 1) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
_player->setVolume(volume);
- Common::g_timer->removeTimerProc(&musicVolumeGaugeCallback);
+ _vm->_timer->removeTimerProc(&musicVolumeGaugeCallback);
_currentVolume = volume;
return;
}
- Common::g_timer->installTimerProc(&musicVolumeGaugeCallback, time * 100L, this);
+ _vm->_timer->installTimerProc(&musicVolumeGaugeCallback, time * 100L, this);
}
bool Music::isPlaying() {
diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp
index 54ebf0bc3f..de519e4062 100644
--- a/engines/saga/puzzle.cpp
+++ b/engines/saga/puzzle.cpp
@@ -119,7 +119,7 @@ void Puzzle::initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY,
void Puzzle::execute(void) {
_active = true;
- Common::g_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
initPieces();
@@ -134,7 +134,7 @@ void Puzzle::execute(void) {
void Puzzle::exitPuzzle(void) {
_active = false;
- Common::g_timer->removeTimerProc(&hintTimerCallback);
+ _vm->_timer->removeTimerProc(&hintTimerCallback);
_vm->_scene->changeScene(ITE_SCENE_LODGE, 0, kTransitionNoFade);
_vm->_interface->setMode(kPanelMain);
@@ -383,17 +383,17 @@ void Puzzle::solicitHint(void) {
_vm->_actor->setSpeechColor(1, kITEColorBlack);
- Common::g_timer->removeTimerProc(&hintTimerCallback);
+ _vm->_timer->removeTimerProc(&hintTimerCallback);
switch (_hintRqState) {
case kRQSpeaking:
if (_vm->_actor->isSpeaking()) {
- Common::g_timer->installTimerProc(&hintTimerCallback, 50000, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
break;
}
_hintRqState = _hintNextRqState;
- Common::g_timer->installTimerProc(&hintTimerCallback, 333333, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, 333333, this);
break;
case kRQNoHint:
@@ -416,11 +416,11 @@ void Puzzle::solicitHint(void) {
// Roll to see if Sakka scolds
if (_vm->_rnd.getRandomNumber(1)) {
_hintRqState = kRQSakkaDenies;
- Common::g_timer->installTimerProc(&hintTimerCallback, 200000, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, 200000, this);
} else {
_hintRqState = kRQSpeaking;
_hintNextRqState = kRQHintRequested;
- Common::g_timer->installTimerProc(&hintTimerCallback, 50000, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
}
break;
@@ -433,7 +433,7 @@ void Puzzle::solicitHint(void) {
_hintRqState = kRQSpeaking;
_hintNextRqState = kRQHintRequestedStage2;
- Common::g_timer->installTimerProc(&hintTimerCallback, 50000, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
_vm->_interface->converseClear();
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 1, 0, 0 );
@@ -460,7 +460,7 @@ void Puzzle::solicitHint(void) {
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
_vm->_interface->converseDisplayText();
- Common::g_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
_hintRqState = kRQSkipEverything;
break;
@@ -483,8 +483,8 @@ void Puzzle::handleReply(int reply) {
case 2: // Decline the hint
_vm->_actor->abortSpeech();
_hintRqState = kRQNoHint;
- Common::g_timer->removeTimerProc(&hintTimerCallback);
- Common::g_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this);
+ _vm->_timer->removeTimerProc(&hintTimerCallback);
+ _vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this);
clearHint();
break;
}
@@ -546,8 +546,8 @@ void Puzzle::giveHint(void) {
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
_vm->_interface->converseDisplayText();
- Common::g_timer->removeTimerProc(&hintTimerCallback);
- Common::g_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
+ _vm->_timer->removeTimerProc(&hintTimerCallback);
+ _vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
}
void Puzzle::clearHint(void) {
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 2938d73bc0..4c9ad26789 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -326,7 +326,7 @@ void SaveLoadChooser::reflowLayout() {
int thumbY = g_gui.evaluator()->getVar("scummsaveload_thumbnail.y");
int hPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.hPad");
int vPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.vPad");
- int thumbH = ((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1);
+ int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1);
_container->resize(thumbX - hPad, thumbY - vPad, kThumbnailWidth + hPad * 2, thumbH + vPad * 2 + kLineHeight * 4);
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index b83fde2838..931ef12c95 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -46,9 +46,9 @@
namespace Scumm {
-SoundHE::SoundHE(ScummEngine *parent)
+SoundHE::SoundHE(ScummEngine *parent, Audio::Mixer *mixer)
:
- Sound(parent),
+ Sound(parent, mixer),
_vm((ScummEngine_v60he *)parent),
_overrideFreq(0),
_heMusic(0),
@@ -114,7 +114,7 @@ void SoundHE::processSoundQueues() {
int SoundHE::isSoundRunning(int sound) const {
if (_vm->_game.heversion >= 70) {
if (sound >= 10000) {
- return _vm->_mixer->getSoundID(_heSoundChannels[sound - 10000]);
+ return _mixer->getSoundID(_heSoundChannels[sound - 10000]);
}
} else if (_vm->_game.heversion >= 60) {
if (sound == -2) {
@@ -124,7 +124,7 @@ int SoundHE::isSoundRunning(int sound) const {
}
}
- if (_vm->_mixer->isSoundIDActive(sound))
+ if (_mixer->isSoundIDActive(sound))
return sound;
if (isSoundInQueue(sound))
@@ -189,7 +189,7 @@ void SoundHE::stopSoundChannel(int chan) {
_vm->_talkDelay = 0;
}
- _vm->_mixer->stopHandle(_heSoundChannels[chan]);
+ _mixer->stopHandle(_heSoundChannels[chan]);
_heChannel[chan].sound = 0;
_heChannel[chan].priority = 0;
@@ -219,7 +219,7 @@ int SoundHE::findFreeSoundChannel() {
if (min < 8) {
for (chan = min; chan < ARRAYSIZE(_heChannel); chan++) {
- if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[chan]) == 0)
+ if (_mixer->isSoundHandleActive(_heSoundChannels[chan]) == 0)
return chan;
}
} else {
@@ -236,7 +236,7 @@ int SoundHE::isSoundCodeUsed(int sound) {
chan = i;
}
- if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
+ if (_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
return _heChannel[chan].sbngBlock;
} else {
return 0;
@@ -250,7 +250,7 @@ int SoundHE::getSoundPos(int sound) {
chan = i;
}
- if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
+ if (_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
int time = _vm->getHETimer(chan + 4) * 11025 / 1000;
return time;
} else {
@@ -271,7 +271,7 @@ int SoundHE::getSoundVar(int sound, int var) {
chan = i;
}
- if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
+ if (_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) {
debug(5, "getSoundVar: sound %d var %d result %d", sound, var, _heChannel[chan].soundVars[var]);
return _heChannel[chan].soundVars[var];
} else {
@@ -528,14 +528,14 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
musicFile.seek(music_offs, SEEK_SET);
- _vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
+ _mixer->stopHandle(_heSoundChannels[heChannel]);
spoolPtr = _vm->_res->createResource(rtSpoolBuffer, heChannel, size);
assert(spoolPtr);
musicFile.read(spoolPtr, size);
musicFile.close();
if (_vm->_game.heversion == 70) {
- _vm->_mixer->playRaw(&_heSoundChannels[heChannel], spoolPtr, size, 11025, flags, soundID, 255, 0, 0,0, type);
+ _mixer->playRaw(&_heSoundChannels[heChannel], spoolPtr, size, 11025, flags, soundID, 255, 0, 0,0, type);
return;
}
}
@@ -585,8 +585,8 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
flags |= Audio::Mixer::FLAG_LOOP;
}
- _vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
- _vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID, 255, 0, 0,0, type);
+ _mixer->stopHandle(_heSoundChannels[heChannel]);
+ _mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID, 255, 0, 0,0, type);
}
// Support for sound in Humongous Entertainment games
else if (READ_BE_UINT32(ptr) == MKID_BE('DIGI') || READ_BE_UINT32(ptr) == MKID_BE('TALK')) {
@@ -598,7 +598,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
// Skip DIGI/TALK (8) and HSHD (24) blocks
ptr += 32;
- if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[heChannel])) {
+ if (_mixer->isSoundHandleActive(_heSoundChannels[heChannel])) {
int curSnd = _heChannel[heChannel].sound;
if (curSnd == 1 && soundID != 1)
return;
@@ -641,8 +641,8 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
_heChannel[heChannel].timer = size * 1000 / rate;
}
- _vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
- _vm->_mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID, 255, 0, 0,0, type);
+ _mixer->stopHandle(_heSoundChannels[heChannel]);
+ _mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID, 255, 0, 0,0, type);
}
// Support for PCM music in 3DO versions of Humongous Entertainment games
@@ -658,9 +658,9 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
flags = Audio::Mixer::FLAG_AUTOFREE;
- _vm->_mixer->stopID(_currentMusic);
+ _mixer->stopID(_currentMusic);
_currentMusic = soundID;
- _vm->_mixer->playRaw(NULL, ptr + 8, size, rate, flags, soundID, 255, 0, 0,0, Audio::Mixer::kMusicSoundType);
+ _mixer->playRaw(NULL, ptr + 8, size, rate, flags, soundID, 255, 0, 0,0, Audio::Mixer::kMusicSoundType);
}
else if (READ_BE_UINT32(ptr) == MKID_BE('MIDI')) {
if (_vm->_imuse) {
diff --git a/engines/scumm/he/sound_he.h b/engines/scumm/he/sound_he.h
index c0a26c7446..36f0714048 100644
--- a/engines/scumm/he/sound_he.h
+++ b/engines/scumm/he/sound_he.h
@@ -56,7 +56,7 @@ public: // Used by createSound()
} _heChannel[8];
public:
- SoundHE(ScummEngine *parent);
+ SoundHE(ScummEngine *parent, Audio::Mixer *mixer);
~SoundHE();
virtual void addSoundToQueue(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0);
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp
index 537faad92a..8d1dab64a7 100644
--- a/engines/scumm/imuse_digi/dimuse.cpp
+++ b/engines/scumm/imuse_digi/dimuse.cpp
@@ -44,8 +44,8 @@ void IMuseDigital::timer_handler(void *refCon) {
imuseDigital->callback();
}
-IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, int fps)
- : _vm(scumm) {
+IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, int fps)
+ : _vm(scumm), _mixer(mixer) {
_pause = false;
_sound = new ImuseDigiSndMgr(_vm);
assert(_sound);
@@ -200,7 +200,7 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
if (track->volGroupId == 3)
type = Audio::Mixer::kMusicSoundType;
- _vm->_mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false);
+ _mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false);
}
}
}
@@ -318,9 +318,9 @@ void IMuseDigital::callback() {
if (result > mixer_size)
result = mixer_size;
- if (_vm->_mixer->isReady()) {
- _vm->_mixer->setChannelVolume(track->handle, vol);
- _vm->_mixer->setChannelBalance(track->handle, pan);
+ if (_mixer->isReady()) {
+ _mixer->setChannelVolume(track->handle, vol);
+ _mixer->setChannelBalance(track->handle, pan);
track->stream->append(data, result);
track->regionOffset += result;
}
@@ -335,13 +335,13 @@ void IMuseDigital::callback() {
assert(mixer_size >= 0);
} while (mixer_size != 0);
} else if (track->stream2) {
- if (_vm->_mixer->isReady()) {
+ if (_mixer->isReady()) {
if (!track->started) {
track->started = true;
- _vm->_mixer->playInputStream(type, &track->handle, track->stream2, -1, vol, pan, false);
+ _mixer->playInputStream(type, &track->handle, track->stream2, -1, vol, pan, false);
} else {
- _vm->_mixer->setChannelVolume(track->handle, vol);
- _vm->_mixer->setChannelBalance(track->handle, pan);
+ _mixer->setChannelVolume(track->handle, vol);
+ _mixer->setChannelBalance(track->handle, pan);
}
}
}
diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h
index 0a3ed5b2f5..fe8120c758 100644
--- a/engines/scumm/imuse_digi/dimuse.h
+++ b/engines/scumm/imuse_digi/dimuse.h
@@ -90,6 +90,7 @@ private:
Common::Mutex _mutex;
ScummEngine_v7 *_vm;
+ Audio::Mixer *_mixer;
ImuseDigiSndMgr *_sound;
char *_audioNames;
@@ -131,7 +132,7 @@ private:
void playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence);
public:
- IMuseDigital(ScummEngine_v7 *scumm, int fps);
+ IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, int fps);
virtual ~IMuseDigital();
void setAudioNames(int32 num, char *names);
diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp
index b55855262d..0c131775ea 100644
--- a/engines/scumm/imuse_digi/dimuse_script.cpp
+++ b/engines/scumm/imuse_digi/dimuse_script.cpp
@@ -172,9 +172,9 @@ void IMuseDigital::flushTracks() {
track->stream->finish();
}
if (track->stream->endOfStream()
- || _vm->_mixer->isPaused() // hack for paused Mixer
+ || _mixer->isPaused() // hack for paused Mixer
|| _vm->_insaneRunning) { // INSANE hack for sync timer mode
- _vm->_mixer->stopHandle(track->handle);
+ _mixer->stopHandle(track->handle);
delete track->stream;
track->stream = NULL;
_sound->closeSound(track->soundHandle);
@@ -182,7 +182,7 @@ void IMuseDigital::flushTracks() {
track->used = false;
}
} else if (track->stream2) {
- _vm->_mixer->stopHandle(track->handle);
+ _mixer->stopHandle(track->handle);
delete track->stream2;
track->stream2 = NULL;
track->used = false;
@@ -285,7 +285,7 @@ int IMuseDigital::getSoundStatus(int sound) const {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
Track *track = _track[l];
if (track->soundId == sound) {
- if ((track->stream2 && _vm->_mixer->isSoundHandleActive(track->handle)) ||
+ if ((track->stream2 && _mixer->isSoundHandleActive(track->handle)) ||
(track->stream && track->used && !track->readyToRemove)) {
return 1;
}
diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp
index eb17887a0b..37ae22f47f 100644
--- a/engines/scumm/imuse_digi/dimuse_track.cpp
+++ b/engines/scumm/imuse_digi/dimuse_track.cpp
@@ -179,7 +179,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
int32 streamBufferSize = track->iteration;
track->stream2 = NULL;
track->stream = Audio::makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize);
- _vm->_mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false);
+ _mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false);
track->started = true;
}
@@ -358,7 +358,7 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel
// setup 1 second stream wrapped buffer
int32 streamBufferSize = fadeTrack->iteration;
fadeTrack->stream = Audio::makeAppendableAudioStream(_sound->getFreq(fadeTrack->soundHandle), fadeTrack->mixerFlags, streamBufferSize);
- _vm->_mixer->playInputStream(type, &fadeTrack->handle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false);
+ _mixer->playInputStream(type, &fadeTrack->handle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false);
fadeTrack->started = true;
fadeTrack->used = true;
diff --git a/engines/scumm/player_mod.cpp b/engines/scumm/player_mod.cpp
index 9a22aaa1e0..8ce3c80132 100644
--- a/engines/scumm/player_mod.cpp
+++ b/engines/scumm/player_mod.cpp
@@ -28,9 +28,9 @@
namespace Scumm {
-Player_MOD::Player_MOD(ScummEngine *scumm) {
+Player_MOD::Player_MOD(Audio::Mixer *mixer) {
int i;
- _mixer = scumm->_mixer;
+ _mixer = mixer;
_samplerate = _mixer->getOutputRate();
_mixamt = 0;
_mixpos = 0;
diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h
index 5caa27e23a..155cb154d1 100644
--- a/engines/scumm/player_mod.h
+++ b/engines/scumm/player_mod.h
@@ -38,7 +38,7 @@ namespace Scumm {
*/
class Player_MOD : public Audio::AudioStream {
public:
- Player_MOD(ScummEngine *scumm);
+ Player_MOD(Audio::Mixer *mixer);
virtual ~Player_MOD();
virtual void setMusicVolume(int vol);
diff --git a/engines/scumm/player_nes.cpp b/engines/scumm/player_nes.cpp
index 0a63cf153c..a44498edc2 100644
--- a/engines/scumm/player_nes.cpp
+++ b/engines/scumm/player_nes.cpp
@@ -605,10 +605,10 @@ int16 APU_GetSample(void) {
}
-Player_NES::Player_NES(ScummEngine *scumm) {
+Player_NES::Player_NES(ScummEngine *scumm, Audio::Mixer *mixer) {
int i;
_vm = scumm;
- _mixer = scumm->_mixer;
+ _mixer = mixer;
APUe::APU.SampleRate = _sample_rate = _mixer->getOutputRate();
_samples_per_frame = _sample_rate / 60;
diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h
index c7788bb6b1..9739766913 100644
--- a/engines/scumm/player_nes.h
+++ b/engines/scumm/player_nes.h
@@ -45,7 +45,7 @@ static const int NUMCHANS = 4;
*/
class Player_NES : public Audio::AudioStream, public MusicEngine {
public:
- Player_NES(ScummEngine *scumm);
+ Player_NES(ScummEngine *scumm, Audio::Mixer *mixer);
virtual ~Player_NES();
virtual void setMusicVolume(int vol);
diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/player_v1.cpp
index d752fbde2d..b0b47b7f32 100644
--- a/engines/scumm/player_v1.cpp
+++ b/engines/scumm/player_v1.cpp
@@ -34,7 +34,8 @@ namespace Scumm {
#define TIMER_BASE_FREQ 1193000
#define FIXP_SHIFT 16
-Player_V1::Player_V1(ScummEngine *scumm, bool pcjr) : Player_V2(scumm, pcjr) {
+Player_V1::Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr)
+ : Player_V2(scumm, mixer, pcjr) {
// Initialize channel code
for (int i = 0; i < 4; ++i)
clear_channel(i);
diff --git a/engines/scumm/player_v1.h b/engines/scumm/player_v1.h
index 60ba8ad26d..f1c9a5ea1e 100644
--- a/engines/scumm/player_v1.h
+++ b/engines/scumm/player_v1.h
@@ -33,7 +33,7 @@ namespace Scumm {
*/
class Player_V1 : public Player_V2 {
public:
- Player_V1(ScummEngine *scumm, bool pcjr);
+ Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr);
~Player_V1();
virtual void startSound(int sound);
diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/player_v2.cpp
index 9726149851..1eb7b958dd 100644
--- a/engines/scumm/player_v2.cpp
+++ b/engines/scumm/player_v2.cpp
@@ -342,12 +342,12 @@ static const uint16 pcjr_freq_table[12] = {
#endif
-Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) {
+Player_V2::Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr) {
int i;
_isV3Game = (scumm->_game.version >= 3);
_vm = scumm;
- _mixer = scumm->_mixer;
+ _mixer = mixer;
_sample_rate = _mixer->getOutputRate();
_header_len = (scumm->_game.features & GF_OLD_BUNDLE) ? 4 : 6;
diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h
index c1a15f542e..91479487f9 100644
--- a/engines/scumm/player_v2.h
+++ b/engines/scumm/player_v2.h
@@ -74,7 +74,7 @@ struct channel_data {
*/
class Player_V2 : public Audio::AudioStream, public MusicEngine {
public:
- Player_V2(ScummEngine *scumm, bool pcjr);
+ Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr);
virtual ~Player_V2();
virtual void setMusicVolume(int vol);
diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp
index 23eeebf70b..e1f36464bb 100644
--- a/engines/scumm/player_v2a.cpp
+++ b/engines/scumm/player_v2a.cpp
@@ -1303,7 +1303,7 @@ static V2A_Sound *findSound (unsigned long crc) {
return NULL;
}
-Player_V2A::Player_V2A(ScummEngine *scumm) {
+Player_V2A::Player_V2A(ScummEngine *scumm, Audio::Mixer *mixer) {
int i;
_vm = scumm;
@@ -1317,7 +1317,7 @@ Player_V2A::Player_V2A(ScummEngine *scumm) {
_slot[i].sound = NULL;
}
- _mod = new Player_MOD(scumm);
+ _mod = new Player_MOD(mixer);
_mod->setUpdateProc(update_proc, this, 60);
}
diff --git a/engines/scumm/player_v2a.h b/engines/scumm/player_v2a.h
index b2d25d67d5..11d8470336 100644
--- a/engines/scumm/player_v2a.h
+++ b/engines/scumm/player_v2a.h
@@ -40,7 +40,7 @@ class V2A_Sound;
*/
class Player_V2A : public MusicEngine {
public:
- Player_V2A(ScummEngine *scumm);
+ Player_V2A(ScummEngine *scumm, Audio::Mixer *mixer);
virtual ~Player_V2A();
virtual void setMusicVolume(int vol);
diff --git a/engines/scumm/player_v3a.cpp b/engines/scumm/player_v3a.cpp
index e229f4515e..337145e442 100644
--- a/engines/scumm/player_v3a.cpp
+++ b/engines/scumm/player_v3a.cpp
@@ -35,7 +35,7 @@ static const uint16 note_freqs[4][12] = {
{0x00D6, 0x00CA, 0x00BE, 0x00B4, 0x00A9, 0x00A0, 0x0097, 0x008E, 0x0086, 0x007F, 0x00F0, 0x00E2}
};
-Player_V3A::Player_V3A(ScummEngine *scumm) {
+Player_V3A::Player_V3A(ScummEngine *scumm, Audio::Mixer *mixer) {
int i;
_vm = scumm;
for (i = 0; i < V3A_MAXMUS; i++) {
@@ -56,7 +56,7 @@ Player_V3A::Player_V3A(ScummEngine *scumm) {
_isinit = false;
- _mod = new Player_MOD(scumm);
+ _mod = new Player_MOD(mixer);
_mod->setUpdateProc(update_proc, this, 60);
}
diff --git a/engines/scumm/player_v3a.h b/engines/scumm/player_v3a.h
index 351d8ece60..9fea053830 100644
--- a/engines/scumm/player_v3a.h
+++ b/engines/scumm/player_v3a.h
@@ -39,7 +39,7 @@ class ScummEngine;
*/
class Player_V3A : public MusicEngine {
public:
- Player_V3A(ScummEngine *scumm);
+ Player_V3A(ScummEngine *scumm, Audio::Mixer *mixer);
virtual ~Player_V3A();
virtual void setMusicVolume(int vol);
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 371017b8b5..877dacd953 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1009,9 +1009,9 @@ void ScummEngine::setupScumm() {
// Create the sound manager
if (_game.heversion > 0)
- _sound = new SoundHE(this);
+ _sound = new SoundHE(this, _mixer);
else
- _sound = new Sound(this);
+ _sound = new Sound(this, _mixer);
// Setup the music engine
setupMusic(_game.midi);
@@ -1096,16 +1096,14 @@ void ScummEngine::setupScumm() {
void ScummEngine_v7::setupScumm() {
if (_game.features & GF_DIGI_IMUSE) {
-#ifndef DISABLE_SCUMM_7_8
- _musicEngine = _imuseDigital = new IMuseDigital(this, 10);
-#endif
+ _musicEngine = _imuseDigital = new IMuseDigital(this, _mixer, 10);
}
ScummEngine::setupScumm();
// Create FT INSANE object
if (_game.id == GID_FT)
- _insane = new Insane((ScummEngine_v7 *)this);
+ _insane = new Insane(this);
else
_insane = 0;
@@ -1457,19 +1455,19 @@ void ScummEngine::setupMusic(int midi) {
// TODO
_musicEngine = NULL;
} else if (_game.platform == Common::kPlatformNES) {
- _musicEngine = new Player_NES(this);
+ _musicEngine = new Player_NES(this, _mixer);
} else if ((_game.platform == Common::kPlatformAmiga) && (_game.version == 2)) {
- _musicEngine = new Player_V2A(this);
+ _musicEngine = new Player_V2A(this, _mixer);
} else if ((_game.platform == Common::kPlatformAmiga) && (_game.version == 3)) {
- _musicEngine = new Player_V3A(this);
+ _musicEngine = new Player_V3A(this, _mixer);
} else if ((_game.platform == Common::kPlatformAmiga) && (_game.version <= 4)) {
_musicEngine = NULL;
} else if (_game.id == GID_MANIAC && (_game.version == 1)) {
- _musicEngine = new Player_V1(this, midiDriver != MD_PCSPK);
+ _musicEngine = new Player_V1(this, _mixer, midiDriver != MD_PCSPK);
} else if (_game.version <= 2) {
- _musicEngine = new Player_V2(this, midiDriver != MD_PCSPK);
+ _musicEngine = new Player_V2(this, _mixer, midiDriver != MD_PCSPK);
} else if ((_musicType == MDT_PCSPK) && ((_game.version > 2) && (_game.version <= 4))) {
- _musicEngine = new Player_V2(this, midiDriver != MD_PCSPK);
+ _musicEngine = new Player_V2(this, _mixer, midiDriver != MD_PCSPK);
} else if (_game.version >= 3 && _game.heversion <= 61 && _game.platform != Common::kPlatform3DO) {
MidiDriver *nativeMidiDriver = 0;
MidiDriver *adlibMidiDriver = 0;
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 1da644e1e9..f6850cc773 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -56,9 +56,10 @@ struct MP3OffsetTable { /* Compressed Sound (.SO3) */
};
-Sound::Sound(ScummEngine *parent)
+Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
:
_vm(parent),
+ _mixer(mixer),
_soundQuePos(0),
_soundQue2Pos(0),
_sfxFile(0),
@@ -187,7 +188,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr, size);
- _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+ _mixer->playRaw(NULL, sound, size, rate, flags, soundID);
}
// WORKAROUND bug # 1311447
else if (READ_BE_UINT32(ptr) == 0x460e200d) {
@@ -209,7 +210,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr, size);
- _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+ _mixer->playRaw(NULL, sound, size, rate, flags, soundID);
}
// Support for sampled sound effects in Monkey Island 1 and 2
else if (READ_BE_UINT32(ptr) == MKID_BE('SBL ')) {
@@ -280,7 +281,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + 6, size);
- _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+ _mixer->playRaw(NULL, sound, size, rate, flags, soundID);
}
else if ((_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 3) || READ_BE_UINT32(ptr) == MKID_BE('SOUN') || READ_BE_UINT32(ptr) == MKID_BE('TOWS')) {
@@ -333,7 +334,7 @@ void Sound::playSound(int soundID) {
if (loopEnd > 0)
flags |= Audio::Mixer::FLAG_LOOP;
- _vm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
+ _mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
}
break;
case 1:
@@ -394,7 +395,7 @@ void Sound::playSound(int soundID) {
sound = (char *)malloc(size);
int vol = ptr[24] * 4;
memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
- _vm->_mixer->playRaw(NULL, sound, size, rate, Audio::Mixer::FLAG_AUTOFREE, soundID, vol, 0);
+ _mixer->playRaw(NULL, sound, size, rate, Audio::Mixer::FLAG_AUTOFREE, soundID, vol, 0);
}
else {
@@ -458,7 +459,7 @@ void Sound::processSfxQueues() {
} else if (_vm->_game.heversion >= 60) {
finished = !isSoundRunning(1);
} else {
- finished = !_vm->_mixer->isSoundHandleActive(_talkChannelHandle);
+ finished = !_mixer->isSoundHandleActive(_talkChannelHandle);
}
if ((uint) act < 0x80 && ((_vm->_game.version == 8) || (_vm->_game.version <= 7 && !_vm->_string[0].no_talk_anim))) {
@@ -556,7 +557,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
if (mode == 1 && (_vm->_game.id == GID_TENTACLE || _vm->_game.id == GID_SAMNMAX)) {
id = 777777 + _talk_sound_channel;
- _vm->_mixer->stopID(id);
+ _mixer->stopID(id);
}
if (b > 8) {
@@ -598,7 +599,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
_mouthSyncMode = true;
}
- if (!_soundsPaused && _vm->_mixer->isReady()) {
+ if (!_soundsPaused && _mixer->isReady()) {
Audio::AudioStream *input = NULL;
switch (_soundMode) {
@@ -636,7 +637,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
_vm->_imuseDigital->startVoice(kTalkSoundID, input);
#endif
} else {
- _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, input, id);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, input, id);
}
}
}
@@ -650,7 +651,7 @@ void Sound::stopTalkSound() {
} else if (_vm->_game.heversion >= 60) {
stopSound(1);
} else {
- _vm->_mixer->stopHandle(_talkChannelHandle);
+ _mixer->stopHandle(_talkChannelHandle);
}
_sfxMode &= ~2;
}
@@ -682,7 +683,7 @@ int Sound::isSoundRunning(int sound) const {
if (sound == _currentCDSound)
return pollCD();
- if (_vm->_mixer->isSoundIDActive(sound))
+ if (_mixer->isSoundIDActive(sound))
return 1;
if (isSoundInQueue(sound))
@@ -727,7 +728,7 @@ bool Sound::isSoundInUse(int sound) const {
if (_vm->_imuse)
return _vm->_imuse->get_sound_active(sound);
- if (_vm->_mixer->isSoundIDActive(sound))
+ if (_mixer->isSoundIDActive(sound))
return 1;
return false;
@@ -765,7 +766,7 @@ void Sound::stopSound(int sound) {
}
if (!(_vm->_game.features & GF_DIGI_IMUSE))
- _vm->_mixer->stopID(sound);
+ _mixer->stopID(sound);
if (_vm->_musicEngine)
_vm->_musicEngine->stopSound(sound);
@@ -797,7 +798,7 @@ void Sound::stopAllSounds() {
// Stop all SFX
if (!_vm->_imuseDigital) {
- _vm->_mixer->stopAll();
+ _mixer->stopAll();
}
}
@@ -874,7 +875,7 @@ void Sound::pauseSounds(bool pause) {
}
#endif
- _vm->_mixer->pauseAll(pause);
+ _mixer->pauseAll(pause);
if ((_vm->_game.features & GF_AUDIOTRACKS) && _vm->VAR(_vm->VAR_MUSIC_TIMER) > 0) {
if (pause)
@@ -983,7 +984,7 @@ BaseScummFile *Sound::openSfxFile() {
}
bool Sound::isSfxFinished() const {
- return !_vm->_mixer->hasActiveChannelOfType(Audio::Mixer::kSFXSoundType);
+ return !_mixer->hasActiveChannelOfType(Audio::Mixer::kSFXSoundType);
}
// We use a real timer in an attempt to get better sync with CD tracks. This is
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index 83607d3dd3..bda4fdd273 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -27,6 +27,10 @@
#include "sound/mixer.h"
#include "scumm/saveload.h"
+namespace Audio {
+class Mixer;
+}
+
namespace Scumm {
class ScummEngine;
@@ -52,6 +56,7 @@ public:
protected:
ScummEngine *_vm;
+ Audio::Mixer *_mixer;
int16 _soundQuePos, _soundQue[0x100];
int16 _soundQue2Pos;
@@ -85,7 +90,7 @@ public:
byte _sfxMode;
public:
- Sound(ScummEngine *parent);
+ Sound(ScummEngine *parent, Audio::Mixer *mixer);
virtual ~Sound();
virtual void addSoundToQueue(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0);
virtual void addSoundToQueue2(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0);
diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp
index b1eb7ad932..f9665c4be8 100644
--- a/engines/sword2/controls.cpp
+++ b/engines/sword2/controls.cpp
@@ -1003,7 +1003,7 @@ void OptionsDialog::onAction(Widget *widget, int result) {
if (widget == _musicSwitch) {
_vm->_sound->muteMusic(result != 0);
} else if (widget == _musicSlider) {
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, result);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, result);
_vm->_sound->muteMusic(result == 0);
_musicSwitch->setValue(result != 0);
} else if (widget == _speechSlider) {
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp
index 4c07bf4b43..3a7c08959f 100644
--- a/sound/audiocd.cpp
+++ b/sound/audiocd.cpp
@@ -68,6 +68,8 @@ AudioCDManager::AudioCDManager() {
memset(_cachedTracks, 0, sizeof(_cachedTracks));
memset(_trackInfo, 0, sizeof(_trackInfo));
_currentCache = 0;
+ _mixer = g_system->getMixer();
+ assert(_mixer);
}
void AudioCDManager::play(int track, int numLoops, int startFrame, int duration) {
@@ -83,9 +85,9 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration)
_cd.duration = duration;
if (index >= 0) {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = true;
- _trackInfo[index]->play(g_engine->_mixer, &_cd.handle, _cd.start, _cd.duration);
+ _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration);
} else {
g_system->playCD(track, numLoops, startFrame, duration);
_cd.playing = false;
@@ -95,7 +97,7 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration)
void AudioCDManager::stop() {
if (_cd.playing) {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = false;
} else {
g_system->stopCD();
@@ -109,16 +111,16 @@ bool AudioCDManager::isPlaying() const {
void AudioCDManager::updateCD() {
if (_cd.playing) {
// If the sound handle is 0, then playback stopped.
- if (!g_engine->_mixer->isSoundHandleActive(_cd.handle)) {
+ if (!_mixer->isSoundHandleActive(_cd.handle)) {
// If playback just stopped, check if the current track is supposed
// to be repeated, and if that's the case, play it again. Else, stop
// the CD explicitly.
if (_cd.numLoops == -1 || --_cd.numLoops > 0) {
int index = getCachedTrack(_cd.track);
assert(index >= 0);
- _trackInfo[index]->play(g_engine->_mixer, &_cd.handle, _cd.start, _cd.duration);
+ _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration);
} else {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = false;
}
}
diff --git a/sound/audiocd.h b/sound/audiocd.h
index 2083ffdf39..837edcff82 100644
--- a/sound/audiocd.h
+++ b/sound/audiocd.h
@@ -31,9 +31,10 @@
namespace Audio {
+
class DigitalTrackInfo {
public:
- virtual void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) = 0;
+ virtual void play(Mixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
virtual ~DigitalTrackInfo() { }
};
@@ -65,7 +66,7 @@ private:
private:
/* used for emulated CD music */
struct ExtStatus : Status {
- Audio::SoundHandle handle;
+ SoundHandle handle;
};
ExtStatus _cd;
@@ -81,6 +82,7 @@ private:
DigitalTrackInfo *_trackInfo[CACHE_TRACKS];
int _currentCache;
+ Mixer *_mixer;
};
/** Shortcut for accessing the audio CD manager. */
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index ea738dba0b..8c2a64f808 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -26,6 +26,7 @@
#include "engines/engine.h"
#include "common/config-manager.h"
#include "common/str.h"
+#include "common/system.h"
#include "common/util.h"
#include "sound/mididrv.h"
@@ -211,9 +212,9 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
switch (midiDriver) {
case MD_NULL: return MidiDriver_NULL_create();
- case MD_ADLIB: return MidiDriver_ADLIB_create(g_engine->_mixer);
+ case MD_ADLIB: return MidiDriver_ADLIB_create(g_system->getMixer());
- case MD_TOWNS: return MidiDriver_YM2612_create(g_engine->_mixer);
+ case MD_TOWNS: return MidiDriver_YM2612_create(g_system->getMixer());
// Right now PC Speaker and PCjr are handled
// outside the MidiDriver architecture, so
@@ -222,11 +223,11 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
case MD_PCJR: return NULL;
#ifdef USE_FLUIDSYNTH
- case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_engine->_mixer);
+ case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_system->getMixer());
#endif
#ifdef USE_MT32EMU
- case MD_MT32: return MidiDriver_MT32_create(g_engine->_mixer);
+ case MD_MT32: return MidiDriver_MT32_create(g_system->getMixer());
#endif
#if defined(PALMOS_MODE)
diff --git a/sound/mixer.h b/sound/mixer.h
index f1cbc0586c..34fd54c0ed 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -39,8 +39,8 @@ class Channel;
class Mixer;
class SoundHandle {
- friend class Audio::Channel;
- friend class Audio::Mixer;
+ friend class Channel;
+ friend class Mixer;
uint32 _val;
public:
inline SoundHandle() : _val(0xFFFFFFFF) {}
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index 2d1285e2f7..22c4344bae 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -21,6 +21,7 @@
#include "common/stdafx.h"
#include "sound/mpu401.h"
+#include "common/system.h"
#include "common/timer.h"
#include "common/util.h" // for ARRAYSIZE
@@ -100,7 +101,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
void MidiDriver_MPU401::close() {
if (_timer_proc)
- Common::g_timer->removeTimerProc(_timer_proc);
+ g_system->getTimerManager()->removeTimerProc(_timer_proc);
_timer_proc = 0;
for (int i = 0; i < 16; ++i)
send(0x7B << 8 | 0xB0 | i);
@@ -134,9 +135,9 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
if (!_timer_proc || !timer_proc) {
if (_timer_proc)
- Common::g_timer->removeTimerProc(_timer_proc);
+ g_system->getTimerManager()->removeTimerProc(_timer_proc);
_timer_proc = timer_proc;
if (timer_proc)
- Common::g_timer->installTimerProc(timer_proc, 10000, timer_param);
+ g_system->getTimerManager()->installTimerProc(timer_proc, 10000, timer_param);
}
}
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 4af039287e..70ce6bcf8b 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -75,7 +75,7 @@ public:
int getRate() const { return _outputRate; }
};
-class MT32File: public MT32Emu::File {
+class MT32File : public MT32Emu::File {
Common::File file;
public:
bool open(const char *filename, OpenMode mode) {