From: <sag...@us...> - 2011-10-03 20:59:19
|
Revision: 1081 http://modplug.svn.sourceforge.net/modplug/?rev=1081&view=rev Author: saga-games Date: 2011-10-03 20:59:13 +0000 (Mon, 03 Oct 2011) Log Message: ----------- [Fix] XM Compatibility: An instrument number (no matter what number) next to a note-off event recalls the default settings of the previously playing instrument. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-03 20:47:23 UTC (rev 1080) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-03 20:59:13 UTC (rev 1081) @@ -1477,7 +1477,7 @@ // This is only applied if the instrument column is empty and if there is either no note or a "normal" note (e.g. no note off) if(instr == 0 && note <= NOTE_MAX) { - for(INSTRUMENTINDEX nIns = 1; nIns <= m_nInstruments; nIns++) + for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) { if(Instruments[nIns] == pChn->pModInstrument) { @@ -1486,6 +1486,18 @@ } } } + } else if(note == NOTE_KEYOFF && instr && IsCompatibleMode(TRK_FASTTRACKER2)) + { + // Instrument settings are recalled if an instrument number (no matter which) is found next to a Key-Off note. + // Using the same stupid HACK as above. Maybe it's time to change something? + for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) + { + if(Instruments[nIns] == pChn->pModInstrument) + { + InstrumentChange(pChn, nIns, false, true, false); + break; + } + } } } if (retrigEnv) //Case: instrument with no note data. @@ -3693,17 +3705,17 @@ } pChn->dwFlags |= CHN_FASTVOLRAMP; - MODINSTRUMENT *pHeader = pChn->pModInstrument; + const MODINSTRUMENT *pIns = pChn->pModInstrument; // instro sends to a midi chan - if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17) + if (pIns && pIns->nMidiChannel > 0 && pIns->nMidiChannel < 17) { - UINT nPlug = pHeader->nMixPlug; + UINT nPlug = pIns->nMixPlug; if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin; if (pPlug) { - pPlug->MidiCommand(pHeader->nMidiChannel, pHeader->nMidiProgram, pHeader->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); + pPlug->MidiCommand(pIns->nMidiChannel, pIns->nMidiProgram, pIns->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |