diff options
author | Filippos Karapetis | 2009-12-21 16:27:50 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-21 16:27:50 +0000 |
commit | 5a087101add53b78a147b950da7ee230daac1fba (patch) | |
tree | 76ad078736849f36a9444ea9fa6b0de7fd5bba3a /engines/sci/sfx | |
parent | 11a9351ae53176bb6f2906d35ce21eca61d3a9be (diff) | |
download | scummvm-rg350-5a087101add53b78a147b950da7ee230daac1fba.tar.gz scummvm-rg350-5a087101add53b78a147b950da7ee230daac1fba.tar.bz2 scummvm-rg350-5a087101add53b78a147b950da7ee230daac1fba.zip |
Some updates to the new music code
svn-id: r46467
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r-- | engines/sci/sfx/music.cpp | 6 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 16 |
2 files changed, 15 insertions, 7 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index c77c657fe9..3956b0faeb 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -66,6 +66,12 @@ void SciMusic::init() { _midiType = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PCSPK); + // Sanity check + if (_midiType != MDT_MIDI && _midiType != MDT_ADLIB && _midiType != MDT_PCSPK) { + warning("Unhandled MIDI type, switching to Adlib"); + _midiType = MD_ADLIB; + } + switch (_midiType) { case MD_ADLIB: // FIXME: There's no Amiga sound option, so we hook it up to Adlib diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 6f8cbde265..ecade498c3 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -230,7 +230,8 @@ reg_t SoundCommandParser::parseCommand(int argc, reg_t *argv, reg_t acc) { } if (command < _soundCommands.size()) { - // printf("%s\n", _soundCommands[command]->desc); // debug + //if (strcmp(_soundCommands[command]->desc, "cmdUpdateCues")) + //printf("%s\n", _soundCommands[command]->desc); // debug debugC(2, kDebugLevelSound, "%s", _soundCommands[command]->desc); (this->*(_soundCommands[command]->sndCmd))(obj, value); } else { @@ -261,12 +262,9 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) { } } -#endif - if (!obj.segment || !_resMan->testResource(ResourceId(kResourceTypeSound, number))) return; -#ifdef USE_OLD_MUSIC_FUNCTIONS _state->sfx_add_song(build_iterator(_resMan, number, type, handle), 0, handle, number); #endif @@ -279,16 +277,20 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) { #ifndef USE_OLD_MUSIC_FUNCTIONS MusicEntry *newSound = new MusicEntry(); - newSound->soundRes = new SoundResource(number, _resMan); + newSound->soundRes = 0; + if (_resMan->testResource(ResourceId(kResourceTypeSound, number))) + newSound->soundRes = new SoundResource(number, _resMan); newSound->soundObj = obj; newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF; newSound->pStreamAud = 0; newSound->pMidiParser = 0; - _music->_playList.push_back(newSound); + // TODO //_music->soundKill(newSound); + _music->_playList.push_back(newSound); - _music->soundInitSnd(newSound); + if (newSound->soundRes) + _music->soundInitSnd(newSound); #endif } |