diff options
author | Filippos Karapetis | 2010-06-11 14:47:13 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-11 14:47:13 +0000 |
commit | a08d06ad353996ee9bf495a84988f3a91cacf51a (patch) | |
tree | a4c331f5fede83ca082bde96026dfec4de39d5d6 /engines/sci/sound | |
parent | e572267a05674b4b462602781be58f813c84479d (diff) | |
download | scummvm-rg350-a08d06ad353996ee9bf495a84988f3a91cacf51a.tar.gz scummvm-rg350-a08d06ad353996ee9bf495a84988f3a91cacf51a.tar.bz2 scummvm-rg350-a08d06ad353996ee9bf495a84988f3a91cacf51a.zip |
- Added a new debug command, verify_midi, which can be used to check all the songs of a game for unmapped instruments (still WIP and disabled)
- Fixed a bug in the verify_scripts command (it was loading the script resource twice)
svn-id: r49597
Diffstat (limited to 'engines/sci/sound')
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 42 | ||||
-rw-r--r-- | engines/sci/sound/midiparser_sci.h | 2 |
2 files changed, 26 insertions, 18 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 8f88945888..f852367bfe 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -75,7 +75,8 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in _pSnd = psnd; _soundVersion = soundVersion; - setVolume(psnd->volume); + if (_pSnd) + setVolume(psnd->volume); if (channelFilterMask) { // SCI0 only has 1 data stream, but we need to filter out channels depending on music hardware selection @@ -86,30 +87,35 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in _num_tracks = 1; _tracks[0] = _mixedData; - setTrack(0); + if (_pSnd) + setTrack(0); _loopTick = 0; - if (_soundVersion <= SCI_VERSION_0_LATE) { - // Set initial voice count - for (int i = 0; i < 16; ++i) { - byte voiceCount = 0; - if (channelFilterMask & (1 << i)) - voiceCount = psnd->soundRes->getInitialVoiceCount(i); - _driver->send(0xB0 | i, 0x4B, voiceCount); + if (_pSnd) { + if (_soundVersion <= SCI_VERSION_0_LATE) { + // Set initial voice count + for (int i = 0; i < 16; ++i) { + byte voiceCount = 0; + if (channelFilterMask & (1 << i)) + voiceCount = psnd->soundRes->getInitialVoiceCount(i); + _driver->send(0xB0 | i, 0x4B, voiceCount); + } } - } - // Send a velocity off signal to all channels - for (int i = 0; i < 16; ++i) { - _driver->send(0xB0 | i, 0x4E, 0); // Reset velocity + // Send a velocity off signal to all channels + for (int i = 0; i < 16; ++i) { + _driver->send(0xB0 | i, 0x4E, 0); // Reset velocity + } } return true; } void MidiParser_SCI::unloadMusic() { - resetTracking(); - allNotesOff(); + if (_pSnd) { + resetTracking(); + allNotesOff(); + } _num_tracks = 0; _active_track = 255; _resetOnPause = false; @@ -120,7 +126,7 @@ void MidiParser_SCI::unloadMusic() { } // Center the pitch wheels and hold pedal in preparation for the next piece of music - if (_driver) { + if (_driver && _pSnd) { for (int i = 0; i < 16; ++i) { if (isChannelUsed(i)) { _driver->send(0xE0 | i, 0, 0x40); // Reset pitch wheel @@ -359,10 +365,10 @@ byte *MidiParser_SCI::midiMixChannels() { long new_delta; SoundResource::Channel *channel; - while ((curr = midiGetNextChannel(ticker)) != 0xFF) { // there is still active channel + while ((curr = midiGetNextChannel(ticker)) != 0xFF) { // there is still an active channel channel = &_track->channels[curr]; curDelta = *channel->data++; - channel->time += (curDelta == 0xF8 ? 240 : curDelta); // when the comamnd is supposed to occur + channel->time += (curDelta == 0xF8 ? 240 : curDelta); // when the command is supposed to occur if (curDelta == 0xF8) continue; new_delta = channel->time - ticker; diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index 9d4b5a39da..8384c74cf6 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -79,6 +79,8 @@ public: void clearUsedChannels() { _channelsUsed = 0; } + const byte *getMixedData() const { return _mixedData; } + protected: bool isChannelUsed(byte channel) const { return _channelsUsed & (1 << channel); } void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); } |