diff options
author | Martin Kiewitz | 2015-06-26 20:08:00 +0200 |
---|---|---|
committer | Martin Kiewitz | 2015-06-26 20:08:00 +0200 |
commit | 057774f28cd58f75ab44474e7c5bb0681a363c3c (patch) | |
tree | cfc80af35b6b55cc680df67c9beb37894cf803bc /engines/sherlock/tattoo/drivers/tattoo_adlib.cpp | |
parent | c167a293ab3d3268f4632cae4e22f8a0ddc50685 (diff) | |
download | scummvm-rg350-057774f28cd58f75ab44474e7c5bb0681a363c3c.tar.gz scummvm-rg350-057774f28cd58f75ab44474e7c5bb0681a363c3c.tar.bz2 scummvm-rg350-057774f28cd58f75ab44474e7c5bb0681a363c3c.zip |
SHERLOCK: RT: Miles AdLib Driver midi note fix
- fixed checking notes for percussion channel, fixes some notes
missing during intro music
- remove currentA0hReg from PhysicalFmVoiceEntry struct, wasn't used
- moved setting virtual FM-voice in-use flag inside releaseFmVoice()
Diffstat (limited to 'engines/sherlock/tattoo/drivers/tattoo_adlib.cpp')
-rw-r--r-- | engines/sherlock/tattoo/drivers/tattoo_adlib.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/engines/sherlock/tattoo/drivers/tattoo_adlib.cpp b/engines/sherlock/tattoo/drivers/tattoo_adlib.cpp index 86a2031a7c..c762ec4d02 100644 --- a/engines/sherlock/tattoo/drivers/tattoo_adlib.cpp +++ b/engines/sherlock/tattoo/drivers/tattoo_adlib.cpp @@ -165,6 +165,7 @@ private: uint16 currentPriority; + byte currentOriginalMidiNote; byte currentNote; int16 currentTransposition; byte currentVelocity; @@ -176,6 +177,7 @@ private: currentInstrumentPtr(NULL), isPhysical(false), physicalFmVoice(0), currentPriority(0), + currentOriginalMidiNote(0), currentNote(0), currentTransposition(0), currentVelocity(0), @@ -187,12 +189,11 @@ private: bool inUse; byte virtualFmVoice; - byte currentA0hReg; byte currentB0hReg; PhysicalFmVoiceEntry(): inUse(false), virtualFmVoice(0), - currentA0hReg(0), currentB0hReg(0) { } + currentB0hReg(0) { } }; OPL::OPL *_opl; @@ -429,7 +430,6 @@ int16 MidiDriver_Miles_AdLib::searchFreePhysicalFmVoiceChannel() { void MidiDriver_Miles_AdLib::noteOn(byte midiChannel, byte note, byte velocity) { const InstrumentEntry *instrumentPtr = NULL; - //warning("Note On: channel %d, note %d, velocity %d", midiChannel, note, velocity); if (velocity == 0) { noteOff(midiChannel, note); return; @@ -448,6 +448,8 @@ void MidiDriver_Miles_AdLib::noteOn(byte midiChannel, byte note, byte velocity) return; } + //warning("Note On: channel %d, note %d, velocity %d, instrument %d/%d", midiChannel, note, velocity, instrumentPtr->bankId, instrumentPtr->patchId); + // look for free virtual FM voice int16 virtualFmVoice = searchFreeVirtualFmVoiceChannel(); @@ -471,6 +473,7 @@ void MidiDriver_Miles_AdLib::noteOn(byte midiChannel, byte note, byte velocity) _virtualFmVoices[virtualFmVoice].inUse = true; _virtualFmVoices[virtualFmVoice].actualMidiChannel = midiChannel; + _virtualFmVoices[virtualFmVoice].currentOriginalMidiNote = note; _virtualFmVoices[virtualFmVoice].currentInstrumentPtr = instrumentPtr; _virtualFmVoices[virtualFmVoice].currentVelocity = velocity; _virtualFmVoices[virtualFmVoice].isPhysical = false; @@ -506,7 +509,7 @@ void MidiDriver_Miles_AdLib::noteOff(byte midiChannel, byte note) { // Search through all virtual FM-Voices for current midiChannel + note for (byte virtualFmVoice = 0; virtualFmVoice < SHERLOCK_MILES_ADLIB_VIRTUAL_FMVOICES_COUNT; virtualFmVoice++) { if (_virtualFmVoices[virtualFmVoice].inUse) { - if ((_virtualFmVoices[virtualFmVoice].actualMidiChannel == midiChannel) && (_virtualFmVoices[virtualFmVoice].currentNote == note)) { + if ((_virtualFmVoices[virtualFmVoice].actualMidiChannel == midiChannel) && (_virtualFmVoices[virtualFmVoice].currentOriginalMidiNote == note)) { // found one if (_midiChannels[midiChannel].currentSustain >= 64) { _virtualFmVoices[virtualFmVoice].sustained = true; @@ -514,7 +517,6 @@ void MidiDriver_Miles_AdLib::noteOff(byte midiChannel, byte note) { } // releaseFmVoice(virtualFmVoice); - _virtualFmVoices[virtualFmVoice].inUse = false; } } } @@ -596,7 +598,6 @@ void MidiDriver_Miles_AdLib::prioritySort() { //warning("priority old %d, priority new %d", unvoicedHighestPriority, voicedLowestPriority); releaseFmVoice(voicedLowestFmVoice); - _virtualFmVoices[voicedLowestFmVoice].inUse = false; // Get some data of the unvoiced highest priority virtual FM Voice midiChannel = _virtualFmVoices[unvoicedHighestFmVoice].actualMidiChannel; @@ -622,6 +623,7 @@ void MidiDriver_Miles_AdLib::prioritySort() { void MidiDriver_Miles_AdLib::releaseFmVoice(byte virtualFmVoice) { // virtual Voice not actually played? -> exit if (!_virtualFmVoices[virtualFmVoice].isPhysical) { + _virtualFmVoices[virtualFmVoice].inUse = false; return; } @@ -633,6 +635,7 @@ void MidiDriver_Miles_AdLib::releaseFmVoice(byte virtualFmVoice) { // this virtual FM voice isn't physical anymore _virtualFmVoices[virtualFmVoice].isPhysical = false; + _virtualFmVoices[virtualFmVoice].inUse = false; // Remove physical FM-Voice from being active _physicalFmVoices[physicalFmVoice].inUse = false; |