From 728a045308e62579262bcf50d11fd5c37b6e26e0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 24 Jul 2008 10:31:37 +0000 Subject: cleanup svn-id: r33263 --- engines/tinsel/music.cpp | 7 ++----- engines/tinsel/sound.cpp | 46 ---------------------------------------------- engines/tinsel/sound.h | 3 --- engines/tinsel/tinsel.cpp | 13 ++++++++++--- 4 files changed, 12 insertions(+), 57 deletions(-) (limited to 'engines') diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 8af905b0c8..060eba10d4 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -58,8 +58,8 @@ static uint32 dwMidiIndex = 0; // MIDI buffer static SOUND_BUFFER midiBuffer = { 0, 0 }; -static SCNHANDLE currentMidi; -static bool currentLoop; +static SCNHANDLE currentMidi = 0; +static bool currentLoop = false; const SCNHANDLE midiOffsetsGRAVersion[] = { 4, 4534, 14298, 18828, 23358, 38888, 54418, 57172, 59926, 62450, @@ -149,7 +149,6 @@ SCNHANDLE GetTrackOffset(int trackNumber) { * @param dwFileOffset File offset of MIDI sequence data * @param bLoop Whether to loop the sequence */ - bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { currentMidi = dwFileOffset; currentLoop = bLoop; @@ -234,7 +233,6 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { /** * Returns TRUE if a Midi tune is currently playing. */ - bool MidiPlaying(void) { if (AudioCD.isPlaying()) return true; return _vm->_music->isPlaying(); @@ -243,7 +241,6 @@ bool MidiPlaying(void) { /** * Stops any currently playing midi. */ - bool StopMidi(void) { currentMidi = 0; currentLoop = false; diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 0a3b01089f..e2a24dbd47 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -43,9 +43,6 @@ namespace Tinsel { //--------------------------- General data ---------------------------------- -// get set when music/sample driver is installed -static bool bInstalled = false; - SoundManager::SoundManager(TinselEngine *vm) : //_vm(vm), // TODO: Enable this once global _vm var is gone _sampleIndex(0), _sampleIndexLen(0) { @@ -211,47 +208,4 @@ void SoundManager::openSampleFiles(void) { */ } -/** - * Initialises the sound driver. - */ - -bool SoundInit(void) { - if (!bInstalled) { -// if (mDriver != NULL) { - if (true) { // TODO: Check that a MIDI music output device is available - // open MIDI files - OpenMidiFiles(); - } - - if (_vm->_mixer->isReady()) { - // open sample files - _vm->_sound->openSampleFiles(); - } - bInstalled = true; - return true; - } else { - // already installed - return false; - } -} - - -/** - * De-initialises the sound driver. - */ - -bool SoundDeinit(void) { - if (bInstalled) { - bInstalled = false; - AudioCD.stop(); - StopMidi(); - _vm->_sound->stopAllSamples(); - DeleteMidiBuffer(); - return true; - } else { - // not installed - return false; - } -} - } // end of namespace Tinsel diff --git a/engines/tinsel/sound.h b/engines/tinsel/sound.h index c80e7589ec..56618eeb8e 100644 --- a/engines/tinsel/sound.h +++ b/engines/tinsel/sound.h @@ -75,9 +75,6 @@ public: void openSampleFiles(void); }; -bool SoundInit(void); // Initialises the sound driver -bool SoundDeinit(void); // De-initialises the sound driver - } // end of namespace Tinsel #endif // TINSEL_SOUND_H diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 8cfc6d7d4d..946c9338ba 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -914,8 +914,13 @@ void TinselEngine::RestartDrivers(void) { pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0); pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0); - // install sound driver - SoundInit(); + // open MIDI files + OpenMidiFiles(); + + // open sample files (only if mixer is ready) + if (_mixer->isReady()) { + _sound->openSampleFiles(); + } // Set midi volume SetMidiVolume(volMidi); @@ -927,7 +932,9 @@ void TinselEngine::RestartDrivers(void) { void TinselEngine::ChopDrivers(void) { // remove sound driver - SoundDeinit(); + StopMidi(); + _sound->stopAllSamples(); + DeleteMidiBuffer(); // remove event drivers _scheduler->killProcess(pMouseProcess); -- cgit v1.2.3