From: <sag...@us...> - 2012-02-17 21:36:16
|
Revision: 1183 http://modplug.svn.sourceforge.net/modplug/?rev=1183&view=rev Author: saga-games Date: 2012-02-17 21:36:02 +0000 (Fri, 17 Feb 2012) Log Message: ----------- [Ref] Converted NOTE_IS_VALID macro into MODCOMMAND member functions. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -131,7 +131,7 @@ //------------------------------------------ { if (nNote == m_nNote) return TRUE; - if (!NOTE_IS_VALID(nNote + 1)) return FALSE; + if (!MODCOMMAND::IsNote(nNote + 1)) return FALSE; m_nNote = nNote; InvalidateRect(NULL, FALSE); return TRUE; @@ -192,10 +192,10 @@ rect.left = rect.right; rect.right = m_cxFont*2-1; strcpy(s, "..."); - if ((pIns) && (nPos >= 0) && (nPos < NOTE_MAX) && (pIns->NoteMap[nPos])) + if ((pIns) && (nPos >= 0) && (nPos < NOTE_MAX) && (pIns->NoteMap[nPos] != NOTE_NONE)) { UINT n = pIns->NoteMap[nPos]; - if(NOTE_IS_VALID(n)) + if(MODCOMMAND::IsNote(n)) { string temp = pSndFile->GetNoteName(n, m_nInstrument); temp.resize(4); @@ -345,7 +345,7 @@ if(pSndFile->GetType() != MOD_TYPE_XM) { - if(NOTE_IS_VALID(pIns->NoteMap[m_nNote])) + if(MODCOMMAND::IsNote(pIns->NoteMap[m_nNote])) { wsprintf(s, "Map all ¬es to %s\t" + ih->GetKeyTextFromCommand(kcInsNoteMapCopyCurrentNote), pSndFile->GetNoteName(pIns->NoteMap[m_nNote], m_nInstrument).c_str()); AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -895,7 +895,7 @@ if ((!pMainFrm) || (!note)) return FALSE; if (nVol > 256) nVol = 256; - if (NOTE_IS_VALID(note)) + if (MODCOMMAND::IsNoteOrEmpty(note)) { //kill notes if required. Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -271,10 +271,10 @@ { MODCOMMAND::INSTR instr = m.instr, newinstr = 0; MODCOMMAND::NOTE note = m.note, newnote = note; - if(note != NOTE_NONE && NOTE_IS_VALID(note)) - note--; + if(MODCOMMAND::IsNote(note)) + note = note - NOTE_MIN; else - note = NOTE_MIDDLEC - 1; + note = NOTE_MIDDLEC - NOTE_MIN; if((instr < MAX_INSTRUMENTS) && (pSndFile->Instruments[instr])) { @@ -284,7 +284,7 @@ if(newinstr >= MAX_SAMPLES) newinstr = 0; } m.instr = newinstr; - if(m.note != NOTE_NONE && NOTE_IS_VALID(m.note)) + if(m.IsNote()) { m.note = newnote; } Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -857,7 +857,7 @@ combo->SetItemData(combo->AddString("No note"), 0); AppendNotesToControlEx(*combo, pSndFile, m_nInstr); - if (NOTE_IS_VALID(m_nNote)) + if (MODCOMMAND::IsNoteOrEmpty(m_nNote)) { // Normal note / no note const MODCOMMAND::NOTE noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -4606,7 +4606,7 @@ // just play the newly inserted note using the already specified instrument... UINT nPlayIns = newcmd.instr; - if(!nPlayIns && NOTE_IS_VALID(note)) + if(!nPlayIns && MODCOMMAND::IsNoteOrEmpty(note)) { // ...or one that can be found on a previous row of this pattern. MODCOMMAND *search = pTarget; @@ -5659,7 +5659,7 @@ result = (startRowCmd == endRowCmd && startRowCmd != NOTE_NONE) // Interpolate between two identical notes or Cut / Fade / etc... || (startRowCmd != NOTE_NONE && endRowCmd == NOTE_NONE) // Fill in values from the first row || (startRowCmd == NOTE_NONE && endRowCmd != NOTE_NONE) // Fill in values from the last row - || (NOTE_IS_VALID(startRowCmd) && NOTE_IS_VALID(endRowCmd) && !(startRowCmd == NOTE_NONE && endRowCmd == NOTE_NONE)); // Interpolate between two notes of which one may be empty + || (MODCOMMAND::IsNoteOrEmpty(startRowCmd) && MODCOMMAND::IsNoteOrEmpty(endRowCmd) && !(startRowCmd == NOTE_NONE && endRowCmd == NOTE_NONE)); // Interpolate between two notes of which one may be empty break; case EFFECT_COLUMN: startRowCmd = startRowMC.command; @@ -5923,7 +5923,7 @@ // If a note or an instr is present on the row, do the change, if required. // Do not set instr if note and instr are both blank, // but set instr if note is a PC note and instr is blank. - if (((p->note != NOTE_NONE && NOTE_IS_VALID(p->note)) || p->IsPcNote() || p->instr) && (p->instr != nIns)) + if ((p->IsNote() || p->IsPcNote() || p->instr) && (p->instr != nIns)) { p->instr = nIns; bModified = true; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/mptrack/View_pat.h 2012-02-17 21:36:02 UTC (rev 1183) @@ -214,7 +214,7 @@ void DrawDragSel(HDC hdc); void OnDrawDragSel(); // True if default volume should be drawn for a given cell. - static bool DrawDefaultVolume(const MODCOMMAND *m) { return (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SHOWDEFAULTVOLUME) && m->volcmd == VOLCMD_NONE && m->command != CMD_VOLUME && m->instr != 0 && m->note != NOTE_NONE && NOTE_IS_VALID(m->note); } + static bool DrawDefaultVolume(const MODCOMMAND *m) { return (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SHOWDEFAULTVOLUME) && m->volcmd == VOLCMD_NONE && m->command != CMD_VOLUME && m->instr != 0 && m->IsNote(); } //rewbs.customKeys BOOL ExecuteCommand(CommandID command); Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-02-17 21:36:02 UTC (rev 1183) @@ -414,13 +414,13 @@ } // If there's just an instrument number, but no note, retrigger sample. - if(m->note == NOTE_NONE && NOTE_IS_VALID(m->note) && m->instr > 0) + if(m->note == NOTE_NONE && m->instr > 0) { m->note = settings.lastNote[nChn]; m->instr = 0; } - if(m->note != NOTE_NONE && NOTE_IS_VALID(m->note)) + if(m->IsNote()) { settings.playDir[nChn] = false; } @@ -636,7 +636,7 @@ } // I guess this is close enough to "not retriggering the note" - if(slideNote && m->note != NOTE_NONE && NOTE_IS_VALID(m->note)) + if(slideNote && m->IsNote()) { if(effect2 == CMD_NONE) { Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -63,7 +63,7 @@ // Filtering is only ever done in IT if either cutoff is not full or if resonance is set. if(IsCompatibleMode(TRK_IMPULSETRACKER) && resonance == 0 && computedCutoff >= 254) { - if(pChn->rowCommand.note != NOTE_NONE && NOTE_IS_VALID(pChn->rowCommand.note) && !(pChn->dwFlags & CHN_PORTAMENTO) && !pChn->nMasterChn && (m_dwSongFlags & SONG_FIRSTTICK) != 0) + if(pChn->rowCommand.IsNote() && !(pChn->dwFlags & CHN_PORTAMENTO) && !pChn->nMasterChn && (m_dwSongFlags & SONG_FIRSTTICK) != 0) { // Z7F next to a note disables the filter, however in other cases this should not happen. // Test cases: filter-reset.it, filter-reset-carry.it, filter-nna.it Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -522,10 +522,10 @@ for (CHANNELINDEX n = 0; n < GetNumChannels(); n++) { Chn[n].nGlobalVol = memory.chnVols[n]; - if (memory.notes[n]) + if (memory.notes[n] != NOTE_NONE) { Chn[n].nNewNote = memory.notes[n]; - if(NOTE_IS_VALID(memory.notes[n])) + if(MODCOMMAND::IsNote(memory.notes[n])) { Chn[n].nLastNote = memory.notes[n]; } @@ -566,7 +566,7 @@ if(note == NOTE_NONE && IsCompatibleMode(TRK_IMPULSETRACKER)) return; - if (pIns != nullptr && note != NOTE_NONE && NOTE_IS_VALID(note)) + if (pIns != nullptr && MODCOMMAND::IsNote(note)) { if(bPorta && pIns == pChn->pModInstrument && (pChn->pModSample != nullptr && pChn->pModSample->pSample != nullptr) && IsCompatibleMode(TRK_IMPULSETRACKER)) { @@ -1545,7 +1545,7 @@ // Notes that exceed FT2's limit are completely ignored. // Test case: note-limit.xm - if(note != NOTE_NONE && NOTE_IS_VALID(note) && IsCompatibleMode(TRK_FASTTRACKER2)) + if(MODCOMMAND::IsNote(note) && IsCompatibleMode(TRK_FASTTRACKER2)) { const int computedNote = note + pChn->nTranspose; if((computedNote < NOTE_MIN + 11 || computedNote > NOTE_MIN + 130)) @@ -1673,7 +1673,7 @@ // Note Cut/Off/Fade => ignore instrument if (note >= NOTE_MIN_SPECIAL) instr = 0; - if (note != NOTE_NONE && NOTE_IS_VALID(note)) + if (MODCOMMAND::IsNote(note)) { pChn->nNewNote = pChn->nLastNote = note; @@ -1937,7 +1937,7 @@ } if (m && m->command == CMD_XPARAM) { - if (GetType() & MOD_TYPE_XM) + if ((GetType() & MOD_TYPE_XM)) { param -= 0x20; //with XM, 0x20 is the lowest tempo. Anything below changes ticks per row. } @@ -1967,7 +1967,7 @@ case CMD_ARPEGGIO: // IT compatibility 01. Don't ignore Arpeggio if no note is playing (also valid for ST3) if ((m_nTickCount) || (((!pChn->nPeriod) || !pChn->nNote) && !IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER))) break; - if ((!param) && (!(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)))) break; + if ((!param) && (!(GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))) break; pChn->nCommand = CMD_ARPEGGIO; if (param) pChn->nArpeggio = param; break; @@ -2037,18 +2037,14 @@ // break; // } - if (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; - //IT compatibility 16. FT2, ST3 and IT ignore out-of-range values - if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_SCREAMTRACKER)) + if (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) param *= 2; + + // IT compatibility 16. FT2, ST3 and IT ignore out-of-range values. + // Test case: globalvol-invalid.it + if (param <= 128) { - if (param <= 128) - m_nGlobalVolume = param << 1; + m_nGlobalVolume = param * 2; } - else - { - if (param > 128) param = 128; - m_nGlobalVolume = param << 1; - } break; // Global Volume Slide @@ -2065,7 +2061,7 @@ if (!(m_dwSongFlags & SONG_FIRSTTICK)) break; if ((m_dwSongFlags & SONG_PT1XMODE)) break; if (!(m_dwSongFlags & SONG_SURROUNDPAN)) pChn->dwFlags &= ~CHN_SURROUND; - if (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_XM|MOD_TYPE_MOD|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM | MOD_TYPE_MOD | MOD_TYPE_MT2)) { pChn->nPan = param; } else @@ -2491,7 +2487,7 @@ { if ((pChn->nPeriod) && (param)) { - if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)))) + if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); } else @@ -2515,7 +2511,7 @@ { if ((pChn->nPeriod) && (param)) { - if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)))) + if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideUpTable[param & 0x0F], 65536); } else @@ -2539,7 +2535,7 @@ { if ((pChn->nPeriod) && (param)) { - if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)))) + if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); } else @@ -2563,7 +2559,7 @@ { if ((pChn->nPeriod) && (param)) { - if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)))) + if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); } else @@ -3136,7 +3132,7 @@ case 0xA0: if(m_dwSongFlags & SONG_FIRSTTICK) { pChn->nOldHiOffset = param; - if (!IsCompatibleMode(TRK_IMPULSETRACKER) && (pChn->rowCommand.note != NOTE_NONE) && NOTE_IS_VALID(pChn->rowCommand.note)) + if (!IsCompatibleMode(TRK_IMPULSETRACKER) && pChn->rowCommand.IsNote()) { DWORD pos = param << 16; if (pos < pChn->nLength) pChn->nPos = pos; @@ -3272,7 +3268,7 @@ data = (unsigned char)GetBestMidiChannel(nChn); } else if(macro[pos] == 'n') // n: note value (last triggered note) { - if(pChn->nLastNote != NOTE_NONE && NOTE_IS_VALID(pChn->nLastNote)) + if(MODCOMMAND::IsNote(pChn->nLastNote)) { data = (unsigned char)(pChn->nLastNote - NOTE_MIN); } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -2646,10 +2646,10 @@ string CSoundFile::GetNoteName(const CTuning::NOTEINDEXTYPE& note, const INSTRUMENTINDEX inst) const //-------------------------------------------------------------------------------------------------- { - if((inst >= MAX_INSTRUMENTS && inst != INSTRUMENTINDEX_INVALID) || note < 1 || note > NOTE_MAX) return "BUG"; + if((inst >= MAX_INSTRUMENTS && inst != INSTRUMENTINDEX_INVALID) || note < NOTE_MIN || note > NOTE_MAX) return "BUG"; // For MPTM instruments with custom tuning, find the appropriate note name. Else, use default note names. - if(inst != INSTRUMENTINDEX_INVALID && m_nType == MOD_TYPE_MPT && Instruments[inst] && Instruments[inst]->pTuning) + if(inst != INSTRUMENTINDEX_INVALID && GetType() == MOD_TYPE_MPT && Instruments[inst] && Instruments[inst]->pTuning) return Instruments[inst]->pTuning->GetNoteName(note - NOTE_MIDDLEC); else return szDefaultNoteNames[note - 1]; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-02-17 21:36:02 UTC (rev 1183) @@ -2461,7 +2461,7 @@ if(note != NOTE_NONE) { MODCOMMAND::NOTE realNote = note; - if(NOTE_IS_VALID(note)) + if(MODCOMMAND::IsNote(note)) realNote = pIns->NoteMap[note - 1]; pPlugin->MidiCommand(GetBestMidiChannel(nChn), pIns->nMidiProgram, pIns->wMidiBank, realNote, pChn->nVolume, nChn); } else if (volcmd == VOLCMD_VOLUME) @@ -2488,7 +2488,7 @@ } MODCOMMAND::NOTE realNote = note; - if(NOTE_IS_VALID(note)) + if(MODCOMMAND::IsNote(note)) realNote = pIns->NoteMap[note - 1]; // Experimental VST panning //ProcessMIDIMacro(nChn, false, m_MidiCfg.szMidiGlb[MIDIOUT_PAN], 0, nPlugin); Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2012-02-15 23:17:20 UTC (rev 1182) +++ trunk/OpenMPT/soundlib/modcommand.h 2012-02-17 21:36:02 UTC (rev 1183) @@ -1,20 +1,20 @@ +#pragma once + #ifndef MODCOMMAND_H #define MODCOMMAND_H - // Note definitions #define NOTE_NONE 0 -#define NOTE_MIDDLEC (5*12+1) -#define NOTE_KEYOFF 0xFF //255 -#define NOTE_NOTECUT 0xFE //254 -#define NOTE_FADE 0xFD //253, IT's action for illegal notes - DO NOT SAVE AS 253 as this is IT's internal representation of "no note"! -#define NOTE_PC 0xFC //252, Param Control 'note'. Changes param value on first tick. -#define NOTE_PCS 0xFB //251, Param Control(Smooth) 'note'. Changes param value during the whole row. +#define NOTE_MIDDLEC (5 * 12 + 1) +#define NOTE_KEYOFF 0xFF // 255 +#define NOTE_NOTECUT 0xFE // 254 +#define NOTE_FADE 0xFD // 253, IT's action for illegal notes - DO NOT SAVE AS 253 as this is IT's internal representation of "no note"! +#define NOTE_PC 0xFC // 252, Param Control 'note'. Changes param value on first tick. +#define NOTE_PCS 0xFB // 251, Param Control (Smooth) 'note'. Changes param value during the whole row. #define NOTE_MIN 1 #define NOTE_MAX 120 //Defines maximum notevalue(with index starting from 1) as well as maximum number of notes. #define NOTE_MAX_SPECIAL NOTE_KEYOFF #define NOTE_MIN_SPECIAL NOTE_PCS -#define NOTE_IS_VALID(n) ((n) == NOTE_NONE || ((n) >= NOTE_MIN && (n) <= NOTE_MAX)) // Checks whether a number represents a valid note (a "normal" note or no note, but not something like note off) //============== @@ -31,26 +31,26 @@ // Defines the maximum value for column data when interpreted as 2-byte value // (for example volcmd and vol). The valid value range is [0, maxColumnValue]. - enum {maxColumnValue = 999}; + enum { maxColumnValue = 999 }; // Returns empty modcommand. - static MODCOMMAND Empty() {MODCOMMAND m = {0,0,0,0,0,0}; return m;} + static MODCOMMAND Empty() { MODCOMMAND m = {0,0,0,0,0,0}; return m; } bool operator==(const MODCOMMAND& mc) const { return (memcmp(this, &mc, sizeof(MODCOMMAND)) == 0); } bool operator!=(const MODCOMMAND& mc) const { return !(*this == mc); } - void Set(NOTE n, INSTR ins, uint16 volcol, uint16 effectcol) {note = n; instr = ins; SetValueVolCol(volcol); SetValueEffectCol(effectcol);} + void Set(NOTE n, INSTR ins, uint16 volcol, uint16 effectcol) { note = n; instr = ins; SetValueVolCol(volcol); SetValueEffectCol(effectcol); } - uint16 GetValueVolCol() const {return GetValueVolCol(volcmd, vol);} - static uint16 GetValueVolCol(BYTE volcmd, BYTE vol) {return (volcmd << 8) + vol;} - void SetValueVolCol(const uint16 val) {volcmd = static_cast<BYTE>(val >> 8); vol = static_cast<BYTE>(val & 0xFF);} + uint16 GetValueVolCol() const { return GetValueVolCol(volcmd, vol); } + static uint16 GetValueVolCol(BYTE volcmd, BYTE vol) { return (volcmd << 8) + vol; } + void SetValueVolCol(const uint16 val) { volcmd = static_cast<BYTE>(val >> 8); vol = static_cast<BYTE>(val & 0xFF); } - uint16 GetValueEffectCol() const {return GetValueEffectCol(command, param);} - static uint16 GetValueEffectCol(BYTE command, BYTE param) {return (command << 8) + param;} - void SetValueEffectCol(const uint16 val) {command = static_cast<BYTE>(val >> 8); param = static_cast<BYTE>(val & 0xFF);} + uint16 GetValueEffectCol() const { return GetValueEffectCol(command, param); } + static uint16 GetValueEffectCol(BYTE command, BYTE param) { return (command << 8) + param; } + void SetValueEffectCol(const uint16 val) { command = static_cast<BYTE>(val >> 8); param = static_cast<BYTE>(val & 0xFF); } // Clears modcommand. - void Clear() {memset(this, 0, sizeof(MODCOMMAND)); } + void Clear() { memset(this, 0, sizeof(MODCOMMAND)); } // Returns true if modcommand is empty, false otherwise. // If ignoreEffectValues is true (default), effect values are ignored are ignored if there is no effect command present. @@ -63,12 +63,19 @@ } // Returns true if instrument column represents plugin index. - bool IsInstrPlug() const {return IsPcNote();} + bool IsInstrPlug() const { return IsPcNote(); } // Returns true if and only if note is NOTE_PC or NOTE_PCS. bool IsPcNote() const { return note == NOTE_PC || note == NOTE_PCS; } static bool IsPcNote(const NOTE note_id) { return note_id == NOTE_PC || note_id == NOTE_PCS; } + // Returns true if and only if note is a valid musical note. + bool IsNote() const { return note >= NOTE_MIN && note <= NOTE_MAX; } + static bool IsNote(NOTE note) { return note >= NOTE_MIN && note <= NOTE_MAX; } + // Returns true if and only if note is a valid musical note or the note entry is empty. + bool IsNoteOrEmpty() const { return note == NOTE_NONE || IsNote(); } + static bool IsNoteOrEmpty(NOTE note) { return note == NOTE_NONE || IsNote(note); } + // Swap volume and effect column (doesn't do any conversion as it's mainly for importing formats with multiple effect columns, so beware!) void SwapEffects() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |