aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tinsel/music.cpp7
-rw-r--r--engines/tinsel/sound.cpp46
-rw-r--r--engines/tinsel/sound.h3
-rw-r--r--engines/tinsel/tinsel.cpp13
4 files changed, 12 insertions, 57 deletions
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);