From: <rel...@us...> - 2009-06-29 20:57:37
|
Revision: 278 http://modplug.svn.sourceforge.net/modplug/?rev=278&view=rev Author: relabsoluness Date: 2009-06-29 20:56:43 +0000 (Mon, 29 Jun 2009) Log Message: ----------- [Ref] Minor changes (use of note constants, aligned MODCHANNEL, moved command definitions to modcommand.h, simplified CSoundFile::GetNoteName, updated CVstPlugin when building with NO_VST). Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -950,7 +950,7 @@ if ((nPlugin) && (nPlugin <= MAX_MIXPLUGINS)) { IMixPlugin *pPlugin = m_SndFile.m_MixPlugins[nPlugin-1].pMixPlugin; - if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note+0xFF, 0, MAX_BASECHANNELS); + if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note+NOTE_KEYOFF, 0, MAX_BASECHANNELS); } } @@ -1017,7 +1017,7 @@ CVstPlugin *pPlug = (CVstPlugin*)m_SndFile.m_MixPlugins[nPlug-1].pMixPlugin; INSTRUMENTHEADER* penv = m_SndFile.Chn[nChn].pHeader; if (pPlug && penv) { - pPlug->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, 0xFF, 0, nChn); + pPlug->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, NOTE_KEYOFF, 0, nChn); } } } else { Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -707,7 +707,7 @@ m_pDocManager = new CModDocManager(); #ifdef _DEBUG - // ASSERT((sizeof(MODCHANNEL)&7) == 0); + ASSERT((sizeof(MODCHANNEL)&7) == 0); // Disabled by rewbs for smoothVST. Might cause minor perf issues due to increased cache misses? #endif Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -3879,7 +3879,7 @@ { ins = m_nSplitInstrument; if (m_bOctaveLink) note += 12*(m_nOctaveModifier-9); - if (note > NOTE_MAX && note<254) note = NOTE_MAX; + if (note > NOTE_MAX && note < NOTE_NOTECUT) note = NOTE_MAX; if (note<0) note=1; } if (!ins) ins = GetCurrentInstrument(); @@ -4536,7 +4536,7 @@ if(GetCurrentInstrument()) p->instr = GetCurrentInstrument(); if (m_bOctaveLink) note += 12*(m_nOctaveModifier-9); - if (note > NOTE_MAX && note<254) note = NOTE_MAX; + if (note > NOTE_MAX && note < NOTE_NOTECUT) note = NOTE_MAX; if (note<0) note=1; p->note = note; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -2647,12 +2647,12 @@ // Specific Note Off - if (note > 0xFF) //rewbs.vstiLive + if (note > NOTE_KEYOFF) //rewbs.vstiLive { dwMidiCode = 0x80|nCh; //note off, on chan nCh note--; - UINT i = note - 0xFF; + UINT i = note - NOTE_KEYOFF; if (pCh->uNoteOnMap[i][trackChannel]) { pCh->uNoteOnMap[i][trackChannel]--; @@ -2663,7 +2663,7 @@ // "Hard core" All Sounds Off on this midi and tracker channel // This one doesn't check the note mask - just one note off per note. // Also less likely to cause a VST event buffer overflow. - else if (note == 0xFE) // ^^ + else if (note == NOTE_NOTECUT) // ^^ { //MidiSend(0xB0|nCh|(0x79<<8)); // reset all controllers MidiSend(0xB0|nCh|(0x7b<<8)); // all notes off Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/mptrack/Vstplug.h 2009-06-29 20:56:43 UTC (rev 278) @@ -204,10 +204,10 @@ VOID GetPluginType(LPSTR) {} long GetNumPrograms() {return 0;} long GetProgramNameIndexed(long, long, char*) {return 0;} - VOID SetParameter(UINT, FLOAT) {} + VOID SetParameter(PlugParamIndex nIndex, PlugParamValue fValue) {} VOID GetParamLabel(UINT, LPSTR) {} VOID GetParamDisplay(UINT, LPSTR) {} - FLOAT GetParameter(UINT) {return 0;} + PlugParamValue GetParameter(PlugParamIndex nIndex) {return 0;} bool LoadProgram(CString) {return false;} bool SaveProgram(CString) {return false;} VOID SetCurrentProgram(UINT) {} Modified: trunk/OpenMPT/soundlib/Mmx_mix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmx_mix.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/soundlib/Mmx_mix.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -161,7 +161,7 @@ { CHAR s[64]; wsprintf(s, "MODCHANNEL not aligned: sizeof(MODCHANNEL) = %d", sizeof(MODCHANNEL)); - //::MessageBox(NULL, s, NULL, MB_OK|MB_ICONEXCLAMATION); //disabled by rewbs + ::MessageBox(NULL, s, NULL, MB_OK|MB_ICONEXCLAMATION); //disabled by rewbs } DWORD dwFastSinc = (DWORD)(LPVOID)gFastSinc; if (dwFastSinc & 7) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -939,7 +939,7 @@ //switch off duplicated note played on this plugin IMixPlugin *pPlugin = m_MixPlugins[pHeader->nMixPlug-1].pMixPlugin; if (pPlugin && p->nNote) - pPlugin->MidiCommand(p->pHeader->nMidiChannel, p->pHeader->nMidiProgram, p->pHeader->wMidiBank, p->nNote+0xFF, 0, i); + pPlugin->MidiCommand(p->pHeader->nMidiChannel, p->pHeader->nMidiProgram, p->pHeader->wMidiBank, p->nNote+NOTE_KEYOFF, 0, i); break; } } @@ -1027,7 +1027,7 @@ case NNA_NOTEFADE: //switch off note played on this plugin, on this tracker channel and midi channel //pPlugin->MidiCommand(pChn->pHeader->nMidiChannel, pChn->pHeader->nMidiProgram, pChn->nNote+0xFF, 0, n); - pPlugin->MidiCommand(pChn->pHeader->nMidiChannel, pChn->pHeader->nMidiProgram, pChn->pHeader->wMidiBank, /*pChn->nNote+*/0xFF, 0, nChn); + pPlugin->MidiCommand(pChn->pHeader->nMidiChannel, pChn->pHeader->nMidiProgram, pChn->pHeader->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); break; } } @@ -3030,7 +3030,7 @@ 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+*/0xFF, 0, nChn); + pPlug->MidiCommand(pHeader->nMidiChannel, pHeader->nMidiProgram, pHeader->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); } } } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-06-29 20:56:43 UTC (rev 278) @@ -2876,14 +2876,14 @@ string CSoundFile::GetNoteName(const CTuning::NOTEINDEXTYPE& note, const int inst) const //---------------------------------------------------------------------------------- { - if(inst >= MAX_INSTRUMENTS || inst < -1) return "BUG"; + if(inst >= MAX_INSTRUMENTS || inst < -1 || note < 1 || note > NOTE_MAX) return "BUG"; if(inst == -1) - return string(szNoteNames[abs(note-1)%12]) + Stringify((note-1)/12); + return szDefaultNoteNames[note-1]; if(m_nType == MOD_TYPE_MPT && Headers[inst] && Headers[inst]->pTuning) return Headers[inst]->pTuning->GetNoteName(note-NOTE_MIDDLEC); else - return string(szNoteNames[abs(note-1)%12]) + Stringify((note-1)/12); + return szDefaultNoteNames[note-1]; } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/soundlib/Sndfile.h 2009-06-29 20:56:43 UTC (rev 278) @@ -162,44 +162,6 @@ #define ENV_PITCHCARRY 0x2000 #define ENV_MUTE 0x4000 -#define CMD_NONE 0 -#define CMD_ARPEGGIO 1 -#define CMD_PORTAMENTOUP 2 -#define CMD_PORTAMENTODOWN 3 -#define CMD_TONEPORTAMENTO 4 -#define CMD_VIBRATO 5 -#define CMD_TONEPORTAVOL 6 -#define CMD_VIBRATOVOL 7 -#define CMD_TREMOLO 8 -#define CMD_PANNING8 9 -#define CMD_OFFSET 10 -#define CMD_VOLUMESLIDE 11 -#define CMD_POSITIONJUMP 12 -#define CMD_VOLUME 13 -#define CMD_PATTERNBREAK 14 -#define CMD_RETRIG 15 -#define CMD_SPEED 16 -#define CMD_TEMPO 17 -#define CMD_TREMOR 18 -#define CMD_MODCMDEX 19 -#define CMD_S3MCMDEX 20 -#define CMD_CHANNELVOLUME 21 -#define CMD_CHANNELVOLSLIDE 22 -#define CMD_GLOBALVOLUME 23 -#define CMD_GLOBALVOLSLIDE 24 -#define CMD_KEYOFF 25 -#define CMD_FINEVIBRATO 26 -#define CMD_PANBRELLO 27 -#define CMD_XFINEPORTAUPDOWN 28 -#define CMD_PANNINGSLIDE 29 -#define CMD_SETENVPOSITION 30 -#define CMD_MIDI 31 -#define CMD_SMOOTHMIDI 32 //rewbs.smoothVST -#define CMD_VELOCITY 33 //rewbs.velocity -// -> CODE#0010 -// -> DESC="add extended parameter mechanism to pattern effects" -#define CMD_XPARAM 34 -// -! NEW_FEATURE#0010 // Filter Modes #define FLTMODE_UNCHANGED 0xFF @@ -207,22 +169,6 @@ #define FLTMODE_HIGHPASS 1 #define FLTMODE_BANDPASS 2 -// Volume Column commands -#define VOLCMD_VOLUME 1 -#define VOLCMD_PANNING 2 -#define VOLCMD_VOLSLIDEUP 3 -#define VOLCMD_VOLSLIDEDOWN 4 -#define VOLCMD_FINEVOLUP 5 -#define VOLCMD_FINEVOLDOWN 6 -#define VOLCMD_VIBRATOSPEED 7 -#define VOLCMD_VIBRATO 8 -#define VOLCMD_PANSLIDELEFT 9 -#define VOLCMD_PANSLIDERIGHT 10 -#define VOLCMD_TONEPORTAMENTO 11 -#define VOLCMD_PORTAUP 12 -#define VOLCMD_PORTADOWN 13 -#define VOLCMD_VELOCITY 14 //rewbs.velocity -#define VOLCMD_OFFSET 15 //rewbs.volOff #define RSF_16BIT 0x04 #define RSF_STEREO 0x08 @@ -544,7 +490,7 @@ // Channel Struct -typedef struct _MODCHANNEL +typedef struct __declspec(align(32)) _MODCHANNEL { // First 32-bytes: Most used mixing information: don't change it LPSTR pCurrentSample; @@ -584,9 +530,9 @@ LONG nVolSwing, nPanSwing; LONG nCutSwing, nResSwing; LONG nRestorePanOnNewNote; //If > 0, nPan should be set to nRestorePanOnNewNote - 1 on new note. Used to recover from panswing. - LONG nRestoreResonanceOnNewNote; //Like above - LONG nRestoreCutoffOnNewNote; //Like above // 8-bit members + BYTE nRestoreResonanceOnNewNote; //Like above + BYTE nRestoreCutoffOnNewNote; //Like above BYTE nNote, nNNA; BYTE nNewNote, nNewIns, nCommand, nArpeggio; BYTE nOldVolumeSlide, nOldFineVolUpDown; @@ -607,11 +553,11 @@ BYTE nLeftVU, nRightVU; BYTE nActiveMacro, nFilterMode; + uint16 m_RowPlugParam; //NOTE_PCs memory. float m_nPlugParamValueStep; //rewbs.smoothVST float m_nPlugInitialParamValue; //rewbs.smoothVST - long m_RowPlugParam; //NOTE_PCs memory. PLUGINDEX m_RowPlug; //NOTE_PCs memory. - + void ClearRowCmd() {nRowNote = 0; nRowInstr = 0; nRowVolCmd = 0; nRowVolume = 0; nRowCommand = 0; nRowParam = 0;} typedef UINT VOLUME; Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2009-06-25 21:53:49 UTC (rev 277) +++ trunk/OpenMPT/soundlib/modcommand.h 2009-06-29 20:56:43 UTC (rev 278) @@ -69,4 +69,60 @@ #define NOTE_MIN_SPECIAL NOTE_PCS +// Volume Column commands +#define VOLCMD_VOLUME 1 +#define VOLCMD_PANNING 2 +#define VOLCMD_VOLSLIDEUP 3 +#define VOLCMD_VOLSLIDEDOWN 4 +#define VOLCMD_FINEVOLUP 5 +#define VOLCMD_FINEVOLDOWN 6 +#define VOLCMD_VIBRATOSPEED 7 +#define VOLCMD_VIBRATO 8 +#define VOLCMD_PANSLIDELEFT 9 +#define VOLCMD_PANSLIDERIGHT 10 +#define VOLCMD_TONEPORTAMENTO 11 +#define VOLCMD_PORTAUP 12 +#define VOLCMD_PORTADOWN 13 +#define VOLCMD_VELOCITY 14 //rewbs.velocity +#define VOLCMD_OFFSET 15 //rewbs.volOff + + +// Effect column commands +#define CMD_NONE 0 +#define CMD_ARPEGGIO 1 +#define CMD_PORTAMENTOUP 2 +#define CMD_PORTAMENTODOWN 3 +#define CMD_TONEPORTAMENTO 4 +#define CMD_VIBRATO 5 +#define CMD_TONEPORTAVOL 6 +#define CMD_VIBRATOVOL 7 +#define CMD_TREMOLO 8 +#define CMD_PANNING8 9 +#define CMD_OFFSET 10 +#define CMD_VOLUMESLIDE 11 +#define CMD_POSITIONJUMP 12 +#define CMD_VOLUME 13 +#define CMD_PATTERNBREAK 14 +#define CMD_RETRIG 15 +#define CMD_SPEED 16 +#define CMD_TEMPO 17 +#define CMD_TREMOR 18 +#define CMD_MODCMDEX 19 +#define CMD_S3MCMDEX 20 +#define CMD_CHANNELVOLUME 21 +#define CMD_CHANNELVOLSLIDE 22 +#define CMD_GLOBALVOLUME 23 +#define CMD_GLOBALVOLSLIDE 24 +#define CMD_KEYOFF 25 +#define CMD_FINEVIBRATO 26 +#define CMD_PANBRELLO 27 +#define CMD_XFINEPORTAUPDOWN 28 +#define CMD_PANNINGSLIDE 29 +#define CMD_SETENVPOSITION 30 +#define CMD_MIDI 31 +#define CMD_SMOOTHMIDI 32 //rewbs.smoothVST +#define CMD_VELOCITY 33 //rewbs.velocity +#define CMD_XPARAM 34 // -> CODE#0010 -> DESC="add extended parameter mechanism to pattern effects" -! NEW_FEATURE#0010 + + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |