diff options
-rw-r--r-- | engines/sci/sound/drivers/midi.cpp | 8 | ||||
-rw-r--r-- | engines/sci/sound/drivers/mididriver.h | 1 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 5 | ||||
-rw-r--r-- | engines/sci/sound/music.h | 2 |
4 files changed, 15 insertions, 1 deletions
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp index b97564342c..625874eea1 100644 --- a/engines/sci/sound/drivers/midi.cpp +++ b/engines/sci/sound/drivers/midi.cpp @@ -55,6 +55,7 @@ public: bool hasRhythmChannel() const { return true; } byte getPlayId(); int getPolyphony() const { return kVoices; } + int getFirstChannel(); void setVolume(byte volume); int getVolume(); void setReverb(byte reverb); @@ -317,6 +318,13 @@ void MidiPlayer_Midi::send(uint32 b) { } } +// We return 1 for mt32, because if we remap channels to 0 for mt32, those won't get played at all +int MidiPlayer_Midi::getFirstChannel() { + if (_isMt32) + return 1; + return 0; +} + void MidiPlayer_Midi::setVolume(byte volume) { _masterVolume = volume; diff --git a/engines/sci/sound/drivers/mididriver.h b/engines/sci/sound/drivers/mididriver.h index 12d3e57f5d..58803db260 100644 --- a/engines/sci/sound/drivers/mididriver.h +++ b/engines/sci/sound/drivers/mididriver.h @@ -86,6 +86,7 @@ public: virtual byte getPlayId() = 0; virtual int getPolyphony() const = 0; + virtual int getFirstChannel() { return 0; }; virtual void setVolume(byte volume) { if(_driver) diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 96257b1f9d..6e12ac7409 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -103,6 +103,9 @@ void SciMusic::init() { } _bMultiMidi = ConfMan.getBool("multi_midi"); + + // Find out what the first possible channel is (used, when doing channel remapping) + _driverFirstChannel = _pMidiDrv->getFirstChannel(); } void SciMusic::clearPlayList() { @@ -241,7 +244,7 @@ int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) { return bestChannel; } // otherwise look for unused channel - for (int channelNr = 0; channelNr < 15; channelNr++) { + for (int channelNr = _driverFirstChannel; channelNr < 15; channelNr++) { if (!_usedChannel[channelNr]) { _usedChannel[channelNr] = caller; return channelNr; diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index cd6dcbc317..36db9a04bf 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -216,6 +216,8 @@ private: bool _soundOn; byte _masterVolume; MusicEntry *_usedChannel[16]; + + int _driverFirstChannel; }; } // End of namespace Sci |