mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
When unloading a song, only reset the channels that it actually used, not all channels
svn-id: r47304
This commit is contained in:
parent
69c1de90e4
commit
177cfe4c92
@ -80,6 +80,8 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in
|
||||
_tracks[0] = _mixedData;
|
||||
setTrack(0);
|
||||
_loopTick = 0;
|
||||
_channelsUsed = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -95,17 +97,20 @@ void MidiParser_SCI::unloadMusic() {
|
||||
}
|
||||
|
||||
// Center the pitch wheels and hold pedal in preparation for the next piece of music
|
||||
// TODO: We should monitor what channels are used by each song, and only
|
||||
// reset these channels, not all of them!
|
||||
if (_driver) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
_driver->send(0xE0 | i, 0, 0x40); // Reset pitch wheel
|
||||
_driver->send(0xB0 | i, 0x40, 0); // Reset hold pedal
|
||||
if (_channelsUsed & (1 << i)) {
|
||||
_driver->send(0xE0 | i, 0, 0x40); // Reset pitch wheel
|
||||
_driver->send(0xB0 | i, 0x40, 0); // Reset hold pedal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MidiParser_SCI::parseNextEvent(EventInfo &info) {
|
||||
// Monitor which channels are used by this song
|
||||
_channelsUsed |= (1 << info.channel());
|
||||
|
||||
// Set signal AFTER waiting for delta, otherwise we would set signal too soon resulting in all sorts of bugs
|
||||
if (_signalSet) {
|
||||
_signalSet = false;
|
||||
@ -186,7 +191,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
|
||||
case 0x46: // LSL3 - binoculars
|
||||
case 0x61: // Iceman (Adlib?)
|
||||
case 0x73: // Hoyle
|
||||
case 0xd1: // KQ4, when riding the unicorn
|
||||
case 0xD1: // KQ4, when riding the unicorn
|
||||
// Obscure SCI commands - ignored
|
||||
break;
|
||||
// Standard MIDI commands
|
||||
|
@ -84,6 +84,10 @@ protected:
|
||||
|
||||
bool _signalSet;
|
||||
int16 _signalToSet;
|
||||
|
||||
// A 16-bit mask, containing the channels used
|
||||
// by the currently parsed song
|
||||
uint16 _channelsUsed;
|
||||
};
|
||||
|
||||
} // End of namespace Sci
|
||||
|
Loading…
x
Reference in New Issue
Block a user