From: <sag...@us...> - 2010-03-08 17:44:26
|
Revision: 520 http://modplug.svn.sourceforge.net/modplug/?rev=520&view=rev Author: saga-games Date: 2010-03-08 17:44:16 +0000 (Mon, 08 Mar 2010) Log Message: ----------- [Fix] S3M Playback: In ST3, muted channels are completely ignored, not even effects are interpreted. Let's try this in MPT, too. [Fix] Pattern Editor: Find/Replace didn't work properly when replacing PC Notes with something that's not a PC Note. [Ref] Introduced a static version of IsPcNote() to get rid of all the "note == NOTE_PC || note == NOTE_PCS". [Ref] Some more refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/test/test.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-08 17:44:16 UTC (rev 520) @@ -1878,7 +1878,16 @@ if (m_cmdReplace.note == CFindReplaceTab::replaceNotePlusOne) { if (m->note < NOTE_MAX) m->note++; - } else m->note = m_cmdReplace.note; + } else + // Replace with another note + { + // If we're going to remove a PC Note, wipe out the complete column. + if(m->IsPcNote() && !MODCOMMAND::IsPcNote(m_cmdReplace.note)) + { + m->Clear(); + } + m->note = m_cmdReplace.note; + } } if ((m_dwReplaceFlags & PATSEARCH_INSTR)) { @@ -4155,7 +4164,7 @@ const bool bIsLiveRecord = IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile); const bool usePlaybackPosition = (bIsLiveRecord && (CMainFrame::m_dwPatternSetup & PATTERN_AUTODELAY)); //Param control 'note' - if((note == NOTE_PC || note == NOTE_PCS) && bRecordEnabled) + if(MODCOMMAND::IsPcNote(note) && bRecordEnabled) { pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, nChn, nRow, 1, 1); pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, nChn)->note = note; Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-03-08 17:44:16 UTC (rev 520) @@ -1317,7 +1317,7 @@ { combo->ResetContent(); - if(m_nNote == NOTE_PC || m_nNote == NOTE_PCS) + if(MODCOMMAND::IsPcNote(m_nNote)) { // control plugin param note combo->SetItemData(combo->AddString("No Effect"), 0); @@ -1350,7 +1350,7 @@ void CPageEditNote::OnNoteChanged() //--------------------------------- { - bool bWasParamControl = (m_nNote == NOTE_PC || m_nNote == NOTE_PCS) ? true : false; + const bool bWasParamControl = MODCOMMAND::IsPcNote(m_nNote); CComboBox *combo; if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) @@ -1374,7 +1374,7 @@ } } } - bool bIsNowParamControl = (m_nNote == NOTE_PC || m_nNote == NOTE_PCS) ? true : false; + const bool bIsNowParamControl = MODCOMMAND::IsPcNote(m_nNote); if(bWasParamControl != bIsNowParamControl) UpdateDialog(); Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/mptrack/test/test.cpp 2010-03-08 17:44:16 UTC (rev 520) @@ -189,6 +189,10 @@ VERIFY_EQUAL(ConvertStrTo<float>("-87.0"), -87.0); VERIFY_EQUAL(ConvertStrTo<double>("-0.5e-6"), -0.5e-6); VERIFY_EQUAL(ConvertStrTo<double>("58.65403492763"), 58.65403492763); + + VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_MAX), false); + VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_PC), true); + VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_PCS), true); } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-08 17:44:16 UTC (rev 520) @@ -86,7 +86,10 @@ // -> CODE#0022 // -> DESC="alternative BPM/Speed interpretation method" // UINT dwElapsedTime=0, nRow=0, nCurrentPattern=0, nNextPattern=0, nPattern=Order[0]; - UINT nRow=0, nCurrentPattern=0, nNextPattern=0, nPattern=Order[0]; + ROWINDEX nRow = 0; + ORDERINDEX nCurrentPattern = 0; + ORDERINDEX nNextPattern = 0; + PATTERNINDEX nPattern = Order[0]; DOUBLE dwElapsedTime=0.0; // -! NEW_FEATURE#0022 UINT nMusicSpeed=m_nDefaultSpeed, nMusicTempo=m_nDefaultTempo, nNextRow=0; @@ -94,10 +97,10 @@ LONG nGlbVol = m_nDefaultGlobalVolume, nOldGlbVolSlide = 0; BYTE samples[MAX_CHANNELS]; BYTE instr[MAX_CHANNELS]; - BYTE notes[MAX_CHANNELS]; + UINT notes[MAX_CHANNELS]; BYTE vols[MAX_CHANNELS]; BYTE oldparam[MAX_CHANNELS]; - BYTE chnvols[MAX_CHANNELS]; + UINT chnvols[MAX_CHANNELS]; DWORD patloop[MAX_CHANNELS]; memset(instr, 0, sizeof(instr)); @@ -107,7 +110,7 @@ memset(oldparam, 0, sizeof(oldparam)); memset(chnvols, 64, sizeof(chnvols)); memset(samples, 0, sizeof(samples)); - for (UINT icv=0; icv<m_nChannels; icv++) chnvols[icv] = ChnSettings[icv].nVolume; + for(CHANNELINDEX icv = 0; icv < m_nChannels; icv++) chnvols[icv] = ChnSettings[icv].nVolume; nMaxRow = m_nNextRow; nMaxPattern = m_nNextPattern; nCurrentPattern = nNextPattern = 0; @@ -206,7 +209,7 @@ if (!nRow) { for(UINT ipck = 0; ipck < m_nChannels; ipck++) - patloop[ipck] = dwElapsedTime; + patloop[ipck] = (DWORD)dwElapsedTime; } if (!bTotal) { @@ -224,8 +227,10 @@ MODCHANNEL *pChn = Chn; MODCOMMAND *p = Patterns[nPattern] + nRow * m_nChannels; MODCOMMAND *nextRow = NULL; - for (UINT nChn=0; nChn<m_nChannels; p++,pChn++, nChn++) if (*((DWORD *)p)) + for (CHANNELINDEX nChn = 0; nChn < m_nChannels; p++, pChn++, nChn++) if (*((DWORD *)p)) { + if((GetType() == MOD_TYPE_S3M) && (ChnSettings[nChn].dwFlags & CHN_MUTE) != 0) // not even effects are processed on muted S3M channels + continue; UINT command = p->command; UINT param = p->param; UINT note = p->note; @@ -237,7 +242,7 @@ // Position Jump case CMD_POSITIONJUMP: positionJumpOnThisRow=true; - nNextPattern = param; + nNextPattern = (ORDERINDEX)param; // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx if (!patternBreakOnThisRow || (GetType() == MOD_TYPE_XM)) { nNextRow = 0; @@ -283,7 +288,7 @@ case CMD_TEMPO: if ((bAdjust) && (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT | MOD_TYPE_MPT))) { - if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo; + if (param) pChn->nOldTempo = (BYTE)param; else param = pChn->nOldTempo; } if (param >= 0x20) nMusicTempo = param; else // Tempo Slide @@ -312,7 +317,7 @@ if ((param & 0xF0) == 0x60) { if (param & 0x0F) dwElapsedTime += (dwElapsedTime - patloop[nChn]) * (param & 0x0F); - else patloop[nChn] = dwElapsedTime; + else patloop[nChn] = (DWORD)dwElapsedTime; } break; case CMD_XFINEPORTAUPDOWN: @@ -1162,8 +1167,10 @@ // -> DESC="add extended parameter mechanism to pattern effects" MODCOMMAND* m = nullptr; // -! NEW_FEATURE#0010 - for (UINT nChn=0; nChn<m_nChannels; nChn++, pChn++) + for (CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++, pChn++) { + if((GetType() == MOD_TYPE_S3M) && (ChnSettings[nChn].dwFlags & CHN_MUTE) != 0) // not even effects are processed on muted S3M channels + continue; UINT instr = pChn->nRowInstr; UINT volcmd = pChn->nRowVolCmd; UINT vol = pChn->nRowVolume; @@ -1224,7 +1231,7 @@ // Apart from changing parameters, parameter control notes are intended to be 'invisible'. // To achieve this, clearing the note data so that rest of the process sees the row as empty row. - if(pChn->nRowNote == NOTE_PC || pChn->nRowNote == NOTE_PCS) + if(MODCOMMAND::IsPcNote(pChn->nRowNote)) { pChn->ClearRowCmd(); instr = 0; @@ -3980,4 +3987,4 @@ pChn->nOldFinePortaUpDown = abs(tickParam); pChn->m_CalculateFreq = true; -} +} \ No newline at end of file Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-08 17:44:16 UTC (rev 520) @@ -1535,7 +1535,7 @@ df2 = LinearSlideDownTable[n1+1]; } n >>= 2; - period = _muldiv(period, df1 + ((df2-df1)*(n&0x3F)>>6), 256); + period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256); nPeriodFrac = period & 0xFF; period >>= 8; } else @@ -1962,7 +1962,7 @@ // Previously this function took modcommand directly from pattern. ASSERT is there // to detect possible behaviour change now that the data is accessed from channel. const MODCOMMAND mc = *Patterns[m_nPattern].GetpModCommand(m_nRow, static_cast<CHANNELINDEX>(nChn)); - ASSERT( mc.note == NOTE_PC || mc.note == NOTE_PCS || + ASSERT( mc.IsPcNote() || (note == mc.note && instr == mc.instr && volcmd == mc.volcmd && vol == mc.vol)); } @@ -2122,4 +2122,3 @@ } } - Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2010-03-08 14:26:04 UTC (rev 519) +++ trunk/OpenMPT/soundlib/modcommand.h 2010-03-08 17:44:16 UTC (rev 520) @@ -59,6 +59,7 @@ // 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(MODCOMMAND::NOTE note_id) {return note_id == NOTE_PC || note_id == NOTE_PCS;} // 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. |
From: <sag...@us...> - 2010-03-09 18:43:02
|
Revision: 521 http://modplug.svn.sourceforge.net/modplug/?rev=521&view=rev Author: saga-games Date: 2010-03-09 18:42:49 +0000 (Tue, 09 Mar 2010) Log Message: ----------- [Mod] Installer: Changed project URL again, now that there's at least a nice "in progress" site at openmpt.com [Ref] Some more explanations for the compatibility fixes Modified Paths: -------------- trunk/OpenMPT/installer/install.iss trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2010-03-08 17:44:16 UTC (rev 520) +++ trunk/OpenMPT/installer/install.iss 2010-03-09 18:42:49 UTC (rev 521) @@ -9,9 +9,9 @@ AppVersion=1.18.00.00 AppName=OpenMPT AppPublisher=OpenMPT Devs / Olivier Lapicque -AppPublisherURL=http://www.modplug.com/ -AppSupportURL=http://www.modplug.com/ -AppUpdatesURL=http://www.modplug.com/ +AppPublisherURL=http://www.openmpt.com/ +AppSupportURL=http://www.openmpt.com/ +AppUpdatesURL=http://www.openmpt.com/ DefaultDirName={pf}\OpenMPT DefaultGroupName=OpenMPT AllowNoIcons=yes @@ -142,3 +142,4 @@ #include "vst_scan.iss" + Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-08 17:44:16 UTC (rev 520) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-09 18:42:49 UTC (rev 521) @@ -301,7 +301,7 @@ } // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" - if(IsCompatibleMode(TRK_ALLTRACKERS)) + if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode nMusicTempo = CLAMP(nMusicTempo, 32, 255); else nMusicTempo = CLAMP(nMusicTempo, GetModSpecifications().tempoMin, GetModSpecifications().tempoMax); @@ -321,6 +321,7 @@ } break; case CMD_XFINEPORTAUPDOWN: + // ignore high offset in compatible mode if (((param & 0xF0) == 0xA0) && !IsCompatibleMode(TRK_FASTTRACKER2)) pChn->nOldHiOffset = param & 0x0F; break; } @@ -474,7 +475,7 @@ MODSAMPLE *pSmp = &Samples[instr]; UINT note = pChn->nNewNote; - if(note == 0 && IsCompatibleMode(TRK_IMPULSETRACKER)) return; + if(note == NOTE_NONE && IsCompatibleMode(TRK_IMPULSETRACKER)) return; if ((pIns) && (note) && (note <= 128)) { @@ -768,11 +769,13 @@ // Handle "retrigger" waveform type if (pChn->nVibratoType < 4) { + // IT Compatibilty: Slightly different waveform offsets (why does MPT have two different offsets here with IT old effects enabled and disabled?) if(!IsCompatibleMode(TRK_IMPULSETRACKER) && (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))) pChn->nVibratoPos = 0x10; else pChn->nVibratoPos = 0; } + // IT Compatibility: No "retrigger" waveform here if(!IsCompatibleMode(TRK_IMPULSETRACKER) && pChn->nTremoloType < 4) { pChn->nTremoloPos = 0; @@ -812,9 +815,10 @@ pChn->nLeftVU = pChn->nRightVU = 0xFF; pChn->dwFlags &= ~CHN_FILTER; pChn->dwFlags |= CHN_FASTVOLRAMP; + //IT compatibility 15. Retrigger will not be reset (Tremor doesn't store anything here, so we just don't reset this as well) if(!IsCompatibleMode(TRK_IMPULSETRACKER)) { - //IT compatibility 15. Retrigger will not be reset (Tremor doesn't store anything here, so we just don't reset this as well) + // XM compatibility: FT2 also doesn't reset retrigger if(!IsCompatibleMode(TRK_FASTTRACKER2)) pChn->nRetrigCount = 0; pChn->nTremorCount = 0; } @@ -824,6 +828,7 @@ pChn->nResSwing = pChn->nCutSwing = 0; if (pIns) { + // IT compatibility tentative fix: Reset NNA action on every new note, even without instrument number next to note (fixes spx-farspacedance.it, but is this actually 100% correct?) if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nNNA = pIns->nNNA; if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->nVolEnvPosition = 0; if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->nPanEnvPosition = 0; @@ -833,6 +838,7 @@ // Volume Swing if (pIns->nVolSwing) { + // IT compatibility: MPT has a weird vol swing algorithm.... if(IsCompatibleMode(TRK_IMPULSETRACKER)) { double d = 2 * (((double) rand()) / RAND_MAX) - 1; @@ -846,6 +852,7 @@ // Pan Swing if (pIns->nPanSwing) { + // IT compatibility: MPT has a weird pan swing algorithm.... if(IsCompatibleMode(TRK_IMPULSETRACKER)) { double d = 2 * (((double) rand()) / RAND_MAX) - 1; @@ -883,7 +890,8 @@ { if (pIns->nIFR & 0x80) { pChn->nResonance = pIns->nIFR & 0x7F; bFlt = true; } if (pIns->nIFC & 0x80) { pChn->nCutOff = pIns->nIFC & 0x7F; bFlt = true; } - if (bFlt && (pIns->nFilterMode != FLTMODE_UNCHANGED)) { + if (bFlt && (pIns->nFilterMode != FLTMODE_UNCHANGED)) + { pChn->nFilterMode = pIns->nFilterMode; } } else @@ -999,22 +1007,22 @@ applyDNAtoPlug = false; //rewbs.VSTiNNA if (((p->nMasterChn == nChn+1) || (p == pChn)) && (p->pModInstrument)) { - BOOL bOk = FALSE; + bool bOk = false; // Duplicate Check Type switch(p->pModInstrument->nDCT) { // Note case DCT_NOTE: - if ((note) && (p->nNote == note) && (pHeader == p->pModInstrument)) bOk = TRUE; + if ((note) && (p->nNote == note) && (pHeader == p->pModInstrument)) bOk = true; if (pHeader && pHeader->nMixPlug) applyDNAtoPlug = true; //rewbs.VSTiNNA break; // Sample case DCT_SAMPLE: - if ((pSample) && (pSample == p->pSample)) bOk = TRUE; + if ((pSample) && (pSample == p->pSample)) bOk = true; break; // Instrument case DCT_INSTRUMENT: - if (pHeader == p->pModInstrument) bOk = TRUE; + if (pHeader == p->pModInstrument) bOk = true; //rewbs.VSTiNNA if (pHeader && pHeader->nMixPlug) applyDNAtoPlug = true; break; @@ -1023,7 +1031,7 @@ if (pHeader && (pHeader->nMixPlug) && (pHeader->nMixPlug == p->pModInstrument->nMixPlug)) { applyDNAtoPlug = true; - bOk = TRUE; + bOk = true; } //end rewbs.VSTiNNA break; @@ -1504,6 +1512,7 @@ break; case VOLCMD_VIBRATOSPEED: + // FT2 does not automatically enable vibrato with the "set vibrato speed" command if(IsCompatibleMode(TRK_FASTTRACKER2)) pChn->nVibratoSpeed = vol & 0x0F; else @@ -1523,7 +1532,7 @@ break; case VOLCMD_PORTAUP: - //IT compatibility (one of the first - link effect memory) + //IT compatibility (one of the first testcases - link effect memory) if(IsCompatibleMode(TRK_IMPULSETRACKER)) PortamentoUp(pChn, vol << 2, true); else @@ -1531,7 +1540,7 @@ break; case VOLCMD_PORTADOWN: - //IT compatibility (one of the first - link effect memory) + //IT compatibility (one of the first testcases - link effect memory) if(IsCompatibleMode(TRK_IMPULSETRACKER)) PortamentoDown(pChn, vol << 2, true); else @@ -1646,7 +1655,7 @@ // Arpeggio case CMD_ARPEGGIO: - // IT compatibility 01. Don't ignore Arpeggio if no note is playing + // 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) && (!(m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)))) break; pChn->nCommand = CMD_ARPEGGIO; @@ -1661,9 +1670,9 @@ if (!(param & 0x0F)) param |= pChn->nRetrigParam & 0x0F; param |= 0x100; // increment retrig count on first row } + // IT compatibility 15. Retrigger if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - // IT compatibility 15. Retrigger if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); @@ -1694,17 +1703,16 @@ case CMD_TREMOR: if (!(m_dwSongFlags & SONG_FIRSTTICK)) break; + // IT compatibility 12. / 13. Tremor (using modified DUMB's Tremor logic here because of old effects - http://dumb.sf.net/) if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - // IT compatibility 12. / 13. Tremor (using modified DUMB's Tremor logic here because of old effects - http://dumb.sf.net/) - - if (param && !(m_dwSongFlags & SONG_ITOLDEFFECTS)) { + if (param && !(m_dwSongFlags & SONG_ITOLDEFFECTS)) + { // Old effects have different length interpretation (+1 for both on and off) if (param & 0xf0) param -= 0x10; if (param & 0x0f) param -= 0x01; } pChn->nTremorCount |= 128; // set on/off flag - } else { @@ -1721,9 +1729,9 @@ if (!(m_dwSongFlags & SONG_FIRSTTICK)) break; if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; + //IT compatibility 16. Both FT2 and IT ignore out-of-range values if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) { - //IT compatibility 16. Both FT2 and IT ignore out-of-range values if (param <= 128) m_nGlobalVolume = param << 1; } @@ -1795,9 +1803,9 @@ // Key Off case CMD_KEYOFF: + // This is how Key Off is supposed to sound... (in FT2 at least) if(IsCompatibleMode(TRK_FASTTRACKER2)) { - // This is how it's supposed to sound... (in FT2) if (m_nTickCount == param) { // XM: Key-Off + Sample == Note Cut @@ -1816,9 +1824,9 @@ KeyOff(nChn); } } + // This is how it's NOT supposed to sound... else { - // This is how it's NOT supposed to sound... if(m_dwSongFlags & SONG_FIRSTTICK) KeyOff(nChn); } @@ -1830,7 +1838,7 @@ { case 0x10: ExtraFinePortamentoUp(pChn, param & 0x0F); break; case 0x20: ExtraFinePortamentoDown(pChn, param & 0x0F); break; - // Modplug XM Extensions + // Modplug XM Extensions (ignore in compatible mode) case 0x50: case 0x60: case 0x70: @@ -1866,9 +1874,9 @@ { pChn->nVolEnvPosition = param; + // XM compatibility: FT2 only sets the position of the Volume envelope if(!IsCompatibleMode(TRK_FASTTRACKER2)) { - // FT2 only sets the position of the Volume envelope pChn->nPanEnvPosition = param; pChn->nPitchEnvPosition = param; if (pChn->pModInstrument) @@ -2000,9 +2008,11 @@ //end rewbs.fix && ((nPosJump != (int)m_nCurrentPattern) || (nBreakRow != (int)m_nRow))) { + // IT compatibility: don't reset loop count on pattern break if (nPosJump != (int)m_nCurrentPattern && !IsCompatibleMode(TRK_IMPULSETRACKER)) { - for (UINT i=0; i<m_nChannels; i++) Chn[i].nPatternLoopCount = 0; + for (CHANNELINDEX i = 0; i < m_nChannels; i++) + Chn[i].nPatternLoopCount = 0; } m_nNextPattern = nPosJump; m_nNextRow = (UINT)nBreakRow; @@ -2478,6 +2488,7 @@ { if (param & 0x0F) nPanSlide = -(int)((param & 0x0F) << 2); else nPanSlide = (int)((param & 0xF0) >> 2); + // XM compatibility: FT2's panning slide is not as deep if(IsCompatibleMode(TRK_FASTTRACKER2)) nPanSlide >>= 2; } @@ -2644,6 +2655,7 @@ pChn->nVibratoType = param & 0x03; } else { + // IT compatibility: Ignore waveform types > 3 if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nVibratoType = (param < 0x04) ? param : 0; else @@ -2656,6 +2668,7 @@ pChn->nTremoloType = param & 0x03; } else { + // IT compatibility: Ignore waveform types > 3 if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nTremoloType = (param < 0x04) ? param : 0; else @@ -2663,7 +2676,9 @@ } break; // S5x: Set Panbrello Waveform - case 0x50: if(IsCompatibleMode(TRK_IMPULSETRACKER)) + case 0x50: + // IT compatibility: Ignore waveform types > 3 + if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPanbrelloType = (param < 0x04) ? param : 0; else pChn->nPanbrelloType = param & 0x07; @@ -2727,6 +2742,7 @@ // S8x: Set 4-bit Panning case 0x80: if(m_dwSongFlags & SONG_FIRSTTICK) { + // IT Compatibility (and other trackers as well): panning disables surround (unless panning in rear channels is enabled, which is not supported by the original trackers anyway) if(IsCompatibleMode(TRK_ALLTRACKERS)) { if (!(m_dwSongFlags & SONG_SURROUNDPAN)) pChn->dwFlags &= ~CHN_SURROUND; @@ -3215,15 +3231,19 @@ { // IT Compatibility: Offset if(IsCompatibleMode(TRK_IMPULSETRACKER)) + { if(m_dwSongFlags & SONG_ITOLDEFFECTS) pChn->nPos = pChn->nLength; // Old FX: Clip to end of sample else pChn->nPos = 0; // Reset to beginning of sample + } else + { pChn->nPos = pChn->nLoopStart; - if ((m_dwSongFlags & SONG_ITOLDEFFECTS) && (pChn->nLength > 4)) - { - pChn->nPos = pChn->nLength - 2; + if ((m_dwSongFlags & SONG_ITOLDEFFECTS) && (pChn->nLength > 4)) + { + pChn->nPos = pChn->nLength - 2; + } } } else if(IsCompatibleMode(TRK_FASTTRACKER2)) { @@ -3251,9 +3271,9 @@ int nRetrigCount = pChn->nRetrigCount; bool bDoRetrig = false; + //IT compatibility 15. Retrigger if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - //IT compatibility 15. Retrigger if ((m_dwSongFlags & SONG_FIRSTTICK) && pChn->nRowNote) { pChn->nRetrigCount = param & 0xf; @@ -3264,10 +3284,9 @@ bDoRetrig = true; } } + // buggy-like-hell FT2 Rxy retrig! else if(IsCompatibleMode(TRK_FASTTRACKER2) && (param & 0x100)) { - // buggy-like-hell FT2 Rxy retrig! - if(m_dwSongFlags & SONG_FIRSTTICK) { // here are some really stupid things FT2 does @@ -3344,12 +3363,14 @@ } if (param < 0x100) bResetEnv = true; } + // IT compatibility: Really weird combination of envelopes and retrigger (see Storlek's q.it testcase) NoteChange(nChn, nNote, IsCompatibleMode(TRK_IMPULSETRACKER) ? true : false, bResetEnv); if (m_nInstruments) { ProcessMidiOut(nChn, pChn); //Send retrig to Midi } if ((m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!pChn->nRowNote) && (nOldPeriod)) pChn->nPeriod = nOldPeriod; if (!(m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) nRetrigCount = 0; + // IT compatibility: see previous IT compatibility comment =) if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPos = pChn->nPosLo = 0; if (offset) //rewbs.volOffset: apply offset on retrig @@ -3363,6 +3384,7 @@ // buggy-like-hell FT2 Rxy retrig! if(IsCompatibleMode(TRK_FASTTRACKER2) && (param & 0x100)) nRetrigCount++; + // Now we can also store the retrig value for IT... if(!IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nRetrigCount = (BYTE)nRetrigCount; } @@ -3548,7 +3570,7 @@ // -> CODE#0016 // -> DESC="default tempo update" - if(IsCompatibleMode(TRK_ALLTRACKERS)) + if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode m_nMusicTempo = CLAMP(m_nMusicTempo, 32, 255); else m_nMusicTempo = CLAMP(m_nMusicTempo, specs.tempoMin, specs.tempoMax); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-08 17:44:16 UTC (rev 520) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-09 18:42:49 UTC (rev 521) @@ -988,15 +988,19 @@ if (pChn->dwFlags & CHN_TREMOLO) { UINT trempos = pChn->nTremoloPos; + // IT compatibility: Why would want to not execute tremolo at volume 0? if (vol > 0 || IsCompatibleMode(TRK_IMPULSETRACKER)) { + // IT compatibility: We don't need a different attenuation here because of the different tables we're going to use const int tremattn = (m_nType & MOD_TYPE_XM || IsCompatibleMode(TRK_IMPULSETRACKER)) ? 5 : 6; switch (pChn->nTremoloType & 0x03) { case 1: + // IT compatibility: IT has its own, more precise tables vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[trempos] : ModRampDownTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn; break; case 2: + // IT compatibility: IT has its own, more precise tables vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[trempos] : ModSquareTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn; break; case 3: @@ -1007,11 +1011,13 @@ vol += (ModRandomTable[trempos] * (int)pChn->nTremoloDepth) >> tremattn; break; default: + // IT compatibility: IT has its own, more precise tables vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[trempos] : ModSinusTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn; } } if ((m_nTickCount) || ((m_nType & (MOD_TYPE_STM|MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS)))) { + // IT compatibility: IT has its own, more precise tables if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nTremoloPos = (pChn->nTremoloPos + 4 * pChn->nTremoloSpeed) & 0xFF; else @@ -1022,10 +1028,9 @@ // Tremor if(pChn->nCommand == CMD_TREMOR) { + // IT compatibility 12. / 13.: Tremor if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - // IT compatibility 12. / 13.: Tremor - if ((pChn->nTremorCount & 128) && pChn->nLength) { if (pChn->nTremorCount == 128) pChn->nTremorCount = (pChn->nTremorParam >> 4) | 192; @@ -1157,6 +1162,7 @@ { // PPS value is 1/512, i.e. PPS=1 will adjust by 8/512 = 1/64 for each 8 semitones // with PPS = 32 / PPC = C-5, E-6 will pan hard right (and D#6 will not) + // IT compatibility: IT has a wider pan range here int pandelta = (int)pChn->nRealPan + (int)((int)(pChn->nNote - pIns->nPPC - 1) * (int)pIns->nPPS) / (int)(IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 8); pChn->nRealPan = CLAMP(pandelta, 0, 256); } @@ -1227,7 +1233,8 @@ } } } - else if(IsCompatibleMode(TRK_FASTTRACKER2)) // FastTracker 2 + // FastTracker 2: Swedish tracker logic (TM) arpeggio + else if(IsCompatibleMode(TRK_FASTTRACKER2)) { BYTE note = pChn->nNote; int arpPos = 0; @@ -1249,7 +1256,8 @@ period = GetPeriodFromNote(note, pChn->nFineTune, pChn->nC5Speed); } - else // Other trackers + // Other trackers + else { switch(m_nTickCount % 3) { @@ -1347,9 +1355,11 @@ switch (pChn->nVibratoType & 0x03) { case 1: + // IT compatibility: IT has its own, more precise tables vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[vibpos] : ModRampDownTable[vibpos]; break; case 2: + // IT compatibility: IT has its own, more precise tables vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[vibpos] : ModSquareTable[vibpos]; break; case 3: @@ -1360,6 +1370,7 @@ vdelta = ModRandomTable[vibpos]; break; default: + // IT compatibility: IT has its own, more precise tables vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[vibpos] : ModSinusTable[vibpos]; } @@ -1377,8 +1388,10 @@ else //Original behavior { UINT vdepth; + // IT compatibility: correct vibrato depth if(IsCompatibleMode(TRK_IMPULSETRACKER)) { + // Yes, vibrato goes backwards with old effects enabled! if(m_dwSongFlags & SONG_ITOLDEFFECTS) { vdepth = 5; @@ -1411,6 +1424,7 @@ } if ((m_nTickCount) || ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS)))) { + // IT compatibility: IT has its own, more precise tables if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nVibratoPos = (vibpos + 4 * pChn->nVibratoSpeed) & 0xFF; else @@ -1421,6 +1435,7 @@ if (pChn->dwFlags & CHN_PANBRELLO) { UINT panpos; + // IT compatibility: IT has its own, more precise tables if(IsCompatibleMode(TRK_IMPULSETRACKER)) panpos = pChn->nPanbrelloPos & 0xFF; else @@ -1429,9 +1444,11 @@ switch (pChn->nPanbrelloType & 0x03) { case 1: + // IT compatibility: IT has its own, more precise tables pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[panpos] : ModRampDownTable[panpos]; break; case 2: + // IT compatibility: IT has its own, more precise tables pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[panpos] : ModSquareTable[panpos]; break; case 3: @@ -1442,6 +1459,7 @@ pdelta = ModRandomTable[panpos]; break; default: + // IT compatibility: IT has its own, more precise tables pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[panpos] : ModSinusTable[panpos]; } pChn->nPanbrelloPos += pChn->nPanbrelloSpeed; @@ -1457,6 +1475,7 @@ { MODSAMPLE *pSmp = pChn->pModSample; + // IT compatibility: No vibrato sweep = No vibrato at all! if (pSmp->nVibSweep == 0 && !IsCompatibleMode(TRK_IMPULSETRACKER)) { pChn->nAutoVibDepth = pSmp->nVibDepth << 8; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-11 22:59:00
|
Revision: 524 http://modplug.svn.sourceforge.net/modplug/?rev=524&view=rev Author: saga-games Date: 2010-03-11 22:58:51 +0000 (Thu, 11 Mar 2010) Log Message: ----------- [Fix] Pattern Editor: When recording plug param changes to the pattern, the wrong pattern rows were invalidated because the pattern display did not move. [Imp] S3M Compatibility: At least process samples on muted channels so that sync can be maintained. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-09 22:16:06 UTC (rev 523) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-11 22:58:51 UTC (rev 524) @@ -2999,7 +2999,7 @@ if(pRow->IsEmpty() || pRow->IsPcNote()) { pRow->Set(NOTE_PCS, plugSlot + 1, paramIndex, static_cast<uint16>(pPlug->GetParameter(paramIndex) * MODCOMMAND::maxColumnValue)); - InvalidateRow(); + InvalidateRow(nRow); } } else { @@ -3021,7 +3021,7 @@ if (pRow->command == 0 || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) { //we overwrite existing Zxx and \xx only. pRow->command = (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))?CMD_S3MCMDEX:CMD_MODCMDEX;; pRow->param = 0xF0 + (foundMacro&0x0F); - InvalidateRow(); + InvalidateRow(nRow); } } @@ -3031,7 +3031,7 @@ if (pRow->command == CMD_NONE || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) { pRow->command = CMD_SMOOTHMIDI; pRow->param = pPlug->GetZxxParameter(paramIndex); - InvalidateRow(); + InvalidateRow(nRow); } } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-09 22:16:06 UTC (rev 523) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-11 22:58:51 UTC (rev 524) @@ -1177,8 +1177,6 @@ // -! NEW_FEATURE#0010 for (CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++, pChn++) { - if((GetType() == MOD_TYPE_S3M) && (ChnSettings[nChn].dwFlags & CHN_MUTE) != 0) // not even effects are processed on muted S3M channels - continue; UINT instr = pChn->nRowInstr; UINT volcmd = pChn->nRowVolCmd; UINT vol = pChn->nRowVolume; @@ -1462,6 +1460,8 @@ #endif // MODPLUG_TRACKER } + if((GetType() == MOD_TYPE_S3M) && (ChnSettings[nChn].dwFlags & CHN_MUTE) != 0) // not even effects are processed on muted S3M channels + continue; // Volume Column Effect (except volume & panning) /* A few notes, paraphrased from ITTECH.TXT by Storlek (creator of schismtracker): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-14 18:43:37
|
Revision: 532 http://modplug.svn.sourceforge.net/modplug/?rev=532&view=rev Author: saga-games Date: 2010-03-14 18:43:27 +0000 (Sun, 14 Mar 2010) Log Message: ----------- [Fix] Comments tab: Correct C-5 frequency is now also shown if the module is an XM file. [Fix] Slightly better MT2 (MadTracker) handling: Release node is not set anymore for each and every instrument envelope. MT2 files are now loaded as IT files by default (instead of XM) because of their extended instrument properties (NNAs, filters, etc) - I wonder what this breaks, but I don't bother because MT2 support was already 100% broken before this. :) Some MT example tunes sound a bit better now at least. [Imp] Pattern Editor: Since the behaviour of sliding commands with both nibbles set varies from tracker to tracker, "undefined" is always shown in the note properties in such cases. [Imp] Module creation: When creating a new .MOD, it has 31 samples by default. [Ref] IsPortable is now static. [Ref] Some minor refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/soundlib/Load_mt2.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -338,14 +338,15 @@ case MOD_TYPE_OKT: case MOD_TYPE_AMS: case MOD_TYPE_MT2: - m_SndFile.ChangeModTypeTo(MOD_TYPE_XM); + m_SndFile.ChangeModTypeTo(MOD_TYPE_IT); + /*m_SndFile.ChangeModTypeTo(MOD_TYPE_XM); if ((m_SndFile.m_nDefaultTempo == 125) && (m_SndFile.m_nDefaultSpeed == 6) && (!m_SndFile.m_nInstruments)) { m_SndFile.m_nType = MOD_TYPE_MOD; for (UINT i=0; i<m_SndFile.Patterns.Size(); i++) if ((m_SndFile.Patterns[i]) && (m_SndFile.PatternSize[i] != 64)) m_SndFile.m_nType = MOD_TYPE_XM; - } + }*/ break; case MOD_TYPE_FAR: case MOD_TYPE_PTM: @@ -654,7 +655,7 @@ m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 128; } - for (CHANNELINDEX nChn=0; nChn < MAX_BASECHANNELS; nChn++) + for (CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++) { m_SndFile.ChnSettings[nChn].dwFlags = 0; m_SndFile.ChnSettings[nChn].nVolume = 64; @@ -667,7 +668,7 @@ if (!m_SndFile.m_nSamples) { strcpy(m_SndFile.m_szNames[1], "untitled"); - m_SndFile.m_nSamples = 1; + m_SndFile.m_nSamples = (GetModType() == MOD_TYPE_MOD) ? 31 : 1; ctrlSmp::ResetSamples(m_SndFile, ctrlSmp::SmpResetInit); @@ -2523,6 +2524,10 @@ { wsprintf(s, "fine %s%d", sMinusChar.c_str(), param & 0x0F); } else + if ((param & 0x0F) != param && (param & 0xF0) != param) // both nibbles are set. + { + strcpy(s, "undefined"); + } else if (param & 0x0F) { wsprintf(s, "%s%d", sMinusChar.c_str(), param & 0x0F); @@ -2946,6 +2951,7 @@ } int CModDoc::GetMacroType(CString value) +//-------------------------------------- { if (value.Compare("")==0) return sfx_unused; if (value.Compare("F0F000z")==0) return sfx_cutoff; @@ -2960,6 +2966,7 @@ } int CModDoc::MacroToPlugParam(CString macro) +//------------------------------------------ { int code=0; char* param = (char *) (LPCTSTR) macro; @@ -2975,7 +2982,9 @@ return (code+128); } } -int CModDoc::MacroToMidiCC(CString macro) { +int CModDoc::MacroToMidiCC(CString macro) +//--------------------------------------- +{ int code=0; char* param = (char *) (LPCTSTR) macro; param +=2; @@ -2987,8 +2996,9 @@ return code; } -int CModDoc::FindMacroForParam(long param) { -//------------------------------------------ +int CModDoc::FindMacroForParam(long param) +//---------------------------------------- +{ for (int macro=0; macro<16; macro++) { //what's the named_const for num macros?? :D CString macroString = &(GetSoundFile()->m_MidiCfg.szMidiSFXExt[macro*32]); if (GetMacroType(macroString) == sfx_plug && MacroToPlugParam(macroString) == param) { Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -253,6 +253,7 @@ TCHAR CTrackApp::m_szExePath[_MAX_PATH] = TEXT(""); +bool CTrackApp::m_bPortableMode = false; ///////////////////////////////////////////////////////////////////////////// // MPTRACK Command Line options Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-14 18:43:27 UTC (rev 532) @@ -158,7 +158,7 @@ TCHAR m_szConfigFileName[_MAX_PATH]; TCHAR m_szPluginCacheFileName[_MAX_PATH]; TCHAR m_szStringsFileName[_MAX_PATH]; - bool m_bPortableMode; + static bool m_bPortableMode; #ifdef UPDATECHECKENABLED // Internet request context @@ -202,7 +202,7 @@ BOOL IsWaveExEnabled() const { return m_bExWaveSupport; } BOOL IsDebug() const { return m_bDebugMode; } LPCSTR GetConfigFileName() const { return m_szConfigFileName; } - bool IsPortableMode() const { return m_bPortableMode; } + static bool IsPortableMode() { return m_bPortableMode; } LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; } LPCSTR GetConfigPath() const { return m_szConfigDirectory; } void SetupPaths(); Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -223,28 +223,12 @@ UINT CViewInstrument::EnvGetTick(int nPoint) const //------------------------------------------------ { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if ((pIns) && (nPoint >= 0)) - { - switch(m_nEnv) - { - case ENV_VOLUME: - if (nPoint < (int)pIns->VolEnv.nNodes) return pIns->VolEnv.Ticks[nPoint]; - break; - case ENV_PANNING: - if (nPoint < (int)pIns->PanEnv.nNodes) return pIns->PanEnv.Ticks[nPoint]; - break; - case ENV_PITCH: - if (nPoint < (int)pIns->PitchEnv.nNodes) return pIns->PitchEnv.Ticks[nPoint]; - break; - } - } - } - return 0; + INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); + if(envelope == nullptr) return 0; + if((nPoint >= 0) && (nPoint < (int)envelope->nNodes)) + return envelope->Ticks[nPoint]; + else + return 0; } @@ -253,8 +237,10 @@ { INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); if(envelope == nullptr) return 0; - if(nPoint >= 0 && nPoint < (int)envelope->nNodes) return envelope->Values[nPoint]; - return 0; + if(nPoint >= 0 && nPoint < (int)envelope->nNodes) + return envelope->Values[nPoint]; + else + return 0; } Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/mptrack/view_com.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -298,7 +298,7 @@ { wsprintf(s, "%d Hz", pSndFile->GetFreqFromPeriod( - pSndFile->GetPeriodFromNote(NOTE_MIDDLEC, pSmp->nFineTune, pSmp->nC5Speed), + pSndFile->GetPeriodFromNote(NOTE_MIDDLEC + pSmp->RelativeTone, pSmp->nFineTune, pSmp->nC5Speed), pSmp->nC5Speed)); } break; Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -124,7 +124,7 @@ #pragma pack() -static VOID ConvertMT2Command(CSoundFile *that, MODCOMMAND *m, MT2COMMAND *p) +static void ConvertMT2Command(CSoundFile *that, MODCOMMAND *m, MT2COMMAND *p) //--------------------------------------------------------------------------- { // Note @@ -172,6 +172,7 @@ m->command = p->fxparam2; m->param = p->fxparam1; that->ConvertModCommand(m); + that->MODExx2S3MSxx(m); } else { // TODO: MT2 Effects @@ -200,6 +201,7 @@ m_nRestartPos = pfh->wRestart; m_nDefaultSpeed = pfh->bTicksPerLine; m_nDefaultTempo = 125; + m_dwSongFlags = SONG_ITCOMPATMODE; if ((pfh->wSamplesPerTick > 100) && (pfh->wSamplesPerTick < 5000)) { m_nDefaultTempo = 110250 / pfh->wSamplesPerTick; @@ -406,9 +408,9 @@ Instruments[iIns] = pIns; if (pIns) { - memset(pIns, 0, sizeof(MODINSTRUMENT)); + memcpy(Instruments[iIns], &m_defaultInstrument, sizeof(MODINSTRUMENT)); memcpy(pIns->name, pmi->szName, 32); - SpaceToNullStringFixed(pIns->name, 32); + SpaceToNullStringFixed(pIns->name, 31); pIns->nGlobalVol = 64; pIns->nPan = 128; for (BYTE i = 0; i < NOTE_MAX; i++) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-14 14:26:37 UTC (rev 531) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-14 18:43:27 UTC (rev 532) @@ -1414,7 +1414,7 @@ return MOD_TYPE_MOD; if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_STM|MOD_TYPE_ULT|MOD_TYPE_FAR|MOD_TYPE_PTM)) return MOD_TYPE_S3M; - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MTM|MOD_TYPE_MT2)) + if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MTM/*|MOD_TYPE_MT2*/)) return MOD_TYPE_XM; if(m_nType & MOD_TYPE_MPT) return MOD_TYPE_MPT; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-15 20:28:07
|
Revision: 533 http://modplug.svn.sourceforge.net/modplug/?rev=533&view=rev Author: saga-games Date: 2010-03-15 20:27:57 +0000 (Mon, 15 Mar 2010) Log Message: ----------- [Imp] MT2 Loader: Make use of the "lines per beat" header field. [Imp] VST Editor: Added shortcuts for "toggle bypass", "pass keys to plug" and "record params to pattern" [Mod] Keymaps: Updated DE_jojo.mkb with the new VST Editor shortcuts. Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb trunk/OpenMPT/soundlib/Load_mt2.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-03-14 18:43:27 UTC (rev 532) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-03-15 20:27:57 UTC (rev 533) @@ -311,13 +311,14 @@ switch(wParam) { - case kcVSTGUIPrevPreset: OnSetPreviousVSTPreset(); return wParam; - case kcVSTGUIPrevPresetJump:OnVSTPresetBackwardJump(); return wParam; - case kcVSTGUINextPreset: OnSetNextVSTPreset(); return wParam; - case kcVSTGUINextPresetJump:OnVSTPresetForwardJump(); return wParam; - case kcVSTGUIRandParams: OnRandomizePreset() ; return wParam; - - + case kcVSTGUIPrevPreset: OnSetPreviousVSTPreset(); return wParam; + case kcVSTGUIPrevPresetJump: OnVSTPresetBackwardJump(); return wParam; + case kcVSTGUINextPreset: OnSetNextVSTPreset(); return wParam; + case kcVSTGUINextPresetJump: OnVSTPresetForwardJump(); return wParam; + case kcVSTGUIRandParams: OnRandomizePreset() ; return wParam; + case kcVSTGUIToggleRecordParams: OnRecordAutomation(); return wParam; + case kcVSTGUIToggleSendKeysToPlug: OnPassKeypressesToPlug(); return wParam; + case kcVSTGUIBypassPlug: OnBypassPlug(); return wParam; } if (wParam>=kcVSTGUIStartNotes && wParam<=kcVSTGUIEndNotes) { @@ -590,21 +591,22 @@ void CAbstractVstEditor::UpdateOptionsMenu() { //-------------------------------------------- - if (m_pOptionsMenu->m_hMenu) { + if (m_pOptionsMenu->m_hMenu) m_pOptionsMenu->DestroyMenu(); - } + CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); + m_pOptionsMenu->CreatePopupMenu(); //Bypass m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->IsBypassed()?MF_CHECKED:0, - ID_PLUG_BYPASS, "&Bypass"); + ID_PLUG_BYPASS, "&Bypass\t" + ih->GetKeyTextFromCommand(kcVSTGUIBypassPlug)); //Record Params m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bRecordAutomation?MF_CHECKED:0, - ID_PLUG_RECORDAUTOMATION, "Record &Params"); + ID_PLUG_RECORDAUTOMATION, "Record &Params\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleRecordParams)); //Pass on keypresses m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bPassKeypressesToPlug?MF_CHECKED:0, - ID_PLUG_PASSKEYS, "Pass &Keys to Plug"); + ID_PLUG_PASSKEYS, "Pass &Keys to Plug\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleSendKeysToPlug)); m_pMenu->DeleteMenu(3, MF_BYPOSITION); Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-03-14 18:43:27 UTC (rev 532) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-03-15 20:27:57 UTC (rev 533) @@ -2575,6 +2575,21 @@ commands[kcInstrumentEnvelopeZoomOut].isDummy = false; commands[kcInstrumentEnvelopeZoomOut].Message = "Zoom Out"; + commands[kcVSTGUIToggleRecordParams].UID = 1839; + commands[kcVSTGUIToggleRecordParams].isHidden = false; + commands[kcVSTGUIToggleRecordParams].isDummy = false; + commands[kcVSTGUIToggleRecordParams].Message = "Toggle parameter recording"; + + commands[kcVSTGUIToggleSendKeysToPlug].UID = 1840; + commands[kcVSTGUIToggleSendKeysToPlug].isHidden = false; + commands[kcVSTGUIToggleSendKeysToPlug].isDummy = false; + commands[kcVSTGUIToggleSendKeysToPlug].Message = "Pass key presses to plugin"; + + commands[kcVSTGUIBypassPlug].UID = 1841; + commands[kcVSTGUIBypassPlug].isHidden = false; + commands[kcVSTGUIBypassPlug].isDummy = false; + commands[kcVSTGUIBypassPlug].Message = "Bypass plugin"; + #ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2010-03-14 18:43:27 UTC (rev 532) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-03-15 20:27:57 UTC (rev 533) @@ -983,7 +983,10 @@ kcVSTGUIPrevPresetJump, kcVSTGUINextPresetJump, kcVSTGUIRandParams, - kcEndVSTGUICommands=kcVSTGUIRandParams, + kcVSTGUIToggleRecordParams, + kcVSTGUIToggleSendKeysToPlug, + kcVSTGUIBypassPlug, + kcEndVSTGUICommands=kcVSTGUIBypassPlug, kcStartOrderlistCommands, // Orderlist edit Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-03-14 18:43:27 UTC (rev 532) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-03-15 20:27:57 UTC (rev 533) @@ -306,7 +306,10 @@ 13:1764:0:39:1 //Next plugin preset: NACH-RECHTS (KeyDown) 13:1782:0:38:1 //Plugin preset backward jump: NACH-OBEN (KeyDown) 13:1783:0:40:1 //Plugin preset forward jump: NACH-UNTEN (KeyDown) -13:1765:2:82:1 //Randomize plugin parameters: Ctrl+R (KeyDown) +13:1765:2:80:1 //Randomize plugin parameters: Ctrl+P (KeyDown) +13:1839:2:82:1 //Toggle parameter recording: Ctrl+R (KeyDown) +13:1840:2:75:1 //Pass key presses to plugin: Ctrl+K (KeyDown) +13:1841:2:66:1 //Bypass plugin: Ctrl+B (KeyDown) //----( General Context [top] (14) )------------ Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 18:43:27 UTC (rev 532) +++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-15 20:27:57 UTC (rev 533) @@ -202,6 +202,8 @@ m_nDefaultSpeed = pfh->bTicksPerLine; m_nDefaultTempo = 125; m_dwSongFlags = SONG_ITCOMPATMODE; + m_nRowsPerBeat = pfh->bLinesPerBeat; + m_nRowsPerMeasure = m_nRowsPerBeat * 4; if ((pfh->wSamplesPerTick > 100) && (pfh->wSamplesPerTick < 5000)) { m_nDefaultTempo = 110250 / pfh->wSamplesPerTick; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-19 19:38:41
|
Revision: 536 http://modplug.svn.sourceforge.net/modplug/?rev=536&view=rev Author: saga-games Date: 2010-03-19 19:38:33 +0000 (Fri, 19 Mar 2010) Log Message: ----------- [Fix] Pattern Editor: Changing a channel plugin in MOD/S3M files doesn't mark them as modified anymore. [Fix] General Tab: Moving a plugin in MOD/S3M files doesn't mark them as modified anymore. The channel fx dropdown lists are now also disabled for those module types. [Fix] Plugin Editor: Changing a plugin parameter in MOD/S3M files doesn't mark them as modified anymore. [Ref] Added "supportsPlugins" to MOD specifications. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2010-03-19 18:43:47 UTC (rev 535) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2010-03-19 19:38:33 UTC (rev 536) @@ -403,10 +403,10 @@ ::EnableWindow(m_sbPan[ichn].m_hWnd, bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); ::EnableWindow(m_spinPan[ichn], bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1+ichn*2), bIT); - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2+ichn*2), bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT9+ichn), ((bEnable) && (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)))); - m_CbnEffects[ichn].EnableWindow(bEnable); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1 + ichn*2), bIT); // channel vol + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2 + ichn*2), bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); // channel pan + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT9 + ichn), ((bEnable) && (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)))); // channel name + m_CbnEffects[ichn].EnableWindow(bEnable & (pSndFile->GetModSpecifications().supportsPlugins ? TRUE : FALSE)); } UnlockControls(); } @@ -707,7 +707,8 @@ wsprintf(s, "(%d%% wet, %d%% dry)", 100-n, n); SetDlgItemText(IDC_STATIC8, s); pPlugin->fDryRatio = static_cast<float>(n)/100.0f; - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } } @@ -738,7 +739,8 @@ { pVstPlugin->SetParameter(m_nCurrentParam, fValue); OnParamChanged(); - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } } @@ -765,7 +767,8 @@ pSndFile = pModDoc->GetSoundFile(); pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin]; - if(pPlugin->pMixPlugin){ + if(pPlugin->pMixPlugin) + { DWORD gain = nPos; if(gain == 0) gain = 1; @@ -776,7 +779,8 @@ sprintf(s,"Gain: x %1.1f",fValue); SetDlgItemText(IDC_STATIC2, s); - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } // -! BEHAVIOUR_CHANGE#0028 @@ -828,7 +832,8 @@ && (pSndFile->ChnSettings[nChn].nMixPlugin != (UINT)nfx)) { pSndFile->ChnSettings[nChn].nMixPlugin = (PLUGINDEX)nfx; - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); } } @@ -856,7 +861,8 @@ if (strcmp(s, pSndFile->m_MixPlugins[m_nCurrentPlugin].Info.szName)) { memcpy(pSndFile->m_MixPlugins[m_nCurrentPlugin].Info.szName, s, 32); - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); } } @@ -930,10 +936,8 @@ CSelectPluginDlg dlg(pModDoc, m_nCurrentPlugin, this); if (dlg.DoModal() == IDOK) { - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) - { + if(pSndFile->GetModSpecifications().supportsPlugins) pModDoc->SetModified(); - } } OnPluginChanged(); OnParamChanged(); @@ -1004,7 +1008,8 @@ if (m_nCurrentPreset > 0 && m_nCurrentPreset <= nParams){ pVstPlugin->SetCurrentProgram(m_nCurrentPreset-1); } - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } @@ -1025,10 +1030,13 @@ if(files.abort) return; //TODO: exception handling - if (!(pVstPlugin->LoadProgram(files.first_file.c_str()))) { + if (!(pVstPlugin->LoadProgram(files.first_file.c_str()))) + { ::AfxMessageBox("Error loading preset.Are you sure it is for this plugin?"); - } else { - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + } else + { + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } //end rewbs.fxpPresets @@ -1080,7 +1088,8 @@ FLOAT fValue = (FLOAT)atof(s); pVstPlugin->SetParameter(m_nCurrentParam, fValue); OnParamChanged(); - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } } @@ -1102,7 +1111,8 @@ //CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; UINT value = GetDlgItemIntEx(IDC_EDIT15); pPlugin->fDryRatio = (float)value / 100.0f; - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); //OnWetDryChanged(); } } @@ -1153,7 +1163,8 @@ pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_MASTEREFFECT; } - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } @@ -1175,7 +1186,8 @@ pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_BYPASS; } - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } @@ -1199,7 +1211,8 @@ pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_MIXEXPAND; } - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } VOID CViewGlobals::OnSpecialMixProcessingChanged() @@ -1211,7 +1224,8 @@ if(!pPlugin) return; pPlugin->Info.dwInputRouting = (pPlugin->Info.dwInputRouting & 0xffff00ff) | (m_CbnSpecialMixProcessing.GetCurSel()<<8); // update#02 (fix) - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } // -! BEHAVIOUR_CHANGE#0028 @@ -1234,7 +1248,8 @@ pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_WETMIX; } - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } @@ -1263,7 +1278,8 @@ { CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; pVstPlugin->ExecuteCommand(nIndex); - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } @@ -1281,7 +1297,8 @@ pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin]; nroute = m_CbnOutput.GetItemData(m_CbnOutput.GetCurSel()); pPlugin->Info.dwOutputRouting = nroute; - if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } @@ -1396,7 +1413,8 @@ END_CRITICAL(); - pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); EndWaitCursor(); @@ -1453,7 +1471,8 @@ m_CbnPlugin.SetCurSel(m_nCurrentPlugin); OnPluginChanged(); - pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); } } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-19 18:43:47 UTC (rev 535) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-19 19:38:33 UTC (rev 536) @@ -4365,7 +4365,7 @@ } void CViewPattern::TempEnterChord(int note) -//--------------------------------------------- +//----------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -4650,7 +4650,8 @@ if (newPlug <= MAX_MIXPLUGINS && newPlug != pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin) { pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin = newPlug; - pModDoc->SetModified(); + if(pSndFile->GetModSpecifications().supportsPlugins) + pModDoc->SetModified(); InvalidateChannelsHeaders(); } } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-19 18:43:47 UTC (rev 535) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-19 19:38:33 UTC (rev 536) @@ -664,8 +664,10 @@ CModDoc* pModDoc = pVstPlugin->GetModDoc(); if (pModDoc) { CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); - if (pVstEditor && pVstEditor->m_hWnd) { //Check GUI is open - CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); + if (pVstEditor && pVstEditor->m_hWnd) // Check GUI is open + { + if(pModDoc->GetSoundFile() && pModDoc->GetSoundFile()->GetModSpecifications().supportsPlugins) + CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } //Could be used to update general tab in real time, but causes flickers in treeview //pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); @@ -980,11 +982,11 @@ //---from here VST 2.1 extension opcodes------------------------------------------------------ // begin of automation session (when mouse down), parameter index in <index> case audioMasterBeginEdit: - Log("VST plugin to host: Get Directory\n"); + Log("VST plugin to host: Begin Edit\n"); break; // end of automation session (when mouse up), parameter index in <index> case audioMasterEndEdit: - Log("VST plugin to host: Get Directory\n"); + Log("VST plugin to host: End Edit\n"); break; // open a fileselector window with VstFileSelect* in <ptr> case audioMasterOpenFileSelector: Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-19 18:43:47 UTC (rev 535) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-19 19:38:33 UTC (rev 536) @@ -47,6 +47,7 @@ char volcommands[MAX_VOLCMDS + 1]; // dito, but for volume column bool hasIgnoreIndex; // Does "+++" pattern exist? bool hasRestartPos; + bool supportsPlugins; }; @@ -91,6 +92,7 @@ " vpcdabuhlrgfe:o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) + true, // Supports plugins }; @@ -130,6 +132,7 @@ " ???????????????", // Supported Volume Column commands false, // Doesn't have "+++" pattern true, // Has restart position (order) + false, // Doesn't support plugins }; // MOD with MPT extensions. @@ -167,6 +170,7 @@ " ???????????????", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) + false, // Doesn't support plugins }; const CModSpecifications xm = @@ -203,6 +207,7 @@ " vpcdabuhlrg????", // Supported Volume Column commands false, // Doesn't have "+++" pattern true, // Has restart position (order) + false, // Doesn't support plugins }; // XM with MPT extensions @@ -240,6 +245,7 @@ " vpcdabuhlrgfe:o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) + true, // Supports plugins }; const CModSpecifications s3m = @@ -276,6 +282,7 @@ " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern false, // Doesn't have restart position (order) + false, // Doesn't support plugins }; // S3M with MPT extensions @@ -313,6 +320,7 @@ " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern false, // Doesn't have restart position (order) + false, // Doesn't support plugins }; const CModSpecifications it = @@ -349,6 +357,7 @@ " vpcdab?h??gfe??", // Supported Volume Column commands true, // Has "+++" pattern false, // Doesn't have restart position (order) + false, // Doesn't support plugins }; const CModSpecifications itEx = @@ -385,6 +394,7 @@ " vpcdab?h??gfe:o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) + true, // Supports plugins }; } //namespace ModSpecs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-20 12:32:24
|
Revision: 537 http://modplug.svn.sourceforge.net/modplug/?rev=537&view=rev Author: saga-games Date: 2010-03-20 12:32:15 +0000 (Sat, 20 Mar 2010) Log Message: ----------- [Fix] S3M/IT compatibility: Note Cut really cuts notes and does not just mute them (so that following volume commands could restore the sample) [Imp] Cleanup Dialog: Made it look a bit nicer. Modified Paths: -------------- trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-19 19:38:33 UTC (rev 536) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-20 12:32:15 UTC (rev 537) @@ -36,38 +36,44 @@ LTEXT "The following problems have been encountered when loading this module:",IDC_STATIC,6,6,237,8 END -IDD_CLEANUP_SONG DIALOGEX 0, 0, 370, 281 +IDD_CLEANUP_SONG DIALOGEX 0, 0, 394, 154 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Cleanup" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,306,6,60,14 - PUSHBUTTON "Cancel",IDCANCEL,306,24,60,14 - CONTROL "Remove unused",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,10 - CONTROL "Remove all",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,18,90,10 - CONTROL "Rearrange",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,18,90,10 - CONTROL "Merge sequences",IDC_CHK_MERGE_SEQUENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,90,10 - CONTROL "Remove all orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,10 - CONTROL "Remove unused",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,10 - CONTROL "Remove all",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,90,90,10 - CONTROL "Rearrange",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,90,90,10 + DEFPUSHBUTTON "OK",IDOK,330,6,60,14 + PUSHBUTTON "Cancel",IDCANCEL,330,24,60,14 + CONTROL "Remove unused",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,6,90,10 + CONTROL "Remove all",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,6,90,10 + CONTROL "Rearrange",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,18,90,10 + CONTROL "Merge sequences",IDC_CHK_MERGE_SEQUENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,36,90,10 + CONTROL "Remove all orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,36,90,10 + CONTROL "Remove unused",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,10 + CONTROL "Remove all",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,54,90,10 + CONTROL "Rearrange",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,66,90,10 CONTROL "Remove data after loop end",IDC_CHK_OPTIMIZE_SAMPLES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,102,108,10 - CONTROL "Remove unused",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,90,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,66,108,10 + CONTROL "Remove unused",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,90,10 CONTROL "Remove all (convert to samples)",IDC_CHK_REMOVE_INSTRUMENTS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,138,120,10 - CONTROL "Remove unused",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,174,90,10 - CONTROL "Remove all",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,174,90,10 - CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,90,10 - PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,18,246,90,18 - PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,120,246,90,18 - GROUPBOX "Patterns",IDC_STATIC,6,6,294,30 - GROUPBOX "Orders / Sequences",IDC_STATIC,6,42,294,30 - GROUPBOX "Samples",IDC_STATIC,6,78,294,42 - GROUPBOX "Instruments",IDC_STATIC,6,126,294,30 - GROUPBOX "Plugins",IDC_STATIC,6,162,294,30 - GROUPBOX "Miscellaneous",IDC_STATIC,6,198,294,30 - GROUPBOX "Presets",IDC_STATIC,6,234,294,36 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,84,120,10 + CONTROL "Remove unused",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,102,90,10 + CONTROL "Remove all",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,102,90,10 + CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,120,90,10 + PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,108,138,90,12 + PUSHBUTTON "Create samplepack",IDC_BTN_COMPO_CLEANUP,204,138,90,12 + LTEXT "Patterns:",IDC_STATIC,6,6,84,12 + LTEXT "Orders / Sequences:",IDC_STATIC,6,36,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,30,312,1 + LTEXT "Samples:",IDC_STATIC,6,53,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,48,312,1 + LTEXT "Instruments:",IDC_STATIC,6,82,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,78,312,1 + LTEXT "Plugins:",IDC_STATIC,6,101,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,96,312,1 + LTEXT "Miscellaneous:",IDC_STATIC,6,119,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,114,312,1 + LTEXT "Presets:",IDC_STATIC,6,137,84,12 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,132,312,1 END IDD_CHANNEL_NAME DIALOGEX 0, 0, 154, 58 @@ -162,9 +168,9 @@ IDD_CLEANUP_SONG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 363 + RIGHTMARGIN, 387 TOPMARGIN, 7 - BOTTOMMARGIN, 274 + BOTTOMMARGIN, 147 END IDD_CHANNEL_NAME, DIALOG Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-19 19:38:33 UTC (rev 536) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 12:32:15 UTC (rev 537) @@ -353,7 +353,7 @@ break; // Global Volume case CMD_GLOBALVOLUME: - if (!(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1; + if (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1; if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) { //IT compatibility 16. Both FT2 and IT ignore out-of-range values @@ -381,13 +381,13 @@ if (((param & 0x0F) == 0x0F) && (param & 0xF0)) { param >>= 4; - if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; + if (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; nGlbVol += param << 1; } else if (((param & 0xF0) == 0xF0) && (param & 0x0F)) { param = (param & 0x0F) << 1; - if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; + if (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; nGlbVol -= param; } else if (param & 0xF0) @@ -3466,7 +3466,7 @@ if(IsCompatibleMode(TRK_IMPULSETRACKER)) nTick = 1; // ST3 doesn't cut notes with SC0 - else if(m_nType == MOD_TYPE_S3M) + else if(GetType() == MOD_TYPE_S3M) return; } @@ -3475,14 +3475,23 @@ MODCHANNEL *pChn = &Chn[nChn]; // if (m_nInstruments) KeyOff(pChn); ? pChn->nVolume = 0; + // S3M/IT compatibility: Note Cut really cuts notes and does not just mute them (so that following volume commands could restore the sample) + if(IsCompatibleMode(TRK_IMPULSETRACKER|TRK_SCREAMTRACKER)) + { + pChn->nPeriod = 0; + } pChn->dwFlags |= CHN_FASTVOLRAMP; MODINSTRUMENT *pHeader = pChn->pModInstrument; - if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17) { // instro sends to a midi chan + // instro sends to a midi chan + if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17) + { UINT nPlug = pHeader->nMixPlug; - if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { + if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) + { IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin; - if (pPlug) { + if (pPlug) + { pPlug->MidiCommand(pHeader->nMidiChannel, pHeader->nMidiProgram, pHeader->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. |
From: <rel...@us...> - 2010-03-21 21:29:51
|
Revision: 542 http://modplug.svn.sourceforge.net/modplug/?rev=542&view=rev Author: relabsoluness Date: 2010-03-21 21:29:43 +0000 (Sun, 21 Mar 2010) Log Message: ----------- [Fix] VST: Some VSTs that previously wouldn't load might now load fine. [Fix] Instrument tuning: Minor fixes to ratio window, made tuning collection loading more reliable, minor other changes. [Fix] Serialization code: Fixed a memory leak in write functions, added alternative way to read entries and minor other changes. [Mod] Mod specs: Reduced xmEx sample count to 4000. [Ref] Added CountOf-macro (a better alternative to ARRAYELEMCOUNT-macro). Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/serialization_utils.cpp trunk/OpenMPT/mptrack/serialization_utils.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp trunk/OpenMPT/mptrack/typedefs.h trunk/OpenMPT/soundlib/mod_specifications.h trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuningCollection.cpp Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-21 21:29:43 UTC (rev 542) @@ -708,7 +708,8 @@ // Returns the unique id of a plug that's currently loading // (not sure what this is actually for - we return *effect's UID, cos Herman Seib does something similar :) // Let's see what happens...) - case audioMasterCurrentId: return effect->uniqueID; + case audioMasterCurrentId: + return (effect != nullptr) ? effect->uniqueID : 0; // Call application idle routine (this will call effEditIdle for all open editors too) case audioMasterIdle: OnIdle(); Modified: trunk/OpenMPT/mptrack/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-03-21 21:29:43 UTC (rev 542) @@ -863,8 +863,11 @@ if (m_fpLogFunc) m_fpLogFunc(tstrWritingMap, uint32(m_posMapStart - m_posStart)); - if(GetFlag(RwfRwHasMap)) //Write map + if (GetFlag(RwfRwHasMap)) //Write map + { oStrm.write(m_MapStream.str(), m_MapStream.pcount()); + m_MapStream.freeze(false); + } const Postype posMapEnd = oStrm.tellp(); Modified: trunk/OpenMPT/mptrack/serialization_utils.h =================================================================== --- trunk/OpenMPT/mptrack/serialization_utils.h 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/mptrack/serialization_utils.h 2010-03-21 21:29:43 UTC (rev 542) @@ -127,6 +127,11 @@ EntryRead, EntryNotFound }; + enum IdMatchStatus + { + IdMatch, IdMismatch + }; + typedef std::vector<ReadEntry>::const_iterator ReadIterator; Ssb(InStream* pIstrm, OutStream* pOstrm); Ssb(IoStream& ioStrm); @@ -142,7 +147,7 @@ void BeginWrite(const void* pId, const size_t nIdSize, const uint64& nVersion); void BeginWrite(const LPCSTR pszId, const uint64& nVersion) {BeginWrite(pszId, strlen(pszId), nVersion);} - // Read header. + // Call this to begin reading: must be called before other read functions. void BeginRead(const void* pId, const size_t nLength, const uint64& nVersion); void BeginRead(const LPCSTR pszId, const uint64& nVersion) {return BeginRead(pszId, strlen(pszId), nVersion);} @@ -170,6 +175,18 @@ // After calling BeginRead(), this returns number of entries in the file. NumType GetNumEntries() const {return m_nReadEntrycount;} + // Returns read iterator to the beginning of entries. + // The behaviour of read iterators is undefined if map doesn't + // contain entry ids or data begin positions. + ReadIterator GetReadBegin(); + + // Returns read iterator to the end(one past last) of entries. + ReadIterator GetReadEnd(); + + // Compares given id with read entry id + IdMatchStatus CompareId(const ReadIterator& iter, LPCSTR pszId) {return CompareId(iter, pszId, strlen(pszId));} + IdMatchStatus CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize); + // When writing, returns the number of entries written. // When reading, returns the number of entries read not including unrecognized entries. NumType GetCounter() const {return m_nCounter;} @@ -187,6 +204,12 @@ template <class T, class FuncObj> ReadRv ReadItem(T& obj, const void* pId, const size_t nIdSize, FuncObj); + // Read item using read iterator. + template <class T> + ReadRv ReadItem(const ReadIterator& iter, T& obj) {return ReadItem(iter, obj, srlztn::ReadItem<T>);} + template <class T, class FuncObj> + ReadRv ReadItem(const ReadIterator& iter, T& obj, FuncObj func); + // Write item using default write implementation. template <class T> void WriteItem(const T& obj, const LPCSTR pszId) {WriteItem(obj, pszId, strlen(pszId), &srlztn::WriteItem<T>);} @@ -204,6 +227,9 @@ void SetFlag(Rwf flag, bool val) {m_Flags.set(flag, val);} bool GetFlag(Rwf flag) const {return m_Flags[flag];} + // Write given string to log if log func is defined. + void Log(LPCTSTR psz) {if (m_fpLogFunc) m_fpLogFunc(psz);} + SsbStatus m_Status; uint32 m_nFixedEntrySize; // Read/write: If > 0, data entries have given fixed size. fpLogFunc_t m_fpLogFunc; // Pointer to log function. @@ -319,6 +345,48 @@ } +template <class T, class FuncObj> +Ssb::ReadRv Ssb::ReadItem(const ReadIterator& iter, T& obj, FuncObj func) +//----------------------------------------------------------------------- +{ + m_pIstrm->clear(); + if (iter->rposStart != 0) + m_pIstrm->seekg(m_posStart + Postype(iter->rposStart)); + const Postype pos = m_pIstrm->tellg(); + func(*m_pIstrm, obj, iter->nSize); + return OnReadEntry(&(*iter), &m_Idarray[iter->nIdpos], iter->nIdLength, pos); +} + + +inline Ssb::IdMatchStatus Ssb::CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize) +//------------------------------------------------------------------------------------------------------- +{ + if (nIdSize == iter->nIdLength && memcmp(&m_Idarray[iter->nIdpos], pId, iter->nIdLength) == 0) + return IdMatch; + else + return IdMismatch; +} + + +inline Ssb::ReadIterator Ssb::GetReadBegin() +//------------------------------------------ +{ + ASSERT(GetFlag(RwfRMapHasId) && (GetFlag(RwfRMapHasStartpos) || GetFlag(RwfRMapHasSize) || m_nFixedEntrySize > 0)); + if (GetFlag(RwfRMapCached) == false) + CacheMap(); + return mapData.begin(); +} + + +inline Ssb::ReadIterator Ssb::GetReadEnd() +//---------------------------------------- +{ + if (GetFlag(RwfRMapCached) == false) + CacheMap(); + return mapData.end(); +} + + template<class T> inline void Binarywrite(OutStream& oStrm, const T& data) //------------------------------------------------------ @@ -364,19 +432,25 @@ inline void Binaryread(InStream& iStrm, T& data, const Offtype bytecount) //----------------------------------------------------------------------- { + #if _HAS_TR1 + static_assert(std::tr1::has_trivial_assign<T>::value == true, ""); + #endif memset(&data, 0, sizeof(data)); - iStrm.read(reinterpret_cast<char*>(&data), min(bytecount, sizeof(data))); + iStrm.read(reinterpret_cast<char*>(&data), (std::min)((size_t)bytecount, sizeof(data))); } template <class T> -inline void ReadItem(InStream& iStrm, T& data, const DataSize /*nSize*/) -//---------------------------------------------------------------------- +inline void ReadItem(InStream& iStrm, T& data, const DataSize nSize) +//------------------------------------------------------------------ { #if _HAS_TR1 - STATIC_ASSERT(std::tr1::has_trivial_assign<T>::value == true); + static_assert(std::tr1::has_trivial_assign<T>::value == true, ""); #endif - Binaryread(iStrm, data); + if (nSize == sizeof(T) || nSize == invalidDatasize) + Binaryread(iStrm, data); + else + Binaryread(iStrm, data, nSize); } // Read specialization for float. If data size is 8, read double and assign it to given float. Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2010-03-21 21:29:43 UTC (rev 542) @@ -49,8 +49,8 @@ const size_t sizeofS = sizeof(s) / sizeof(s[0]); CRect rect; - NOTEINDEXTYPE nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont; - if(!m_nNote) m_nNote = m_nNoteCentre; + NOTEINDEXTYPE nNotes = static_cast<NOTEINDEXTYPE>((rcClient.bottom + m_cyFont - 1) / m_cyFont); + //if(!m_nNote) m_nNote = m_nNoteCentre; NOTEINDEXTYPE nPos = m_nNote - (nNotes/2); int ypaint = 0; @@ -132,11 +132,11 @@ CRect rcClient; GetClientRect(&rcClient); int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont; - const UINT n = (pt.y / m_cyFont) + m_nNote - (nNotes/2); - const NOTEINDEXTYPE note = n - m_nNoteCentre; + const int n = (pt.y / m_cyFont) + m_nNote - (nNotes/2); + const NOTEINDEXTYPE note = static_cast<NOTEINDEXTYPE>(n - m_nNoteCentre); if(m_pTuning->IsValidNote(note)) { - m_nNote = n; + m_nNote = static_cast<NOTEINDEXTYPE>(n); InvalidateRect(NULL, FALSE); if(m_pParent) m_pParent->UpdateRatioMapEdits(GetShownCentre()); Modified: trunk/OpenMPT/mptrack/typedefs.h =================================================================== --- trunk/OpenMPT/mptrack/typedefs.h 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/mptrack/typedefs.h 2010-03-21 21:29:43 UTC (rev 542) @@ -2,8 +2,16 @@ #define TYPEDEFS_H #define nullptr 0 -#define ARRAYELEMCOUNT(x) (sizeof(x)/sizeof(x[0])) +// CountOf macro computes the number of elements in a statically-allocated array. +#if _MSC_VER >= 1400 + #define CountOf(x) _countof(x) +#else + #define CountOf(x) (sizeof(x)/sizeof(x[0])) +#endif + +#define ARRAYELEMCOUNT(x) CountOf(x) + //Compile time assert. #define STATIC_ASSERT(expr) C_ASSERT(expr) #define static_assert(expr, msg) C_ASSERT(expr) Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-21 21:29:43 UTC (rev 542) @@ -233,7 +233,7 @@ 0, //Max sample filename length 22, //Max instrument name length 0, //Max instrument filename length - 256 * 16, //SamplesMax (actually 16 per instrument) + 4000, //SamplesMax (actually 16 per instrument(256*16=4096), but limited to MAX_SAMPLES=4000) 256, //instrumentMax mixLevels_117RC3, //defaultMixLevels 200, //Max MIDI mapping directives Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/soundlib/tuning.cpp 2010-03-21 21:29:43 UTC (rev 542) @@ -381,7 +381,8 @@ ssb.ReadItem(pTuning->m_GroupRatio, "RTI3"); ssb.ReadItem(pTuning->m_SerHelperRatiotableSize, "RTI4"); - if ((ssb.m_Status & srlztn::SNT_FAILURE) == 0) + // If reader status is ok and m_StepMin is somewhat reasonable, process data. + if ((ssb.m_Status & srlztn::SNT_FAILURE) == 0 && pTuning->m_StepMin >= -300 && pTuning->m_StepMin <= 300) { EDITMASK temp = pTuning->GetEditMask(); pTuning->m_EditMask = EM_ALLOWALL; //Allowing all while processing data. @@ -500,6 +501,11 @@ //m_StepMin inStrm.read(reinterpret_cast<char*>(&pT->m_StepMin), sizeof(pT->m_StepMin)); + if (pT->m_StepMin < -200 || pT->m_StepMin > 200) + { + delete pT; + return nullptr; + } //m_GroupSize inStrm.read(reinterpret_cast<char*>(&pT->m_GroupSize), sizeof(pT->m_GroupSize)); Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-03-21 17:25:13 UTC (rev 541) +++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-03-21 21:29:43 UTC (rev 542) @@ -153,10 +153,19 @@ iStrm.seekg(startpos); srlztn::Ssb ssb(iStrm); ssb.BeginRead("TC", s_SerializationVersion); - ssb.ReadItem(m_Name, "0", 1, &ReadStr); - ssb.ReadItem(m_EditMask, "1"); - for(size_t i = 2; i < ssb.GetNumEntries(); i++) - ssb.ReadItem(*this, "2", 1, &ReadTuning); + + srlztn::Ssb::ReadIterator iter = ssb.GetReadBegin(); + const srlztn::Ssb::ReadIterator iterEnd = ssb.GetReadEnd(); + for(iter; iter != iterEnd; iter++) + { + if (ssb.CompareId(iter, "0") == srlztn::Ssb::IdMatch) + ssb.ReadItem(iter, m_Name, &ReadStr); + else if (ssb.CompareId(iter, "1") == srlztn::Ssb::IdMatch) + ssb.ReadItem(iter, m_EditMask); + else if (ssb.CompareId(iter, "2") == srlztn::Ssb::IdMatch) + ssb.ReadItem(iter, *this, &ReadTuning); + } + if(ssb.m_Status & srlztn::SNT_FAILURE) return true; else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2010-03-22 20:18:00
|
Revision: 544 http://modplug.svn.sourceforge.net/modplug/?rev=544&view=rev Author: rewbs Date: 2010-03-22 20:17:53 +0000 (Mon, 22 Mar 2010) Log Message: ----------- [Fix] Effect visualizer is now aware of PC notes (bug 3836). [Fix] Context menu command "Change Plugin" for PC notes now works when the PC note has a blank plugin (instrument) field. Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/EffectVis.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb Added Paths: ----------- trunk/OpenMPT/mptrack/res/vispcnode.bmp Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 20:17:53 UTC (rev 544) @@ -25,20 +25,22 @@ IMPLEMENT_DYNAMIC(CEffectVis, CDialog) CEffectVis::CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat) - //: CDialog(CEffectVis::IDD, pParent) { m_pViewPattern = pViewPattern; m_dwStatus = 0x00; m_nDragItem = -1; m_brushBlack.CreateSolidBrush(RGB(0, 0, 0)); m_boolForceRedraw = TRUE; + m_pModDoc = pModDoc; m_nRowToErase = -1; m_nParamToErase = -1; m_nLastDrawnRow = -1; + m_nLastDrawnY = -1; m_nOldPlayPos = -1; - m_nFillEffect=0; - m_nAction=kAction_Overwrite; //Overwrite + m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0); + m_nAction=kAction_OverwriteFX; + m_templatePCNote.Set(NOTE_PCS, 1, 0, 0); UpdateSelection(startRow, endRow, nchn, pModDoc, pat); } @@ -51,16 +53,9 @@ ON_WM_MOUSEMOVE() ON_WM_RBUTTONDOWN() ON_WM_RBUTTONUP() -// ON_WM_CHAR() -// ON_WM_KEYDOWN() -// ON_WM_KEYUP() -// ON_WM_MBUTTONDOWN() //{{AFX_MSG_MAP(CEffectVis) ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) //}}AFX_MSG_MAP -//ON_STN_CLICKED(IDC_VISSTATUS, OnStnClickedVisstatus) -//ON_EN_CHANGE(IDC_VISSTATUS, OnEnChangeVisstatus) - ON_COMMAND(IDC_VISFILLBLANKS, OnFillBlanksCheck) ON_CBN_SELCHANGE(IDC_VISACTION, OnActionChanged) ON_CBN_SELCHANGE(IDC_VISEFFECTLIST, OnEffectChanged) END_MESSAGE_MAP() @@ -71,19 +66,14 @@ DDX_Control(pDX, IDC_VISSTATUS, m_edVisStatus); DDX_Control(pDX, IDC_VISEFFECTLIST, m_cmbEffectList); DDX_Control(pDX, IDC_VISACTION, m_cmbActionList); - DDX_Control(pDX, IDC_VISFILLBLANKS, m_btnFillCheck); } -void CEffectVis::OnFillBlanksCheck() -{ - m_bFillCheck = IsDlgButtonChecked(IDC_VISFILLBLANKS); -} - - void CEffectVis::OnActionChanged() { m_nAction = m_cmbActionList.GetItemData(m_cmbActionList.GetCurSel()); - if (m_nAction == (UINT)kAction_Preserve) + if (m_nAction == (UINT)kAction_FillPC + || m_nAction == (UINT)kAction_OverwritePC + || m_nAction == (UINT)kAction_Preserve) m_cmbEffectList.EnableWindow(FALSE); else m_cmbEffectList.EnableWindow(TRUE); @@ -106,21 +96,54 @@ } -BYTE CEffectVis::GetParam(UINT row) -{ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; +uint16 CEffectVis::GetParam(UINT row) +{ + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + uint16 paramValue = 0; + if (pcmd) - return pcmd[row*m_pSndFile->m_nChannels + m_nChan].param; - else - return 0; + { + MODCOMMAND cmd = pcmd[row*m_pSndFile->m_nChannels + m_nChan]; + if (cmd.IsPcNote()) + { + paramValue = cmd.GetValueEffectCol(); + } + else + { + paramValue = cmd.param; + } + } + + return paramValue; } -void CEffectVis::SetParam(UINT row, BYTE param) +// Sets a row's param value based on the vertical cursor position. +// Sets either plain pattern effect parameter or PC note parameter +// as appropriate, depending on contents of row. +void CEffectVis::SetParamFromY(UINT row, long y) { MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; - BEGIN_CRITICAL(); - if (pcmd) - pcmd[row*m_pSndFile->m_nChannels + m_nChan].param = param; - END_CRITICAL(); + if (!pcmd) { + return; + } + + int offset = row*m_pSndFile->m_nChannels + m_nChan; + if (IsPcNote(row)) + { + uint16 param = ScreenYToPCParam(y); + BEGIN_CRITICAL(); + pcmd[offset].SetValueEffectCol(param); + END_CRITICAL(); + } + else + { + int param = ScreenYToFXParam(y); + // Cap the parameter value as appropriate, based on effect type (e.g. Zxx gets capped to [0x00,0x7F]) + m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(pcmd[offset].command, param), param); + BEGIN_CRITICAL(); + pcmd[offset].param = static_cast<BYTE>(param); + END_CRITICAL(); + } } @@ -133,12 +156,21 @@ return 0; } -void CEffectVis::SetCommand(UINT row, BYTE cmd) +void CEffectVis::SetCommand(UINT row, BYTE command) { MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; BEGIN_CRITICAL(); - if (pcmd) - pcmd[row*m_pSndFile->m_nChannels + m_nChan].command = cmd; + if (pcmd) { + int offset = row*m_pSndFile->m_nChannels + m_nChan; + if (pcmd[offset].IsPcNote()) { + // Clear PC note + pcmd[offset].note = 0; + pcmd[offset].instr = 0; + pcmd[offset].volcmd = 0; + pcmd[offset].vol = 0; + } + pcmd[offset].command = command; + } END_CRITICAL(); } @@ -149,24 +181,66 @@ return -1; } -int CEffectVis::ParamToScreenY(BYTE param) + +int CEffectVis::RowToScreenY(UINT row) { + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + int screenY = -1; + + if (pcmd) + { + MODCOMMAND cmd = pcmd[row*m_pSndFile->m_nChannels + m_nChan]; + if (cmd.IsPcNote()) + { + uint16 paramValue = cmd.GetValueEffectCol(); + screenY = PCParamToScreenY(paramValue); + } + else + { + uint16 paramValue = cmd.param; + screenY = FXParamToScreenY(paramValue); + } + } + + return screenY; +} + +int CEffectVis::FXParamToScreenY(uint16 param) +{ if ((param >= 0x00) || (param <= 0xFF)) - return (int) (m_rcDraw.bottom - param*m_pixelsPerParam + 0.5); + return (int) (m_rcDraw.bottom - param*m_pixelsPerFXParam + 0.5); return -1; } -BYTE CEffectVis::ScreenYToParam(int y) +int CEffectVis::PCParamToScreenY(uint16 param) { - if (y<=ParamToScreenY(0xFF)) + if ((param >= 0x00) || (param <= MODCOMMAND::maxColumnValue)) + return (int) (m_rcDraw.bottom - param*m_pixelsPerPCParam + 0.5); + return -1; +} + +BYTE CEffectVis::ScreenYToFXParam(int y) +{ + if (y<=FXParamToScreenY(0xFF)) return 0xFF; - if (y>=ParamToScreenY(0x00)) + if (y>=FXParamToScreenY(0x00)) return 0x00; - return (BYTE)((m_rcDraw.bottom-y)/m_pixelsPerParam+0.5); + return (BYTE)((m_rcDraw.bottom-y)/m_pixelsPerFXParam+0.5); } +uint16 CEffectVis::ScreenYToPCParam(int y) +{ + if (y<=PCParamToScreenY(MODCOMMAND::maxColumnValue)) + return MODCOMMAND::maxColumnValue; + + if (y>=PCParamToScreenY(0x00)) + return 0x00; + + return (uint16)((m_rcDraw.bottom-y)/m_pixelsPerPCParam+0.5); +} + UINT CEffectVis::ScreenXToRow(int x) { if (x<=RowToScreenX(m_startRow)) @@ -184,14 +258,14 @@ if (m_pViewPattern) { m_pViewPattern->m_pEffectVis = NULL; - //m_pViewPattern = NULL; } } void CEffectVis::DrawGrid() { - //Lots of space for opti here. + // Lots of room for optimisation here. + // Draw vertical grid lines for (UINT row=m_startRow; row<=m_endRow; row++) { if (row % CMainFrame::m_nRowSpacing == 0) @@ -204,35 +278,31 @@ int x1 = RowToScreenX(row); m_dcGrid.MoveTo(x1, m_rcDraw.top); m_dcGrid.LineTo(x1, m_rcDraw.bottom); - //::DeletePen(CMainFrame::penScratch); } - - for (UINT i=0; i<256; i+=64) + // Draw horizontal grid lines + const UINT numHorizontalLines = 4; + for (UINT i=0; i<numHorizontalLines; i++) { - switch (i) + switch (i%4) { case 0: CMainFrame::penScratch = CMainFrame::penGray00; break; - case 64: CMainFrame::penScratch = CMainFrame::penGray40; break; - case 128: CMainFrame::penScratch = CMainFrame::penGray80; break; - case 192: CMainFrame::penScratch = CMainFrame::penGraycc; break; + case 1: CMainFrame::penScratch = CMainFrame::penGray40; break; + case 2: CMainFrame::penScratch = CMainFrame::penGray80; break; + case 3: CMainFrame::penScratch = CMainFrame::penGraycc; break; } m_dcGrid.SelectObject(CMainFrame::penScratch); - int y1 = ParamToScreenY((BYTE)i); + int y1 = m_rcDraw.bottom/numHorizontalLines * i; m_dcGrid.MoveTo(m_rcDraw.left+INNERLEFTBORDER, y1); m_dcGrid.LineTo(m_rcDraw.right-INNERRIGHTBORDER, y1); - //::DeletePen(CMainFrame::penScratch); } } void CEffectVis::SetPlayCursor(UINT nPat, UINT nRow) { - //TEMP: -// ::FillRect(m_dcPlayPos.m_hDC, &m_rcDraw, m_brushBlack); - int x1; //erase current playpos: if (m_nOldPlayPos>=m_startRow && m_nOldPlayPos<=m_endRow) @@ -362,12 +432,13 @@ //--------------------------------------- { //erase - if (m_nRowToErase<m_startRow || m_nParamToErase<0) + if (m_nRowToErase<m_startRow || m_nParamToErase < 0) + { ::FillRect(m_dcNodes.m_hDC, &m_rcDraw, m_brushBlack); + } else { int x = RowToScreenX(m_nRowToErase); - //int y = ParamToScreenY(m_nParamToErase); CRect r( x-NODEHALF-1, m_rcDraw.top, x-NODEHALF+NODESIZE+1, m_rcDraw.bottom); ::FillRect(m_dcNodes.m_hDC, r, m_brushBlack); } @@ -376,8 +447,8 @@ for (UINT row=m_startRow; row<=m_endRow; row++) { int x = RowToScreenX(row); - int y = ParamToScreenY(GetParam(row)); - DibBlt(m_dcNodes.m_hDC, x-NODEHALF, y-NODEHALF, NODESIZE, NODESIZE, 0, 0, CMainFrame::bmpVisNode); + int y = RowToScreenY(row); + DibBlt(m_dcNodes.m_hDC, x-NODEHALF, y-NODEHALF, NODESIZE, NODESIZE, 0, 0, IsPcNote(row)? CMainFrame::bmpVisPcNode : CMainFrame::bmpVisNode); } } @@ -433,7 +504,6 @@ VOID CEffectVis::DoClose() //------------------------ { - // delete fastDC; m_dcGrid.SelectObject(m_pbOldGrid); m_dcGrid.DeleteDC(); m_dcNodes.SelectObject(m_pbOldNodes); @@ -453,7 +523,6 @@ } m_hWnd = NULL; delete this; -// _CrtDumpMemoryLeaks(); } @@ -463,21 +532,16 @@ void CEffectVis::OnSize(UINT nType, int cx, int cy) { - //CDialog::OnSize(nType, cx, cy); - // TODO: Add your message handler code here GetClientRect(&m_rcFullWin); m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER, m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER); #define INFOWIDTH 200 -#define CHECKBOXWIDTH 100 #define ACTIONLISTWIDTH 150 #define COMMANDLISTWIDTH 130 if (IsWindow(m_edVisStatus.m_hWnd)) - m_edVisStatus.SetWindowPos(this, m_rcFullWin.left, m_rcDraw.bottom, INFOWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER); -// if (IsWindow(m_btnFillCheck)) -// m_btnFillCheck.SetWindowPos(this, m_rcFullWin.right-COMMANDLISTWIDTH-CHECKBOXWIDTH, m_rcDraw.bottom, CHECKBOXWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER); + m_edVisStatus.SetWindowPos(this, m_rcFullWin.left, m_rcDraw.bottom, m_rcFullWin.right-COMMANDLISTWIDTH-ACTIONLISTWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER); if (IsWindow(m_cmbActionList)) m_cmbActionList.SetWindowPos(this, m_rcFullWin.right-COMMANDLISTWIDTH-ACTIONLISTWIDTH, m_rcDraw.bottom, ACTIONLISTWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER); if (IsWindow(m_cmbEffectList)) @@ -485,7 +549,8 @@ m_pixelsPerRow = (float)(m_rcDraw.Width()-INNERLEFTBORDER-INNERRIGHTBORDER)/(float)m_nRows; - m_pixelsPerParam = (float)(m_rcDraw.Height())/(float)0xFF; + m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF; + m_pixelsPerPCParam = (float)(m_rcDraw.Height())/(float)MODCOMMAND::maxColumnValue; m_boolForceRedraw = TRUE; InvalidateRect(NULL, FALSE); //redraw everything } @@ -553,7 +618,7 @@ } m_pixelsPerRow = (float)(m_rcDraw.right - m_rcDraw.left)/(float)m_nRows; - m_pixelsPerParam = (float)(m_rcDraw.bottom - m_rcDraw.top)/(float)0xFF; + m_pixelsPerFXParam = (float)(m_rcDraw.bottom - m_rcDraw.top)/(float)0xFF; m_boolForceRedraw = TRUE; Update(); @@ -562,7 +627,6 @@ void CEffectVis::OnRButtonDown(UINT nFlags, CPoint point) { - // TODO: Add your message handler code here and/or call default if (!(m_dwStatus & FXVSTATUS_LDRAGGING)) { SetFocus(); @@ -574,7 +638,7 @@ for (UINT row=m_startRow; row<=m_endRow; row++) { int x = RowToScreenX(row); - int y = ParamToScreenY(GetParam(row)); + int y = RowToScreenY(row); rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1); if (rect.PtInRect(point)) { @@ -590,80 +654,87 @@ void CEffectVis::OnRButtonUp(UINT nFlags, CPoint point) { - // TODO: Add your message handler code here and/or call default ReleaseCapture(); m_dwStatus = 0x00; m_nDragItem = -1; - CDialog::OnLButtonUp(nFlags, point); - + CDialog::OnRButtonUp(nFlags, point); } void CEffectVis::OnMouseMove(UINT nFlags, CPoint point) { - // TODO: Add your message handler code here and/or call default CDialog::OnMouseMove(nFlags, point); m_pModDoc = m_pViewPattern->GetDocument(); if (!m_pModDoc) return; - UINT row= ScreenXToRow(point.x); - BYTE paramValue=ScreenYToParam(point.y); + UINT row = ScreenXToRow(point.x); if ((m_dwStatus & FXVSTATUS_RDRAGGING) && (m_nDragItem>=0) ) { m_nRowToErase = m_nDragItem; m_nParamToErase = GetParam(m_nDragItem); - MakeChange(m_nDragItem, paramValue); - m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL); + MakeChange(m_nDragItem, point.y); } else if ((m_dwStatus & FXVSTATUS_LDRAGGING)) { - //Interpolate if there's a gap, but with no release of left mouse button. - if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1)) + // Interpolate if we detect that rows have been skipped but the left mouse button was not released. + // This ensures we produce a smooth curve even when we are not notified of mouse movements at a high frequency (e.g. if CPU usage is high) + if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1)) { - int diff = abs((long)row-(long)m_nLastDrawnRow); - ASSERT(diff!=0); - int sign = ((int)(row-m_nLastDrawnRow) > 0) ? 1 : -1; - float factor = (float)(paramValue-GetParam(m_nLastDrawnRow))/(float)diff + 0.5f; + int steps = abs((long)row-(long)m_nLastDrawnRow); + ASSERT(steps!=0); + int direction = ((int)(row-m_nLastDrawnRow) > 0) ? 1 : -1; + float factor = (float)(point.y - m_nLastDrawnY)/(float)steps + 0.5f; int currentRow; - - for (int i=1; i<=diff; i++) + for (int i=1; i<=steps; i++) { - currentRow = m_nLastDrawnRow+(sign*i); - int newParam = GetParam(m_nLastDrawnRow)+((float)i*factor+0.5f); - if (newParam>0xFF) newParam = 0xFF; if (newParam<0x00) newParam = 0x00; - MakeChange(currentRow, newParam); + currentRow = m_nLastDrawnRow+(direction*i); + int interpolatedY = m_nLastDrawnY+((float)i*factor+0.5f); + MakeChange(currentRow, interpolatedY); } - - m_nRowToErase = -1; //Don't use single value update + + //Don't use single value update + m_nRowToErase = -1; m_nParamToErase = -1; } else { - //m_nLastDrawnRow = row; m_nRowToErase = -1; - m_nParamToErase = -1; //GetParam(row); - MakeChange(row, paramValue); + m_nParamToErase = -1; + MakeChange(row, point.y); } + // Remember last modified point in case we need to interpolate m_nLastDrawnRow = row; - m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL); + m_nLastDrawnY = point.y; + } + //update status bar + CHAR status[256]; + CHAR effectName[128]; + uint16 paramValue; + + if (IsPcNote(row)) + { + paramValue = ScreenYToPCParam(point.y); + wsprintf(effectName, "%s", "Param Control"); //TODO - show smooth & plug+param } - //update status bar - CHAR s[256]; - wsprintf(s, "Pat: %d\tChn: %d\tRow: %d\tVal: %02X", m_nPattern, m_nChan+1, row, paramValue); - m_edVisStatus.SetWindowText(s); + else + { + paramValue = ScreenYToFXParam(point.y); + m_pModDoc->GetEffectInfo(m_pModDoc->GetIndexFromEffect(GetCommand(row), GetParam(row)), effectName, true); + } + + wsprintf(status, "Pat: %d\tChn: %d\tRow: %d\tVal: %02X (%03d) [%s]", + m_nPattern, m_nChan+1, row, paramValue, paramValue, effectName); + m_edVisStatus.SetWindowText(status); } void CEffectVis::OnLButtonDown(UINT nFlags, CPoint point) { - // TODO: Add your message handler code here and/or call default if (!(m_dwStatus & FXVSTATUS_RDRAGGING)) { SetFocus(); @@ -678,74 +749,47 @@ void CEffectVis::OnLButtonUp(UINT nFlags, CPoint point) { - // TODO: Add your message handler code here and/or call default ReleaseCapture(); m_dwStatus = 0x00; CModControlDlg::OnLButtonUp(nFlags, point); m_nLastDrawnRow = -1; } -//void CEffectVis::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -//{ -// // TODO: Add your message handler code here and/or call default -// CModControlDlg::OnChar(nChar, nRepCnt, nFlags); -// m_pViewPattern->OnChar(nChar, nRepCnt, nFlags); -//} -//void CEffectVis::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -//{ -// // TODO: Add your message handler code here and/or call default -// -// CModControlDlg::OnKeyDown(nChar, nRepCnt, nFlags); -// m_pViewPattern->OnKeyDown(nChar, nRepCnt, nFlags); -//} - -//void CEffectVis::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) -//{ -// // TODO: Add your message handler code here and/or call default -// -// CModControlDlg::OnKeyUp(nChar, nRepCnt, nFlags); -// m_pViewPattern->OnKeyUp(nChar, nRepCnt, nFlags); -//} - -//void CEffectVis::OnMButtonDown(UINT nFlags, CPoint point) -//{ -// // TODO: Add your message handler code here and/or call default -// -// CModControlDlg::OnMButtonDown(nFlags, point); -//} - void CEffectVis::OnEditUndo() { CHAR s[64]; wsprintf(s, "Undo Through!"); ::MessageBox(NULL, s, NULL, MB_OK|MB_ICONEXCLAMATION); } -//void CEffectVis::OnStnClickedVisstatus() -//{ -// // TODO: Add your control notification handler code here -//} -//void CEffectVis::OnEnChangeVisstatus() -//{ -// // TODO: If this is a RICHEDIT control, the control will not -// // send this notification unless you override the CModControlDlg::OnInitDialog() -// // function and call CRichEditCtrl().SetEventMask() -// // with the ENM_CHANGE flag ORed into the mask. -// -// // TODO: Add your control notification handler code here -//} - BOOL CEffectVis::OnInitDialog() //-------------------------------- { CModControlDlg::OnInitDialog(); - m_bFillCheck=true; - m_btnFillCheck.SetCheck(m_bFillCheck); - m_nFillEffect=m_pModDoc->GetIndexFromEffect(GetCommand(m_startRow), GetParam(m_startRow)); - if (m_nFillEffect<0) - m_nFillEffect=28; + if (IsPcNote(m_startRow)) + { + // If first selected row is a PC Note, default to PC note overwrite mode + // and use it as a template for new PC notes that will be created via the visualiser. + m_nAction = kAction_OverwritePC; + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + if (pcmd) { + int offset = m_startRow*m_pSndFile->m_nChannels + m_nChan; + m_templatePCNote.Set(pcmd[offset].note, pcmd[offset].instr, pcmd[offset].GetValueVolCol(), 0); + } + m_cmbEffectList.EnableWindow(FALSE); + } + else + { + // Otherwise, default to FX overwrite and + // use effect of first selected row as default effect type + m_nAction = kAction_OverwriteFX; + m_nFillEffect = m_pModDoc->GetIndexFromEffect(GetCommand(m_startRow), GetParam(m_startRow)); + if (m_nFillEffect<0 || m_nFillEffect>=MAX_EFFECTS) + m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0); + } + CHAR s[128]; UINT numfx = m_pModDoc->GetNumEffects(); m_cmbEffectList.ResetContent(); @@ -762,44 +806,91 @@ } m_cmbActionList.ResetContent(); - m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite FX type with:"), kAction_Overwrite); - m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with:"),kAction_Fill); - m_cmbActionList.SetItemData(m_cmbActionList.AddString("Keep FX type."),kAction_Preserve); + m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with effect:"), kAction_OverwriteFX); + m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with effect:"), kAction_FillFX); + m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with PC note"), kAction_OverwritePC); + m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with PC note"), kAction_FillPC); + m_cmbActionList.SetItemData(m_cmbActionList.AddString("Never change effect type"), kAction_Preserve); + m_cmbActionList.SetCurSel(m_nAction); return true; } -void CEffectVis::MakeChange(int currentRow, int newParam) +void CEffectVis::MakeChange(int row, long y) { - int currentCommand=GetCommand(currentRow); + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + if (!pcmd) { + return; + } + int offset = row*m_pSndFile->m_nChannels + m_nChan; + switch (m_nAction) { - case kAction_Preserve: - if (currentCommand) { //Only set param if we have an effect type here - m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(currentCommand, m_nParamToErase), newParam); - SetParam(currentRow, newParam); + case kAction_FillFX: + // Only set command if there isn't a command already at this row and it's not a PC note + if (!GetCommand(row) && !IsPcNote(row)) + { + SetCommand(row, m_pModDoc->GetEffectFromIndex(m_nFillEffect)); } + // Always set param + SetParamFromY(row, y); break; + + case kAction_OverwriteFX: + // Always set command and param. Blows away any PC notes. + SetCommand(row, m_pModDoc->GetEffectFromIndex(m_nFillEffect)); + SetParamFromY(row, y); + break; - case kAction_Fill: - if (currentCommand) { //If we have an effect type here, just set param - m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(currentCommand, m_nParamToErase), newParam); - SetParam(currentRow, newParam); - } - else //Else set command and param + case kAction_FillPC: + // Fill only empty slots with PC notes - leave other slots alone. + if (pcmd[offset].IsEmpty()) { - SetCommand(currentRow, m_pModDoc->GetEffectFromIndex(m_nFillEffect, newParam)); - SetParam(currentRow, newParam); + SetPcNote(row); } + // Always set param + SetParamFromY(row, y); break; - case kAction_Overwrite: - //Always set command and param - SetCommand(currentRow, m_pModDoc->GetEffectFromIndex(m_nFillEffect, newParam)); - SetParam(currentRow, newParam); + case kAction_OverwritePC: + // Always convert to PC Note and set param value + SetPcNote(row); + SetParamFromY(row, y); + break; + + case kAction_Preserve: + if (GetCommand(row) || IsPcNote(row)) { + // Only set param if we have an effect type or if this is a PC note. + // Never change the effect type. + SetParamFromY(row, y); + } + break; + } - return; + m_pModDoc->SetModified(); + m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL); } +void CEffectVis::SetPcNote(int row) +{ + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + if (!pcmd) { + return; + } + + int offset = row*m_pSndFile->m_nChannels + m_nChan; + BEGIN_CRITICAL(); + pcmd[offset].Set(m_templatePCNote.note, m_templatePCNote.instr, m_templatePCNote.GetValueVolCol(), 0); + END_CRITICAL(); +} + +bool CEffectVis::IsPcNote(int row) +{ + MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern]; + if (pcmd) + return pcmd[row*m_pSndFile->m_nChannels + m_nChan].IsPcNote(); + else + return false; +} \ No newline at end of file Modified: trunk/OpenMPT/mptrack/EffectVis.h =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.h 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/EffectVis.h 2010-03-22 20:17:53 UTC (rev 544) @@ -8,19 +8,21 @@ //#define FXVSTATUS_NCLBTNDOWN 0x02 //#define INSSTATUS_SPLITCURSOR 0x04 -enum -{ - kAction_Overwrite=0, - kAction_Fill, - kAction_Preserve -}; - // EffectVis dialog class CEffectVis : public CModControlDlg { DECLARE_DYNAMIC(CEffectVis) public: + enum + { + kAction_OverwriteFX=0, + kAction_FillFX, + kAction_OverwritePC, + kAction_FillPC, + kAction_Preserve + }; + CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat); virtual ~CEffectVis(); //{{AFX_VIRTUAL(CEffectVis) @@ -47,15 +49,13 @@ RECT invalidated; int m_nLastDrawnRow; // for interpolation + long m_nLastDrawnY; // for interpolation int m_nRowToErase; int m_nParamToErase; UINT m_nOldPlayPos; + MODCOMMAND m_templatePCNote; - -// int m_nRectWidth, m_nRectHeight; -// CRect m_rectDraw; -// CRect m_rectOwner; CBrush m_brushBlack; public: @@ -71,18 +71,23 @@ DWORD m_dwStatus; void InvalidateRow(int row); - float m_pixelsPerRow, m_pixelsPerParam; + float m_pixelsPerRow, m_pixelsPerFXParam, m_pixelsPerPCParam; void UpdateSelection(UINT startRow, UINT endRow, UINT nchn, CModDoc* m_pModDoc, UINT pats); void Update(); int RowToScreenX(UINT row); - int ParamToScreenY(BYTE param); - BYTE GetParam(UINT row); + int RowToScreenY(UINT row); + int PCParamToScreenY(uint16 param); + int FXParamToScreenY(uint16 param); + uint16 GetParam(UINT row); BYTE GetCommand(UINT row); - void SetParam(UINT row, BYTE param); + void SetParamFromY(UINT row, long y); void SetCommand(UINT row, BYTE cmd); - BYTE ScreenYToParam(int y); + BYTE ScreenYToFXParam(int y); + uint16 ScreenYToPCParam(int y); UINT ScreenXToRow(int x); void SetPlayCursor(UINT nPat, UINT nRow); + bool IsPcNote(int row); + void SetPcNote(int row); CSoundFile* m_pSndFile; CModDoc* m_pModDoc; @@ -90,8 +95,6 @@ CRect m_rcFullWin; CComboBox m_cmbEffectList, m_cmbActionList; - CButton m_btnFillCheck; - bool m_bFillCheck; CEdit m_edVisStatus; virtual VOID OnOK(); @@ -116,18 +119,13 @@ afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); - afx_msg void OnFillBlanksCheck(); afx_msg void OnEffectChanged(); afx_msg void OnActionChanged(); -// afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); -// afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); -// afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); -// afx_msg void OnMButtonDown(UINT nFlags, CPoint point); //{{AFX_MSG(CEffectVis) afx_msg void OnEditUndo(); //}}AFX_MSG private: - void MakeChange(int currentRow, int newParam); + void MakeChange(int currentRow, long newY); }; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-22 20:17:53 UTC (rev 544) @@ -246,7 +246,8 @@ LPMODPLUGDIB CMainFrame::bmpPatterns = NULL; LPMODPLUGDIB CMainFrame::bmpNotes = NULL; LPMODPLUGDIB CMainFrame::bmpVUMeters = NULL; -LPMODPLUGDIB CMainFrame::bmpVisNode = NULL; //rewbs.fxVis +LPMODPLUGDIB CMainFrame::bmpVisNode = NULL; +LPMODPLUGDIB CMainFrame::bmpVisPcNode = NULL; HPEN CMainFrame::gpenVuMeter[NUM_VUMETER_PENS*2]; COLORREF CMainFrame::rgbCustomColors[MAX_MODCOLORS] = { @@ -772,7 +773,8 @@ bmpPatterns = LoadDib(MAKEINTRESOURCE(IDB_PATTERNS)); bmpNotes = LoadDib(MAKEINTRESOURCE(IDB_PATTERNVIEW)); bmpVUMeters = LoadDib(MAKEINTRESOURCE(IDB_VUMETERS)); - bmpVisNode = LoadDib(MAKEINTRESOURCE(IDB_VISNODE)); //rewbs.fxVis + bmpVisNode = LoadDib(MAKEINTRESOURCE(IDB_VISNODE)); + bmpVisPcNode = LoadDib(MAKEINTRESOURCE(IDB_VISPCNODE)); UpdateColors(); // Toolbars EnableDocking(CBRS_ALIGN_ANY); @@ -849,6 +851,11 @@ delete bmpVisNode; bmpVisNode = NULL; } + if (bmpVisPcNode) + { + delete bmpVisPcNode; + bmpVisPcNode = NULL; + } // Kill GDI Objects DeleteGDIObject(brushGray); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-22 20:17:53 UTC (rev 544) @@ -442,7 +442,7 @@ static HPEN penBlack, penDarkGray, penLightGray, penWhite, penHalfDarkGray, penSample, penEnvelope, penEnvelopeHighlight, penSeparator, penScratch, penGray00, penGray33, penGray40, penGray55, penGray80, penGray99, penGraycc, penGrayff; static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit; static COLORREF rgbCustomColors[MAX_MODCOLORS]; - static LPMODPLUGDIB bmpPatterns, bmpNotes, bmpVUMeters, bmpVisNode; + static LPMODPLUGDIB bmpPatterns, bmpNotes, bmpVUMeters, bmpVisNode, bmpVisPcNode; static HPEN gpenVuMeter[NUM_VUMETER_PENS*2]; // key config static TCHAR m_szKbdFile[_MAX_PATH]; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-22 20:17:53 UTC (rev 544) @@ -2224,6 +2224,17 @@ return gFXInfo[ndx].dwEffect; } + +UINT CModDoc::GetEffectFromIndex(UINT ndx) +//---------------------------------------- +{ + if (ndx >= MAX_FXINFO) { + return 0; + } + + return gFXInfo[ndx].dwEffect; +} + UINT CModDoc::GetEffectMaskFromIndex(UINT ndx) //------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-03-22 20:17:53 UTC (rev 544) @@ -193,6 +193,7 @@ bool GetEffectInfo(UINT ndx, LPSTR s, bool bXX = false, DWORD *prangeMin=NULL, DWORD *prangeMax=NULL); LONG GetIndexFromEffect(UINT command, UINT param); UINT GetEffectFromIndex(UINT ndx, int &refParam); + UINT GetEffectFromIndex(UINT ndx); UINT GetEffectMaskFromIndex(UINT ndx); bool GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param); BOOL IsExtendedEffect(UINT ndx) const; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-22 20:17:53 UTC (rev 544) @@ -2481,7 +2481,8 @@ p = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + c; // 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. - if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) ||p->instr) && (p->instr!=nIns) ) { + // Do set instr if note is a PC note and instr is blank. + if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || MODCOMMAND::IsPcNote(p->note) || p->instr) && (p->instr!=nIns) ) { p->instr = nIns; bModified = TRUE; } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-22 20:17:53 UTC (rev 544) @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources +// German (Germany) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) #ifdef _WIN32 @@ -207,12 +207,12 @@ END #endif // APSTUDIO_INVOKED -#endif // Deutsch (Deutschland) resources +#endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// Englisch (USA) resources +// English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 @@ -1302,17 +1302,16 @@ PUSHBUTTON "Save",IDC_BUTTON2,193,39,36,14 END -IDD_EFFECTVISUALIZER DIALOGEX 0, 0, 385, 108 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +IDD_EFFECTVISUALIZER DIALOGEX 0, 0, 422, 109 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE CAPTION "Param Editor" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - EDITTEXT IDC_VISSTATUS,4,91,162,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE - CONTROL "Fill blanks with:",IDC_VISFILLBLANKS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,188,92,63,10 + EDITTEXT IDC_VISSTATUS,4,92,162,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE COMBOBOX IDC_VISEFFECTLIST,299,89,76,158,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_VISACTION,221,90,76,158,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "",IDC_RENDERZONE,4,3,377,84,NOT WS_VISIBLE + LTEXT "",IDC_RENDERZONE,4,3,414,84,NOT WS_VISIBLE END IDD_SOUNDBANK_INFO1 DIALOGEX 0, 0, 271, 167 @@ -1722,9 +1721,9 @@ IDD_EFFECTVISUALIZER, DIALOG BEGIN LEFTMARGIN, 4 - RIGHTMARGIN, 381 + RIGHTMARGIN, 418 TOPMARGIN, 3 - BOTTOMMARGIN, 103 + BOTTOMMARGIN, 104 END IDD_SOUNDBANK_INFO1, DIALOG @@ -1851,6 +1850,7 @@ IDB_ENVTOOLBAR BITMAP "res\\envbar.bmp" IDB_SMPTOOLBAR BITMAP "res\\smptoolb.bmp" IDB_VISNODE BITMAP "res\\bitmap1.bmp" +IDB_VISPCNODE BITMAP "res\\vispcnode.bmp" ///////////////////////////////////////////////////////////////////////////// // @@ -2378,12 +2378,12 @@ IDS_SOUNDTOUCH_LOADFAILURE "Unable to load OpenMPT_soundtouch_i16.dll." END -#endif // Englisch (USA) resources +#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// Englisch (GB) resources +// English (U.K.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) #ifdef _WIN32 @@ -2752,7 +2752,7 @@ // IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc" -#endif // Englisch (GB) resources +#endif // English (U.K.) resources ///////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-03-22 20:17:53 UTC (rev 544) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="mptrack" ProjectGUID="{21D95071-FB97-4E69-B3B1-050D0D4A5021}" RootNamespace="mptrack" @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" AdditionalOptions="/EHsc" Optimization="0" - AdditionalIncludeDirectories="..\unlha,..\unzip,..\unrar,..\soundlib,..\include,..\xsoundlib,..\" + AdditionalIncludeDirectories="..\unlha;..\unzip;..\unrar;..\soundlib;..\include;..\xsoundlib;..\" PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,NO_PACKING,HAVE_DOT_NET,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW,ENABLE_MMX" StringPooling="true" BasicRuntimeChecks="3" @@ -922,6 +922,14 @@ > </File> <File + RelativePath=".\res\visnode1.bmp" + > + </File> + <File + RelativePath=".\res\vispcnode.bmp" + > + </File> + <File RelativePath=".\res\vumeters.bmp" > </File> Added: trunk/OpenMPT/mptrack/res/vispcnode.bmp =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/mptrack/res/vispcnode.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/mptrack/resource.h 2010-03-22 20:17:53 UTC (rev 544) @@ -103,6 +103,8 @@ #define IDB_SPLASHTEST 432 #define IDB_SPLASHNOFOLDFIN 435 #define IDR_VSTMENU 436 +#define IDB_VISNODE1 436 +#define IDB_VISPCNODE 436 #define IDD_DEFAULTPLUGINEDITOR 438 #define IDD_CHANNELMANAGER 440 #define IDD_SOUNDBANK_INFO1 441 Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2010-03-21 22:07:22 UTC (rev 543) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2010-03-22 20:17:53 UTC (rev 544) @@ -119,9 +119,9 @@ 3:1070:0:71:1 //Base octave F#: G (KeyDown) 3:1071:0:66:1 //Base octave G: B (KeyDown) 3:1072:0:72:1 //Base octave G#: H (KeyDown) -3:1073:0:78:1 //Base octave +1 A: N (KeyDown) -3:1074:0:74:1 //Base octave +1 A#: J (KeyDown) -3:1075:0:77:1 //Base octave +1 B: M (KeyDown) +3:1073:0:78:1 //Base octave A: N (KeyDown) +3:1074:0:74:1 //Base octave A#: J (KeyDown) +3:1075:0:77:1 //Base octave B: M (KeyDown) 3:1076:0:81:1 //Base octave +1 C: Q (KeyDown) 3:1077:0:50:1 //Base octave +1 C#: 2 (KeyDown) 3:1078:0:87:1 //Base octave +1 D: W (KeyDown) @@ -131,9 +131,9 @@ 3:1082:0:53:1 //Base octave +1 F#: 5 (KeyDown) 3:1083:0:84:1 //Base octave +1 G: T (KeyDown) 3:1084:0:54:1 //Base octave +1 G#: 6 (KeyDown) -3:1085:0:89:1 //Base octave +2 A: Y (KeyDown) -3:1086:0:55:1 //Base octave +2 A#: 7 (KeyDown) -3:1087:0:85:1 //Base octave +2 B: U (KeyDown) +3:1085:0:89:1 //Base octave +1 A: Y (KeyDown) +3:1086:0:55:1 //Base octave +1 A#: 7 (KeyDown) +3:1087:0:85:1 //Base octave +1 B: U (KeyDown) 3:1088:0:73:1 //Base octave +2 C: I (KeyDown) 3:1089:0:57:1 //Base octave +2 C#: 9 (KeyDown) 3:1090:0:79:1 //Base octave +2 D: O (KeyDown) @@ -151,11 +151,13 @@ 3:1220:0:104:1 //Set octave 8: NUM 8 (KeyDown) 3:1221:0:105:1 //Set octave 9: NUM 9 (KeyDown) 3:1316:1:16:1 //Chord Modifier: Shift (KeyDown) -3:1200:0:49:1 //Note cut: 1 (KeyDown) -3:1201:0:223:1 //Note off: ` (KeyDown) -3:1201:0:187:1 //Note off: = (KeyDown) -3:1667:1:49:1 //Note cut (don't remember instrument): Shift+1 (KeyDown) -3:1668:1:223:1 //Note off (don't remember instrument): Shift+` (KeyDown) +3:1200:0:49:1 //Note Cut: 1 (KeyDown) +3:1201:0:223:1 //Note Off: ` (KeyDown) +3:1201:0:187:1 //Note Off: = (KeyDown) +3:1667:1:49:1 //Note Cut (don't remember instrument): Shift+1 (KeyDown) +3:1668:1:223:1 //Note Off (don't remember instrument): Shift+` (KeyDown) +3:1788:1:222:1 //Parameter control(MPTm only): Shift+# (KeyDown) +3:1789:0:222:1 //Parameter control(smooth)(MPTm only): # (KeyDown) //----( Pattern Context [bottom] - Ins Col (4) )------------ 4:1202:0:96:1 //Set instrument digit 0: NUM 0 (KeyDown) @@ -314,6 +316,6 @@ 19:1816:0:57:5 //Pattern index digit 9: 9 (KeyDown|KeyHold) 19:1816:0:105:5 //Pattern index digit 9: NUM 9 (KeyDown|KeyHold) 19:1817:0:107:5 //Increase pattern index : NUM PLUS (KeyDown|KeyHold) -19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) +19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-23 17:44:51
|
Revision: 546 http://modplug.svn.sourceforge.net/modplug/?rev=546&view=rev Author: saga-games Date: 2010-03-23 17:44:41 +0000 (Tue, 23 Mar 2010) Log Message: ----------- [Fix] Loaders: Some mod formats were erroneously converted to IT instead of XM since revision 532. [Fix] Multi window edit: When (un)muting a channel from the general tab in window 1, it was instantly shown in the pattern editor of window 2, but not vice versa. [Fix] XM Compatibility: Improved handling of the situation when a 3xx effect was used, but previously no note was playing. [Fix] Channel Manager: When removing channels using the channel manager, their names were not cleared properly. [Imp] S3M Loader: Display a message if an S3M file contains Adlib instruments (rare). [Imp] Effect vis: Make use of song's own row highlighting variables instead of fixed global ones. [Ref] Some more small internal changes. Revision Links: -------------- http://modplug.svn.sourceforge.net/modplug/?rev=532&view=rev Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -268,9 +268,9 @@ // Draw vertical grid lines for (UINT row=m_startRow; row<=m_endRow; row++) { - if (row % CMainFrame::m_nRowSpacing == 0) + if (row % m_pSndFile->m_nRowsPerMeasure == 0) CMainFrame::penScratch = CMainFrame::penGrayff; - else if (row % CMainFrame::m_nRowSpacing2 == 0) + else if (row % m_pSndFile->m_nRowsPerBeat == 0) CMainFrame::penScratch = CMainFrame::penGray99; else CMainFrame::penScratch = CMainFrame::penGray55; Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -189,10 +189,10 @@ void CInputHandler::SetupSpecialKeyInterception() { m_bInterceptWindowsKeys = m_bInterceptNumLock = m_bInterceptCapsLock = m_bInterceptScrollLock = false; - for( int context=0; context<sizeof(keyMap)/sizeof(keyMap[0]); context++ ) - for( int mod=0; mod<sizeof(keyMap[0])/sizeof(keyMap[0][0]); mod++ ) - for( int key=0; key<sizeof(keyMap[0][0])/sizeof(keyMap[0][0][0]); key++ ) - for( int kevent=0; kevent<sizeof(keyMap[0][0][0])/sizeof(keyMap[0][0][0][0]); kevent++ ) { + for( int context=0; context < ARRAYELEMCOUNT(keyMap); context++ ) + for( int mod=0; mod < ARRAYELEMCOUNT(keyMap[0]); mod++ ) + for( int key=0; key < ARRAYELEMCOUNT(keyMap[0][0]); key++ ) + for( int kevent=0; kevent < ARRAYELEMCOUNT(keyMap[0][0][0]); kevent++ ) { if( keyMap[context][mod][key][kevent] == kcNull ) continue; if( mod == HOTKEYF_EXT ) m_bInterceptWindowsKeys = true; if( key == VK_NUMLOCK ) m_bInterceptNumLock = true; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -337,17 +337,18 @@ case MOD_TYPE_MED: case MOD_TYPE_OKT: case MOD_TYPE_AMS: - case MOD_TYPE_MT2: - m_SndFile.ChangeModTypeTo(MOD_TYPE_IT); - /*m_SndFile.ChangeModTypeTo(MOD_TYPE_XM); + m_SndFile.ChangeModTypeTo(MOD_TYPE_XM); if ((m_SndFile.m_nDefaultTempo == 125) && (m_SndFile.m_nDefaultSpeed == 6) && (!m_SndFile.m_nInstruments)) { m_SndFile.m_nType = MOD_TYPE_MOD; for (UINT i=0; i<m_SndFile.Patterns.Size(); i++) if ((m_SndFile.Patterns[i]) && (m_SndFile.PatternSize[i] != 64)) m_SndFile.m_nType = MOD_TYPE_XM; - }*/ + } break; + case MOD_TYPE_MT2: + m_SndFile.ChangeModTypeTo(MOD_TYPE_IT); + break; case MOD_TYPE_FAR: case MOD_TYPE_PTM: case MOD_TYPE_STM: Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -592,8 +592,8 @@ tmpchn++; if (i >= nRemainingChannels) { + m_SndFile.InitChannel(i); m_SndFile.Chn[i].dwFlags |= CHN_MUTE; - m_SndFile.InitChannel(i); } } } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -13,8 +13,9 @@ #include "OpenGLEditor.h" //rewbs.fxvis #include "PatternGotoDialog.h" #include "PatternRandomizer.h" -#include ".\arrayutils.h" -#include ".\view_pat.h" +#include "arrayutils.h" +#include "view_pat.h" +#include "View_gen.h" #include "misc_util.h" #include "midi.h" #include <cmath> @@ -1106,8 +1107,10 @@ InvalidateChannelsHeaders(); } } - else if (!(nFlags&MK_CONTROL)) { - pModDoc->MuteChannel(nItemNo, (pSndFile->ChnSettings[nItemNo].dwFlags & CHN_MUTE) ? FALSE : TRUE); + else if (!(nFlags&MK_CONTROL)) + { + pModDoc->MuteChannel(nItemNo, (pSndFile->ChnSettings[nItemNo].dwFlags & CHN_MUTE) ? false : true); + pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | ((nItemNo / CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB)); } break; case DRAGITEM_PATTERNHEADER: @@ -2482,7 +2485,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. // Do set instr if note is a PC note and instr is blank. - if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || MODCOMMAND::IsPcNote(p->note) || p->instr) && (p->instr!=nIns) ) { + if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || p->IsPcNote() || p->instr) && (p->instr!=nIns) ) { p->instr = nIns; bModified = TRUE; } Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -68,6 +68,12 @@ BYTE channels[32]; } S3MFILEHEADER; +enum +{ + S3I_TYPE_NONE = 0, + S3I_TYPE_PCM = 1, + S3I_TYPE_ADMEL = 2, +}; void CSoundFile::S3MConvert(MODCOMMAND *m, BOOL bIT) const //-------------------------------------------------------- @@ -227,7 +233,7 @@ DWORD dwMemPos; BYTE insflags[128], inspack[128]; S3MFILEHEADER psfh = *(S3MFILEHEADER *)lpStream; - bool bKeepMidiMacros = false; + bool bKeepMidiMacros = false, bHasAdlibPatches = false; psfh.reserved1 = LittleEndianW(psfh.reserved1); psfh.ordnum = LittleEndianW(psfh.ordnum); @@ -355,7 +361,7 @@ lstrcpy(m_szNames[iSmp], (LPCSTR)&s[0x30]); SpaceToNullStringFixed(m_szNames[iSmp], 28); - if ((s[0]==1) && (s[0x4E]=='R') && (s[0x4F]=='S')) + if ((s[0] == S3I_TYPE_PCM) && (s[0x4E] == 'R') && (s[0x4F] == 'S')) { Samples[iSmp].nLength = CLAMP(LittleEndian(*((LPDWORD)(s + 0x10))), 4, MAX_SAMPLE_LENGTH); Samples[iSmp].nLoopStart = CLAMP(LittleEndian(*((LPDWORD)(s + 0x14))), 0, Samples[iSmp].nLength - 1); @@ -381,6 +387,9 @@ Samples[iSmp].nLoopStart = Samples[iSmp].nLoopEnd = 0; Samples[iSmp].nPan = 0x80; //ASSERT(iLooplength == 0 || iLooplength > 4); + } else if(s[0] == S3I_TYPE_ADMEL) + { + bHasAdlibPatches = true; } } @@ -489,7 +498,7 @@ } // Reading samples - for (UINT iRaw=1; iRaw<=insnum; iRaw++) if ((Samples[iRaw].nLength) && (insfile[iRaw])) + for (UINT iRaw = 1; iRaw <= insnum; iRaw++) if ((Samples[iRaw].nLength) && (insfile[iRaw])) { UINT flags = (psfh.version == 1) ? RS_PCM8S : RS_PCM8U; if (insflags[iRaw-1] & 4) flags += 5; @@ -502,6 +511,13 @@ m_nMaxPeriod = 32767; if (psfh.flags & 0x10) m_dwSongFlags |= SONG_AMIGALIMITS; +#ifdef MODPLUG_TRACKER + if(bHasAdlibPatches) + { + ::MessageBox(0, "This track uses Adlib instruments, which are not supported by OpenMPT.", "OpenMPT S3M Import", MB_OK|MB_ICONEXCLAMATION); + } +#endif + return true; } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -693,8 +693,10 @@ } } - if ((!bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2))) { - if (pSmp) { + if ((!bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2))) + { + if (pSmp) + { pChn->nTranspose = pSmp->RelativeTone; pChn->nFineTune = pSmp->nFineTune; } @@ -702,9 +704,12 @@ // IT Compatibility: Update multisample instruments frequency even if instrument is not specified if(!bPorta && pSmp && IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nC5Speed = pSmp->nC5Speed; - // XM Compatibility: Ignore notes with portamento if there was no note - if(bPorta && (pChn->nPeriod == 0) && IsCompatibleMode(TRK_FASTTRACKER2)) + // XM Compatibility: Ignore notes with portamento if there was no note playing. + if(bPorta && (pChn->pCurrentSample == nullptr) && IsCompatibleMode(TRK_FASTTRACKER2)) + { + pChn->nPeriod = 0; return; + } if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) note += pChn->nTranspose; note = CLAMP(note, 1, 132); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-22 21:03:07 UTC (rev 545) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-23 17:44:41 UTC (rev 546) @@ -1494,7 +1494,7 @@ } void CSoundFile::ResetChannelState(CHANNELINDEX i, BYTE resetMask) -//------------------------------------------------------- +//---------------------------------------------------------------- { if(i >= MAX_CHANNELS) return; @@ -1571,7 +1571,7 @@ CHANNELINDEX CSoundFile::ReArrangeChannels(const vector<CHANNELINDEX>& newOrder) -//------------------------------------------------------------------- +//------------------------------------------------------------------------------ { //newOrder[i] tells which current channel should be placed to i:th position in //the new order, or if i is not an index of current channels, then new channel is @@ -1639,14 +1639,14 @@ { if(newOrder[nChn] < m_nChannels) { - ChnSettings[nChn] = settings[newOrder[nChn]]; - Chn[nChn] = chns[newOrder[nChn]]; - if(m_pModDoc) - { - if(recordStates[newOrder[nChn]] == 1) m_pModDoc->Record1Channel(nChn, true); - if(recordStates[newOrder[nChn]] == 2) m_pModDoc->Record2Channel(nChn, true); - } - m_bChannelMuteTogglePending[nChn] = chnMutePendings[newOrder[nChn]]; + ChnSettings[nChn] = settings[newOrder[nChn]]; + Chn[nChn] = chns[newOrder[nChn]]; + if(m_pModDoc) + { + if(recordStates[newOrder[nChn]] == 1) m_pModDoc->Record1Channel(nChn, true); + if(recordStates[newOrder[nChn]] == 2) m_pModDoc->Record2Channel(nChn, true); + } + m_bChannelMuteTogglePending[nChn] = chnMutePendings[newOrder[nChn]]; } else { @@ -1657,6 +1657,14 @@ SetupMODPanning(); m_nChannels = nRemainingChannels; + + // Reset removed channels. Most notably, clear the channel name. + for(CHANNELINDEX nChn = m_nChannels; nChn < MAX_BASECHANNELS; nChn++) + { + InitChannel(nChn); + Chn[nChn].dwFlags |= CHN_MUTE; + } + END_CRITICAL(); return static_cast<CHANNELINDEX>(m_nChannels); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-25 22:36:13
|
Revision: 550 http://modplug.svn.sourceforge.net/modplug/?rev=550&view=rev Author: saga-games Date: 2010-03-25 22:36:06 +0000 (Thu, 25 Mar 2010) Log Message: ----------- [Fix] Module Conversion: When removing instruments from the treeview and converting the module to a different format which also supports instruments, OpenMPT crashed due to a null pointer exception. [Fix] Treeview: Soundfont samples were not playing correctly anymore. Note that soundfont samples in the MIDI library still don't work. [Fix] Length Calculation: If the first pattern was empty, OpenMPT was caught in an infinite loop. [Ref] Minor refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj Removed Paths: ------------- trunk/OpenMPT/zlib/gzio.c Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2010-03-25 22:36:06 UTC (rev 550) @@ -23,7 +23,7 @@ void MapTranspose(int nAmount); public: - CNoteMapWnd() { m_nPlayingNote=-1; m_nNote = 5*12; m_pModDoc = NULL; m_nInstrument = 0; m_bIns = FALSE; m_cxFont = m_cyFont = 0; m_hFont = NULL; m_nOldNote = m_nOldIns = 0; m_pParent = NULL; } + CNoteMapWnd() { m_nPlayingNote=-1; m_nNote = NOTE_MIDDLEC - 1; m_pModDoc = NULL; m_nInstrument = 0; m_bIns = FALSE; m_cxFont = m_cyFont = 0; m_hFont = NULL; m_nOldNote = m_nOldIns = 0; m_pParent = NULL; } BOOL SetCurrentInstrument(CModDoc *pModDoc, UINT nIns); BOOL SetCurrentNote(UINT nNote); VOID Init(CCtrlInstruments *pParent) { m_pParent = pParent; } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-25 22:36:06 UTC (rev 550) @@ -1060,7 +1060,7 @@ if ((m_pSndFile) && (m_pModDoc) && (!IsLocked())) { CHAR s[256], sold[128] = ""; - UINT nPat = SendViewMessage(VIEWMSG_GETCURRENTPATTERN); + PATTERNINDEX nPat = (PATTERNINDEX)SendViewMessage(VIEWMSG_GETCURRENTPATTERN); m_EditPatName.GetWindowText(s, MAX_PATTERNNAME); s[MAX_PATTERNNAME-1] = 0; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-25 22:36:06 UTC (rev 550) @@ -1983,7 +1983,7 @@ if (CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn)) { PlaySoundFile(&m_WaveFile); - m_WaveFile.SetRepeatCount(0); + m_WaveFile.SetRepeatCount(-1); } EndWaitCursor(); return TRUE; @@ -1994,7 +1994,7 @@ //------------------------------------------------------------- { CMappedFile f; - BOOL bOk = FALSE; + bool bOk = false; if (lpszFileName) { @@ -2029,7 +2029,7 @@ m_WaveFile.Patterns.Insert(1,64); if (m_WaveFile.Patterns[0]) { - if (!nNote) nNote = 5*12+1; + if (!nNote) nNote = NOTE_MIDDLEC; MODCOMMAND *m = m_WaveFile.Patterns[0]; m[0].note = (BYTE)nNote; m[0].instr = 1; @@ -2052,10 +2052,10 @@ if ((m_WaveFile.m_nSamples > 1) || (m_WaveFile.Samples[1].uFlags & CHN_LOOP)) { MODCOMMAND *m = m_WaveFile.Patterns[0]; - m[32*4].note = 0xFF; - m[32*4+1].note = 0xFF; - m[63*4].note = 0xFE; - m[63*4+1].note = 0xFE; + m[32*4].note = NOTE_KEYOFF; + m[32*4+1].note = NOTE_KEYOFF; + m[63*4].note = NOTE_NOTECUT; + m[63*4+1].note = NOTE_NOTECUT; } else { MODCOMMAND *m = m_WaveFile.Patterns[1]; @@ -2065,7 +2065,7 @@ m[63*4].param = 1; } } - bOk = PlaySoundFile(&m_WaveFile); + bOk = PlaySoundFile(&m_WaveFile) ? true : false; } } f.Close(); @@ -2975,7 +2975,7 @@ //end rewbs.fix3116 void CMainFrame::OnShowWindow(BOOL bShow, UINT /*nStatus*/) -//----------------------------------------------------- +//--------------------------------------------------------- { static bool firstShow = true; if (bShow && !IsWindowVisible() && firstShow) { @@ -3008,7 +3008,7 @@ ///////////////////////////////////////////// void AddPluginNamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN* plugarray, const bool librarynames) -//--------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- { #ifndef NO_VST for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++) @@ -3027,7 +3027,7 @@ } void AddPluginParameternamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN& plug) -//---------------------------------------------------------------------------- +//------------------------------------------------------------------------- { if(plug.pMixPlugin) AddPluginParameternamesToCombobox(CBox, *(CVstPlugin *)plug.pMixPlugin); @@ -3051,7 +3051,7 @@ // TODO: Let some magic happen to convert between absolute and relative paths. m_csExecutableDirectoryPath might be helpful void CMainFrame::SetDirectory(const LPCTSTR szFilenameFrom, Directory dir, TCHAR (&directories)[NUM_DIRS][_MAX_PATH], bool bStripFilename) -//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------------------------------- { TCHAR szPath[_MAX_PATH], szDir[_MAX_DIR]; @@ -3079,28 +3079,28 @@ } void CMainFrame::SetDefaultDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename) -//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------- { SetDirectory(szFilenameFrom, dir, m_szDefaultDirectory, bStripFilename); } void CMainFrame::SetWorkingDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename) -//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------- { SetDirectory(szFilenameFrom, dir, m_szWorkingDirectory, bStripFilename); } LPCTSTR CMainFrame::GetDefaultDirectory(Directory dir) -//---------------------------------------------------------------------------- +//---------------------------------------------------- { return m_szDefaultDirectory[dir]; } LPCTSTR CMainFrame::GetWorkingDirectory(Directory dir) -//---------------------------------------------------------------------------- +//---------------------------------------------------- { return m_szWorkingDirectory[dir]; } Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-25 22:36:06 UTC (rev 550) @@ -416,11 +416,11 @@ m_SndFile.m_nDefaultSpeed = CLAMP(m_SndFile.m_nDefaultSpeed, specs.speedMin, specs.speedMax); bool bTrimmedEnvelopes = false; - for(INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++) + for(INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++) if(m_SndFile.Instruments[i] != nullptr) { - bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->VolEnv); - bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->PanEnv); - bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->PitchEnv); + bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->VolEnv)); + bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->PanEnv)); + bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->PitchEnv)); } if(bTrimmedEnvelopes == true) AddToLog("WARNING: Instrument envelopes have been shortened.\n"); @@ -708,7 +708,7 @@ for (UINT j=0; j<m_SndFile.Order.size(); j++) { if (m_SndFile.Order[j] == i) break; - if (m_SndFile.Order[j] == m_SndFile.Order.GetInvalidPatIndex()) + if (m_SndFile.Order[j] == m_SndFile.Order.GetInvalidPatIndex() && nOrd == ORDERINDEX_INVALID) { m_SndFile.Order[j] = i; break; Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-25 22:36:06 UTC (rev 550) @@ -47,14 +47,14 @@ bool CSoundFile::ReadSampleAsInstrument(INSTRUMENTINDEX nInstr, LPBYTE lpMemFile, DWORD dwFileLength) //--------------------------------------------------------------------------------------------------- { - LPDWORD psig = (LPDWORD)lpMemFile; + uint32 *psig = (uint32 *)lpMemFile; if ((!lpMemFile) || (dwFileLength < 128)) return false; - if (((psig[0] == 0x46464952) && (psig[2] == 0x45564157)) // RIFF....WAVE signature - || ((psig[0] == 0x5453494C) && (psig[2] == 0x65766177)) // LIST....wave - || (psig[76/4] == 0x53524353) // S3I signature - || ((psig[0] == 0x4D524F46) && (psig[2] == 0x46464941)) // AIFF signature - || ((psig[0] == 0x4D524F46) && (psig[2] == 0x58565338)) // 8SVX signature - || (psig[0] == 0x53504D49) // ITS signature + if (((psig[0] == LittleEndian(0x46464952)) && (psig[2] == LittleEndian(0x45564157))) // RIFF....WAVE signature + || ((psig[0] == LittleEndian(0x5453494C)) && (psig[2] == LittleEndian(0x65766177))) // LIST....wave + || (psig[76/4] == LittleEndian(0x53524353)) // S3I signature + || ((psig[0] == LittleEndian(0x4D524F46)) && (psig[2] == LittleEndian(0x46464941))) // AIFF signature + || ((psig[0] == LittleEndian(0x4D524F46)) && (psig[2] == LittleEndian(0x58565338))) // 8SVX signature + || (psig[0] == LittleEndian(0x53504D49)) // ITS signature ) { // Loading Instrument Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-25 22:36:06 UTC (rev 550) @@ -140,7 +140,10 @@ // End of song ? if ((nPattern == Order.GetInvalidPatIndex()) || (nCurrentPattern >= Order.size())) { - nCurrentPattern = m_nRestartPos; + if(nCurrentPattern == m_nRestartPos) + break; + else + nCurrentPattern = m_nRestartPos; } else { nCurrentPattern++; @@ -151,6 +154,9 @@ // Skip non-existing patterns if ((nPattern >= Patterns.Size()) || (!Patterns[nPattern])) { + // If there isn't even a tune, we should probably stop here. + if(nCurrentPattern == m_nRestartPos) + break; nNextPattern = nCurrentPattern + 1; continue; } Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj =================================================================== --- trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-25 22:36:06 UTC (rev 550) @@ -26,7 +26,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="UpgradeFromVC70.vsprops" + InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -99,7 +99,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="UpgradeFromVC70.vsprops" + InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -173,7 +173,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="UpgradeFromVC70.vsprops" + InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -762,10 +762,6 @@ </FileConfiguration> </File> <File - RelativePath="..\..\..\gzio.c" - > - </File> - <File RelativePath="..\..\..\infback.c" > </File> Deleted: trunk/OpenMPT/zlib/gzio.c =================================================================== --- trunk/OpenMPT/zlib/gzio.c 2010-03-24 19:25:32 UTC (rev 549) +++ trunk/OpenMPT/zlib/gzio.c 2010-03-25 22:36:06 UTC (rev 550) @@ -1,1026 +0,0 @@ -/* gzio.c -- IO on .gz files - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. - */ - -/* @(#) $Id$ */ - -#include <stdio.h> - -#include "zutil.h" - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef Z_BUFSIZE -# ifdef MAXSEG_64K -# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ -# else -# define Z_BUFSIZE 16384 -# endif -#endif -#ifndef Z_PRINTF_BUFSIZE -# define Z_PRINTF_BUFSIZE 4096 -#endif - -#ifdef __MVS__ -# pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern void free OF((voidpf ptr)); -#endif - -#define ALLOC(size) malloc(size) -#define TRYFREE(p) {if (p) free(p);} - -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define RESERVED 0xE0 /* bits 5..7: reserved */ - -typedef struct gz_stream { - z_stream stream; - int z_err; /* error code for last stream operation */ - int z_eof; /* set if end of input file */ - FILE *file; /* .gz file */ - Byte *inbuf; /* input buffer */ - Byte *outbuf; /* output buffer */ - uLong crc; /* crc32 of uncompressed data */ - char *msg; /* error message */ - char *path; /* path name for debugging only */ - int transparent; /* 1 if input file is not a .gz file */ - char mode; /* 'w' or 'r' */ - z_off_t start; /* start of compressed data in file (header skipped) */ - z_off_t in; /* bytes into deflate or inflate */ - z_off_t out; /* bytes out of deflate or inflate */ - int back; /* one character push-back */ - int last; /* true if push-back is last character */ -} gz_stream; - - -local gzFile gz_open OF((const char *path, const char *mode, int fd)); -local int do_flush OF((gzFile file, int flush)); -local int get_byte OF((gz_stream *s)); -local void check_header OF((gz_stream *s)); -local int destroy OF((gz_stream *s)); -local void putLong OF((FILE *file, uLong x)); -local uLong getLong OF((gz_stream *s)); - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb"). The file is given either by file descriptor - or path name (if fd == -1). - gz_open returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -*/ -local gzFile gz_open (path, mode, fd) - const char *path; - const char *mode; - int fd; -{ - int err; - int level = Z_DEFAULT_COMPRESSION; /* compression level */ - int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ - char *p = (char*)mode; - gz_stream *s; - char fmode[80]; /* copy of mode, without the compression level */ - char *m = fmode; - - if (!path || !mode) return Z_NULL; - - s = (gz_stream *)ALLOC(sizeof(gz_stream)); - if (!s) return Z_NULL; - - s->stream.zalloc = (alloc_func)0; - s->stream.zfree = (free_func)0; - s->stream.opaque = (voidpf)0; - s->stream.next_in = s->inbuf = Z_NULL; - s->stream.next_out = s->outbuf = Z_NULL; - s->stream.avail_in = s->stream.avail_out = 0; - s->file = NULL; - s->z_err = Z_OK; - s->z_eof = 0; - s->in = 0; - s->out = 0; - s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); - s->msg = NULL; - s->transparent = 0; - - s->path = (char*)ALLOC(strlen(path)+1); - if (s->path == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - strcpy(s->path, path); /* do this early for debugging */ - - s->mode = '\0'; - do { - if (*p == 'r') s->mode = 'r'; - if (*p == 'w' || *p == 'a') s->mode = 'w'; - if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else if (*p == 'R') { - strategy = Z_RLE; - } else { - *m++ = *p; /* copy the mode */ - } - } while (*p++ && m != fmode + sizeof(fmode)); - if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateInit2(&(s->stream), level, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); - /* windowBits is passed < 0 to suppress zlib header */ - - s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); -#endif - if (err != Z_OK || s->outbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } else { - s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); - - err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are - * present after the compressed stream. - */ - if (err != Z_OK || s->inbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } - s->stream.avail_out = Z_BUFSIZE; - - errno = 0; - s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); - - if (s->file == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - if (s->mode == 'w') { - /* Write a very simple .gz header: - */ - fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->start = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an - * fflush on some systems. This version of the library doesn't use - * start anyway in write mode, so this initialization is not - * necessary. - */ - } else { - check_header(s); /* skip the .gz header */ - s->start = ftell(s->file) - s->stream.avail_in; - } - - return (gzFile)s; -} - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. -*/ -gzFile ZEXPORT gzopen (path, mode) - const char *path; - const char *mode; -{ - return gz_open (path, mode, -1); -} - -/* =========================================================================== - Associate a gzFile with the file descriptor fd. fd is not dup'ed here - to mimic the behavio(u)r of fdopen. -*/ -gzFile ZEXPORT gzdopen (fd, mode) - int fd; - const char *mode; -{ - char name[46]; /* allow for up to 128-bit integers */ - - if (fd < 0) return (gzFile)Z_NULL; - sprintf(name, "<fd:%d>", fd); /* for debugging */ - - return gz_open (name, mode, fd); -} - -/* =========================================================================== - * Update the compression level and strategy - */ -int ZEXPORT gzsetparams (file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - /* Make room to allow flushing */ - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; - } - - return deflateParams (&(s->stream), level, strategy); -} - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ -local int get_byte(s) - gz_stream *s; -{ - if (s->z_eof) return EOF; - if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; - } - s->stream.avail_in--; - return *(s->stream.next_in)++; -} - -/* =========================================================================== - Check the gzip header of a gz_stream opened for reading. Set the stream - mode to transparent if the gzip magic header is not present; set s->err - to Z_DATA_ERROR if the magic header is present but the rest of the header - is incorrect. - IN assertion: the stream s has already been created sucessfully; - s->stream.avail_in is zero for the first time, but may be non-zero - for concatenated .gz files. -*/ -local void check_header(s) - gz_stream *s; -{ - int method; /* method byte */ - int flags; /* flags byte */ - uInt len; - int c; - - /* Assure two bytes in the buffer so we can peek ahead -- handle case - where first byte of header is at the end of the buffer after the last - gzip segment */ - len = s->stream.avail_in; - if (len < 2) { - if (len) s->inbuf[0] = s->stream.next_in[0]; - errno = 0; - len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); - if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; - s->stream.avail_in += len; - s->stream.next_in = s->inbuf; - if (s->stream.avail_in < 2) { - s->transparent = s->stream.avail_in; - return; - } - } - - /* Peek ahead to check the gzip magic header */ - if (s->stream.next_in[0] != gz_magic[0] || - s->stream.next_in[1] != gz_magic[1]) { - s->transparent = 1; - return; - } - s->stream.avail_in -= 2; - s->stream.next_in += 2; - - /* Check the rest of the gzip header */ - method = get_byte(s); - flags = get_byte(s); - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; - } - - /* Discard time, xflags and OS code: */ - for (len = 0; len < 6; len++) (void)get_byte(s); - - if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; - } - if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); - } - s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; -} - - /* =========================================================================== - * Cleanup then free the given gz_stream. Return a zlib error code. - Try freeing in the reverse order of allocations. - */ -local int destroy (s) - gz_stream *s; -{ - int err = Z_OK; - - if (!s) return Z_STREAM_ERROR; - - TRYFREE(s->msg); - - if (s->stream.state != NULL) { - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateEnd(&(s->stream)); -#endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } - } - if (s->file != NULL && fclose(s->file)) { -#ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ -#endif - err = Z_ERRNO; - } - if (s->z_err < 0) err = s->z_err; - - TRYFREE(s->inbuf); - TRYFREE(s->outbuf); - TRYFREE(s->path); - TRYFREE(s); - return err; -} - -/* =========================================================================== - Reads the given number of uncompressed bytes from the compressed file. - gzread returns the number of bytes actually read (0 for end of file). -*/ -int ZEXPORT gzread (file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - Bytef *start = (Bytef*)buf; /* starting point for crc computation */ - Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ - - if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; - - if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; - if (s->z_err == Z_STREAM_END) return 0; /* EOF */ - - next_out = (Byte*)buf; - s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; - - if (s->stream.avail_out && s->back != EOF) { - *next_out++ = s->back; - s->stream.next_out++; - s->stream.avail_out--; - s->back = EOF; - s->out++; - start++; - if (s->last) { - s->z_err = Z_STREAM_END; - return 1; - } - } - - while (s->stream.avail_out != 0) { - - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= - (uInt)fread(next_out, 1, s->stream.avail_out, s->file); - } - len -= s->stream.avail_out; - s->in += len; - s->out += len; - if (len == 0) s->z_eof = 1; - return (int)len; - } - if (s->stream.avail_in == 0 && !s->z_eof) { - - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) { - s->z_err = Z_ERRNO; - break; - } - } - s->stream.next_in = s->inbuf; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; - - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); - /* The uncompressed length returned by above getlong() may be - * different from s->out in case of concatenated .gz files. - * Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - inflateReset(&(s->stream)); - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; - } - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - - if (len == s->stream.avail_out && - (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) - return -1; - return (int)(len - s->stream.avail_out); -} - - -/* =========================================================================== - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ -int ZEXPORT gzgetc(file) - gzFile file; -{ - unsigned char c; - - return gzread(file, &c, 1) == 1 ? c : -1; -} - - -/* =========================================================================== - Push one byte back onto the stream. -*/ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; - s->back = c; - s->out--; - s->last = (s->z_err == Z_STREAM_END); - if (s->last) s->z_err = Z_OK; - s->z_eof = 0; - return c; -} - - -/* =========================================================================== - Reads bytes from the compressed file until len-1 characters are - read, or a newline character is read and transferred to buf, or an - end-of-file condition is encountered. The string is then terminated - with a null character. - gzgets returns buf, or Z_NULL in case of error. - - The current implementation is not optimized at all. -*/ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - char *b = buf; - if (buf == Z_NULL || len <= 0) return Z_NULL; - - while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; - *buf = '\0'; - return b == buf && len > 0 ? Z_NULL : b; -} - - -#ifndef NO_GZCOMPRESS -/* =========================================================================== - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of bytes actually written (0 in case of error). -*/ -int ZEXPORT gzwrite (file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.next_in = (Bytef*)buf; - s->stream.avail_in = len; - - while (s->stream.avail_in != 0) { - - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - break; - } - s->stream.avail_out = Z_BUFSIZE; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - if (s->z_err != Z_OK) break; - } - s->crc = crc32(s->crc, (const Bytef *)buf, len); - - return (int)(len - s->stream.avail_in); -} - - -/* =========================================================================== - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ -#ifdef STDC -#include <stdarg.h> - -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) -{ - char buf[Z_PRINTF_BUFSIZE]; - va_list va; - int len; - - buf[sizeof(buf) - 1] = 0; - va_start(va, format); -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(buf, format, va); - va_end(va); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = vsprintf(buf, format, va); - va_end(va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(buf, sizeof(buf), format, va); - va_end(va); - len = strlen(buf); -# else - len = vsnprintf(buf, sizeof(buf), format, va); - va_end(va); -# endif -#endif - if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, (unsigned)len); -} -#else /* not ANSI C */ - -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - char buf[Z_PRINTF_BUFSIZE]; - int len; - - buf[sizeof(buf) - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(buf); -# else - len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, len); -} -#endif - -/* =========================================================================== - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char cc = (unsigned char) c; /* required for big endian systems */ - - return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; -} - - -/* =========================================================================== - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ -int ZEXPORT gzputs(file, s) - gzFile file; - const char *s; -{ - return gzwrite(file, (char*)s, (unsigned)strlen(s)); -} - - -/* =========================================================================== - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. -*/ -local int do_flush (file, flush) - gzFile file; - int flush; -{ - uInt len; - int done = 0; - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.avail_in = 0; /* should be zero already anyway */ - - for (;;) { - len = Z_BUFSIZE - s->stream.avail_out; - - if (len != 0) { - if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { - s->z_err = Z_ERRNO; - return Z_ERRNO; - } - s->stream.next_out = s->outbuf; - s->stream.avail_out = Z_BUFSIZE; - } - if (done) break; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), flush); - s->out -= s->stream.avail_out; - - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; - - /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: - */ - done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - - if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; - } - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} - -int ZEXPORT gzflush (file, flush) - gzFile file; - int flush; -{ - gz_stream *s = (gz_stream*)file; - int err = do_flush (file, flush); - - if (err) return err; - fflush(s->file); - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} -#endif /* NO_GZCOMPRESS */ - -/* =========================================================================== - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error. - SEEK_END is not implemented, returns error. - In this version of the library, gzseek can be extremely slow. -*/ -z_off_t ZEXPORT gzseek (file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; - } - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return -1L; -#else - if (whence == SEEK_SET) { - offset -= s->in; - } - if (offset < 0) return -1L; - - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - if (s->inbuf == Z_NULL) return -1L; - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; - - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; - - offset -= size; - } - return s->in; -#endif - } - /* Rest of function is for reading only */ - - /* compute absolute position */ - if (whence == SEEK_CUR) { - offset += s->out; - } - if (offset < 0) return -1L; - - if (s->transparent) { - /* map to fseek */ - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - - s->in = s->out = offset; - return offset; - } - - /* For a negative seek, rewind and use positive seek */ - if (offset >= s->out) { - offset -= s->out; - } else if (gzrewind(file) < 0) { - return -1L; - } - /* offset is now the number of bytes to skip. */ - - if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); - if (s->outbuf == Z_NULL) return -1L; - } - if (offset && s->back != EOF) { - s->back = EOF; - s->out++; - offset--; - if (s->last) s->z_err = Z_STREAM_END; - } - while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; - - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; - } - return s->out; -} - -/* =========================================================================== - Rewinds input file. -*/ -int ZEXPORT gzrewind (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return -1; - - s->z_err = Z_OK; - s->z_eof = 0; - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - s->crc = crc32(0L, Z_NULL, 0); - if (!s->transparent) (void)inflateReset(&s->stream); - s->in = 0; - s->out = 0; - return fseek(s->file, s->start, SEEK_SET); -} - -/* =========================================================================== - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -*/ -z_off_t ZEXPORT gztell (file) - gzFile file; -{ - return gzseek(file, 0L, SEEK_CUR); -} - -/* =========================================================================== - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ -int ZEXPORT gzeof (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - /* With concatenated compressed files that can have embedded - * crc trailers, z_eof is no longer the only/best indicator of EOF - * on a gz_stream. Handle end-of-stream error explicitly here. - */ - if (s == NULL || s->mode != 'r') return 0; - if (s->z_eof) return 1; - return s->z_err == Z_STREAM_END; -} - -/* =========================================================================== - Returns 1 if reading and doing so transparently, otherwise zero. -*/ -int ZEXPORT gzdirect (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return 0; - return s->transparent; -} - -/* =========================================================================== - Outputs a long in LSB order to the given file -*/ -local void putLong (file, x) - FILE *file; - uLong x; -{ - int n; - for (n = 0; n < 4; n++) { - fputc((int)(x & 0xff), file); - x >>= 8; - } -} - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets z_err in case - of error. -*/ -local uLong getLong (s) - gz_stream *s; -{ - uLong x = (uLong)get_byte(s); - int c; - - x += ((uLong)get_byte(s))<<8; - x += ((uLong)get_byte(s))<<16; - c = get_byte(s); - if (c == EOF) s->z_err = Z_DATA_ERROR; - x += ((uLong)c)<<24; - return x; -} - -/* =========================================================================== - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. -*/ -int ZEXPORT gzclose (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return Z_STREAM_ERROR; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return Z_STREAM_ERROR; -#else - if (do_flush (file, Z_FINISH) != Z_OK) - return destroy((gz_stream*)file); - - putLong (s->file, s->crc); - putLong (s->file, (uLong)(s->in & 0xffffffff)); -#endif - } - return destroy((gz_stream*)file); -} - -#ifdef STDC -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -/* =========================================================================== - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ -const char * ZEXPORT gzerror (file, errnum) - gzFile file; - int *errnum; -{ - char *m; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) { - *errnum = Z_STREAM_ERROR; - return (const char*)ERR_MSG(Z_STREAM_ERROR); - } - *errnum = s->z_err; - if (*errnum == Z_OK) return (const char*)""; - - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); - - if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); - - TRYFREE(s->msg); - s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); - if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); - strcpy(s->msg, s->path); - strcat(s->msg, ": "); - strcat(s->msg, m); - return (const char*)s->msg; -} - -/* =========================================================================== - Clear the error and end-of-file flags, and do the same for the real file. -*/ -void ZEXPORT gzclearerr (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return; - if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; - s->z_eof = 0; - clearerr(s->file); -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-26 13:23:10
|
Revision: 551 http://modplug.svn.sourceforge.net/modplug/?rev=551&view=rev Author: saga-games Date: 2010-03-26 13:23:03 +0000 (Fri, 26 Mar 2010) Log Message: ----------- [New] Treeview: Sequences can now be copied to other modules by simply dragging the sequence header into the the other module's sequence header. Does only work between two different modules, not within the same module. [Ref] Minor refacotring; AddSequence() now returns the new sequence index for ease of use. Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/ModSequence.h Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-26 13:23:03 UTC (rev 551) @@ -1770,8 +1770,7 @@ ORDERINDEX startOrd = nOrd; modified = true; - m_SndFile.Order.AddSequence(false); - SEQUENCEINDEX newSeq = m_SndFile.Order.GetNumSequences() - 1; + SEQUENCEINDEX newSeq = m_SndFile.Order.AddSequence(false); m_SndFile.Order.SetSequence(newSeq); // resize new seqeuence if necessary Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-26 13:23:03 UTC (rev 551) @@ -96,6 +96,7 @@ DRAGONDROP_PATTERN, // | Pattern from a song | Pattern # | NULL | DRAGONDROP_ORDER, // | Pattern index in a song | Order # | NULL | DRAGONDROP_SONG, // | Song file (mod/s3m/xm/it) | 0 | pszFileName | + DRAGONDROP_SEQUENCE // | Sequence (a set of orders) | Sequence # | NULL | }; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-26 13:23:03 UTC (rev 551) @@ -1940,6 +1940,11 @@ pdropinfo->dwDropType = DRAGONDROP_INSTRUMENT; break; + case MODITEM_SEQUENCE: + case MODITEM_HDR_ORDERS: + pdropinfo->dwDropType = DRAGONDROP_SEQUENCE; + break; + case MODITEM_INSLIB_SAMPLE: case MODITEM_INSLIB_INSTRUMENT: if (m_szSongName[0]) @@ -2000,7 +2005,7 @@ } -BOOL CModTree::CanDrop(HTREEITEM hItem, BOOL bDoDrop) +bool CModTree::CanDrop(HTREEITEM hItem, bool bDoDrop) //--------------------------------------------------- { const uint64 modItemDrop = GetModItem(hItem); @@ -2010,14 +2015,18 @@ const uint32 modItemDragType = GetModItemType(m_qwItemDrag); const uint32 modItemDragID = GetModItemID(m_qwItemDrag); - PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx]; - CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL; + const PMODTREEDOCINFO pInfoDrag = DocInfo[m_nDragDocNdx]; + const PMODTREEDOCINFO pInfoDrop = DocInfo[m_nDocNdx]; + CModDoc *pModDoc = (pInfoDrop) ? pInfoDrop->pModDoc : nullptr; + CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; + switch(modItemDropType) { case MODITEM_ORDER: case MODITEM_SEQUENCE: - if ((modItemDragType == MODITEM_ORDER) && (pModDoc) && (m_nDocNdx == m_nDragDocNdx)) + if ((modItemDragType == MODITEM_ORDER) && (pModDoc) && (pSndFile) && (m_nDocNdx == m_nDragDocNdx)) { + // drop an order somewhere if (bDoDrop) { SEQUENCEINDEX nSeqFrom = (SEQUENCEINDEX)(modItemDragID >> 16), nSeqTo = (SEQUENCEINDEX)(modItemDropID >> 16); @@ -2026,7 +2035,7 @@ { // drop on sequence -> attach nSeqTo = (SEQUENCEINDEX)(modItemDropID & 0xFFFF); - nOrdTo = pModDoc->GetSoundFile()->Order.GetSequence(nSeqTo).GetLengthTailTrimmed(); + nOrdTo = pSndFile->Order.GetSequence(nSeqTo).GetLengthTailTrimmed(); } if (nSeqFrom != nSeqTo || nOrdFrom != nOrdTo) @@ -2037,9 +2046,36 @@ } } } - return TRUE; + return true; } break; + case MODITEM_HDR_ORDERS: + // Drop your sequences here. + // At the moment, only dropping sequences into another module is possible. + if((modItemDragType == MODITEM_SEQUENCE || modItemDragType == MODITEM_HDR_ORDERS) && pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pInfoDrag && pModDoc != pInfoDrag->pModDoc) + { + if(bDoDrop) + { + // copy mod sequence over. + CModDoc *pDragDoc = pInfoDrag->pModDoc; + if(pDragDoc == nullptr) return false; + CSoundFile *pDragSndFile = pDragDoc->GetSoundFile(); + if(pDragSndFile == nullptr) return false; + const SEQUENCEINDEX nOrigSeq = (SEQUENCEINDEX)modItemDragID; + const ModSequence *pOrigSeq = &(pDragSndFile->Order.GetSequence(nOrigSeq)); + if(pOrigSeq == nullptr) return false; + + pSndFile->Order.AddSequence(false); + pSndFile->Order.resize(pOrigSeq->GetLength(), pSndFile->Order.GetInvalidPatIndex()); + for(ORDERINDEX nOrd = 0; nOrd < pOrigSeq->GetLengthTailTrimmed(); nOrd++) + { + pSndFile->Order[nOrd] = pDragSndFile->Order.GetSequence(nOrigSeq)[nOrd]; + } + pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL); + pModDoc->SetModified(); + } + return true; + } case MODITEM_SAMPLE: break; case MODITEM_INSTRUMENT: @@ -2058,11 +2094,11 @@ else SetMidiPercussion((DWORD)modItemDropID, szFullPath); } - return TRUE; + return true; } break; } - return FALSE; + return false; } @@ -2170,12 +2206,12 @@ } -void CModTree::OnBeginDrag(HTREEITEM hItem, BOOL bLeft, LRESULT *pResult) +void CModTree::OnBeginDrag(HTREEITEM hItem, bool bLeft, LRESULT *pResult) //----------------------------------------------------------------------- { if (!(m_dwStatus & TREESTATUS_DRAGGING)) { - BOOL bDrag = FALSE; + bool bDrag = false; m_hDropWnd = NULL; m_hItemDrag = hItem; @@ -2191,15 +2227,25 @@ case MODITEM_PATTERN: case MODITEM_SAMPLE: case MODITEM_INSTRUMENT: + case MODITEM_SEQUENCE: case MODITEM_MIDIINSTRUMENT: case MODITEM_MIDIPERCUSSION: case MODITEM_INSLIB_SAMPLE: case MODITEM_INSLIB_INSTRUMENT: case MODITEM_INSLIB_SONG: - bDrag = TRUE; + bDrag = true; break; + case MODITEM_HDR_ORDERS: + // can we drag an order header? (only in MPTM format and if there's only one sequence) + { + CModDoc *pModDoc = DocInfo[m_nDragDocNdx]->pModDoc; + CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; + if(pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pSndFile->Order.GetNumSequences() == 1) + bDrag = true; + } + break; default: - if (m_qwItemDrag & 0x8000) bDrag = TRUE; + if (m_qwItemDrag & 0x8000) bDrag = true; } if (bDrag) { @@ -2218,7 +2264,7 @@ if (pnmhdr) { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)pnmhdr; - OnBeginDrag(pnmtv->itemNew.hItem, FALSE, pResult); + OnBeginDrag(pnmtv->itemNew.hItem, false, pResult); } } @@ -2229,7 +2275,7 @@ if (pnmhdr) { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)pnmhdr; - OnBeginDrag(pnmtv->itemNew.hItem, TRUE, pResult); + OnBeginDrag(pnmtv->itemNew.hItem, true, pResult); } } @@ -2616,7 +2662,7 @@ if (rect.PtInRect(point)) { m_hDropWnd = m_hWnd; - BOOL bCanDrop = CanDrop( HitTest(point, &flags), FALSE); + bool bCanDrop = CanDrop( HitTest(point, &flags), false); SetCursor((bCanDrop) ? CMainFrame::curDragging : CMainFrame::curNoDrop2); } else { Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/mptrack/View_tre.h 2010-03-26 13:23:03 UTC (rev 551) @@ -158,7 +158,7 @@ VOID RemoveDocument(CModDoc *pModDoc); VOID UpdateView(UINT nDocNdx, DWORD dwHint); VOID OnUpdate(CModDoc *pModDoc, DWORD dwHint, CObject *pHint); - BOOL CanDrop(HTREEITEM hItem, BOOL bDoDrop); + bool CanDrop(HTREEITEM hItem, bool bDoDrop); VOID UpdatePlayPos(CModDoc *pModDoc, PMPTNOTIFICATION pNotify); bool IsItemExpanded(HTREEITEM hItem); @@ -188,7 +188,7 @@ afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnBeginDrag(HTREEITEM, BOOL bLeft, LRESULT *pResult); + afx_msg void OnBeginDrag(HTREEITEM, bool bLeft, LRESULT *pResult); afx_msg void OnBeginLDrag(LPNMHDR, LRESULT *pResult); afx_msg void OnBeginRDrag(LPNMHDR, LRESULT *pResult); afx_msg void OnEndDrag(DWORD dwMask); Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2010-03-26 13:23:03 UTC (rev 551) @@ -291,9 +291,11 @@ } -void ModSequenceSet::AddSequence(bool bDuplicate) -//----------------------------------------------- +SEQUENCEINDEX ModSequenceSet::AddSequence(bool bDuplicate) +//-------------------------------------------------------- { + if(GetNumSequences() == MAX_SEQUENCES) + return SEQUENCEINDEX_INVALID; m_Sequences.push_back(ModSequence(*m_pSndFile, s_nCacheSize)); if (bDuplicate) { @@ -301,6 +303,7 @@ m_Sequences.back().m_sName = ""; // Don't copy sequence name. } SetSequence(GetNumSequences() - 1); + return GetNumSequences() - 1; } Modified: trunk/OpenMPT/soundlib/ModSequence.h =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.h 2010-03-25 22:36:06 UTC (rev 550) +++ trunk/OpenMPT/soundlib/ModSequence.h 2010-03-26 13:23:03 UTC (rev 551) @@ -133,7 +133,7 @@ const ModSequence& GetSequence(SEQUENCEINDEX nSeq); SEQUENCEINDEX GetNumSequences() const {return static_cast<SEQUENCEINDEX>(m_Sequences.size());} void SetSequence(SEQUENCEINDEX); // Sets working sequence. - void AddSequence(bool bDuplicate = true); // Adds new sequence. If bDuplicate is true, new sequence is a duplicate of the old one. + SEQUENCEINDEX AddSequence(bool bDuplicate = true); // Adds new sequence. If bDuplicate is true, new sequence is a duplicate of the old one. Returns the ID of the new sequence. void RemoveSequence() {RemoveSequence(GetCurrentSequenceIndex());} void RemoveSequence(SEQUENCEINDEX); // Removes given sequence SEQUENCEINDEX GetCurrentSequenceIndex() const {return m_nCurrentSeq;} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2010-03-26 23:01:01
|
Revision: 554 http://modplug.svn.sourceforge.net/modplug/?rev=554&view=rev Author: relabsoluness Date: 2010-03-26 23:00:54 +0000 (Fri, 26 Mar 2010) Log Message: ----------- [Fix] Internal: Build fixes. Modified Paths: -------------- trunk/OpenMPT/soundlib/Load_ult.cpp trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj Modified: trunk/OpenMPT/soundlib/Load_ult.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-26 19:17:27 UTC (rev 553) +++ trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-26 23:00:54 UTC (rev 554) @@ -395,7 +395,7 @@ pSmp->nC5Speed = ultSmp.speed; if(ultSmp.finetune) { - pSmp->nC5Speed = (UINT)(((double)pSmp->nC5Speed) * pow(2, (((double)ultSmp.finetune) / (12.0 * 32768)))); + pSmp->nC5Speed = (UINT)(((double)pSmp->nC5Speed) * pow(2.0, (((double)ultSmp.finetune) / (12.0 * 32768)))); } if(ultSmp.flags & ULT_LOOP) Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj =================================================================== --- trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj 2010-03-26 19:17:27 UTC (rev 553) +++ trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj 2010-03-26 23:00:54 UTC (rev 554) @@ -231,9 +231,6 @@ RelativePath="..\..\masmx86\gvmat32c.c"> </File> <File - RelativePath="..\..\..\gzio.c"> - </File> - <File RelativePath="..\..\..\infback.c"> </File> <File Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj =================================================================== --- trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-26 19:17:27 UTC (rev 553) +++ trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-26 23:00:54 UTC (rev 554) @@ -26,7 +26,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -99,7 +99,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > @@ -173,7 +173,7 @@ OutputDirectory="x86\ZlibStat$(ConfigurationName)" IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp" ConfigurationType="4" - InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="false" > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-26 23:11:27
|
Revision: 555 http://modplug.svn.sourceforge.net/modplug/?rev=555&view=rev Author: saga-games Date: 2010-03-26 23:11:20 +0000 (Fri, 26 Mar 2010) Log Message: ----------- [Fix] Mix Paste: When in MPT behaviour mode, empty FX commands were not overwritten properly when there previously was an effect in that field but only the effect number (and not the param value) was reset. [Fix] Added some nullptr checks for instruments here and there [Ref] Some more refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -512,9 +512,10 @@ if(pSndFile == nullptr) return false; CHAR s[512]; - BOOL bIns[MAX_SAMPLES]; - UINT nExt = 0; - UINT nRemoved = 0; + vector<bool> bIns; + int nExt = 0; + int nRemoved = 0; + bIns.resize(pSndFile->GetNumSamples(), false); BeginWaitCursor(); for (SAMPLEINDEX nSmp = pSndFile->m_nSamples; nSmp >= 1; nSmp--) if (pSndFile->Samples[nSmp].pSample) @@ -530,7 +531,6 @@ } if (pSndFile->m_nInstruments) { - memset(bIns, 0, sizeof(bIns)); for (UINT ipat=0; ipat<pSndFile->Patterns.Size(); ipat++) { MODCOMMAND *p = pSndFile->Patterns[ipat]; @@ -547,7 +547,7 @@ if (pIns) { UINT n = pIns->Keyboard[p->note-1]; - if (n < MAX_SAMPLES) bIns[n] = TRUE; + if (n <= pSndFile->GetNumSamples()) bIns[n] = true; } } else { @@ -557,7 +557,7 @@ if (pIns) { UINT n = pIns->Keyboard[p->note-1]; - if (n < MAX_SAMPLES) bIns[n] = TRUE; + if (n <= pSndFile->GetNumSamples()) bIns[n] = true; } } } @@ -565,28 +565,29 @@ } } } - for (UINT ichk=1; ichk<MAX_SAMPLES; ichk++) + for (SAMPLEINDEX ichk = 1; ichk <= pSndFile->GetNumSamples(); ichk++) { if ((!bIns[ichk]) && (pSndFile->Samples[ichk].pSample)) nExt++; } } EndWaitCursor(); - if (nExt && !((pSndFile->m_nType & MOD_TYPE_IT) && (pSndFile->m_dwSongFlags&SONG_ITPROJECT))) + if (nExt && !((pSndFile->m_nType & MOD_TYPE_IT) && (pSndFile->m_dwSongFlags & SONG_ITPROJECT))) { //We don't remove an instrument's unused samples in an ITP. wsprintf(s, "OpenMPT detected %d sample%s referenced by an instrument,\n" - "but not used in the song. Do you want to remove them ?", nExt, (nExt == 1) ? "" : "s"); + "but not used in the song. Do you want to remove them?", nExt, (nExt == 1) ? "" : "s"); if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES) { - for (SAMPLEINDEX j = 1; j < MAX_SAMPLES; j++) + for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->GetNumSamples(); nSmp++) { - if ((!bIns[j]) && (pSndFile->Samples[j].pSample)) + if ((!bIns[nSmp]) && (pSndFile->Samples[nSmp].pSample)) { BEGIN_CRITICAL(); - pSndFile->DestroySample(j); - if ((j == pSndFile->m_nSamples) && (j > 1)) pSndFile->m_nSamples--; + pSndFile->DestroySample(nSmp); + m_pModDoc->GetSampleUndo()->PrepareUndo(nSmp, sundo_delete); + if ((nSmp == pSndFile->m_nSamples) && (nSmp > 1)) pSndFile->m_nSamples--; END_CRITICAL(); nRemoved++; - m_pModDoc->GetSampleUndo()->ClearUndo(j); + m_pModDoc->GetSampleUndo()->ClearUndo(nSmp); } } wsprintf(s, "%d unused sample%s removed\n" ,nRemoved, (nRemoved == 1) ? "" : "s"); @@ -594,7 +595,7 @@ return true; } } - return false; + return (nRemoved > 0); } @@ -615,8 +616,8 @@ if (nLoopOpt == 0) return false; CHAR s[512]; - wsprintf(s, "OpenMPT detected %d sample%s with unused data after the loop end point,\n" - "Do you want to optimize it, and remove this unused data?", nLoopOpt, (nLoopOpt == 1) ? "" : "s"); + wsprintf(s, "%d sample%s unused data after the loop end point,\n" + "Do you want to optimize %s and remove this unused data?", nLoopOpt, (nLoopOpt == 1) ? " has" : "s have", (nLoopOpt == 1) ? "it" : "them"); if (::MessageBox(NULL, s, "Sample Optimization", MB_YESNO | MB_ICONQUESTION) == IDYES) { for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->m_nSamples; nSmp++) @@ -684,11 +685,13 @@ memset(pSndFile->m_szNames[i], 0, sizeof(pSndFile->m_szNames[i])); // Also update instrument mapping (if module is in instrument mode) - for(INSTRUMENTINDEX iInstr = 1; iInstr <= pSndFile->m_nInstruments; iInstr++){ - if(pSndFile->Instruments[iInstr]){ - MODINSTRUMENT *p = pSndFile->Instruments[iInstr]; + for(INSTRUMENTINDEX nIns = 1; nIns <= pSndFile->m_nInstruments; nIns++) + { + MODINSTRUMENT *pIns = pSndFile->Instruments[nIns]; + if(pIns) + { for(WORD iNote = 0; iNote < 128; iNote++) - if(p->Keyboard[iNote] == i) p->Keyboard[iNote] = nSampleMap[i]; + if(pIns->Keyboard[iNote] == i) pIns->Keyboard[iNote] = nSampleMap[i]; } } } @@ -840,7 +843,8 @@ for (PLUGINDEX nPlug = 0; nPlug < MAX_MIXPLUGINS; nPlug++) { //Is the plugin assigned to a channel? - for (CHANNELINDEX nChn = 0; nChn < pSndFile->GetNumChannels(); nChn++) { + for (CHANNELINDEX nChn = 0; nChn < pSndFile->GetNumChannels(); nChn++) + { if (pSndFile->ChnSettings[nChn].nMixPlugin == nPlug + 1u) { usedmap[nPlug] = true; break; @@ -848,21 +852,24 @@ } //Is the plugin used by an instrument? - for (INSTRUMENTINDEX nIns=1; nIns<=pSndFile->GetNumInstruments(); nIns++) { - if (pSndFile->Instruments[nIns] && (pSndFile->Instruments[nIns]->nMixPlug == nPlug+1)) { + for (INSTRUMENTINDEX nIns=1; nIns<=pSndFile->GetNumInstruments(); nIns++) + { + if (pSndFile->Instruments[nIns] && (pSndFile->Instruments[nIns]->nMixPlug == nPlug+1)) + { usedmap[nPlug] = true; break; } } //Is the plugin assigned to master? - if (pSndFile->m_MixPlugins[nPlug].Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) { + if (pSndFile->m_MixPlugins[nPlug].Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) usedmap[nPlug] = true; - } //all outputs of used plugins count as used - if (usedmap[nPlug]!=0) { - if (pSndFile->m_MixPlugins[nPlug].Info.dwOutputRouting & 0x80) { + if (usedmap[nPlug]!=0) + { + if (pSndFile->m_MixPlugins[nPlug].Info.dwOutputRouting & 0x80) + { int output = pSndFile->m_MixPlugins[nPlug].Info.dwOutputRouting & 0x7f; usedmap[output] = true; } @@ -872,7 +879,7 @@ UINT nRemoved = m_pModDoc->RemovePlugs(usedmap); - return (nRemoved > 0) ? true : false; + return (nRemoved > 0); } @@ -908,7 +915,7 @@ pSndFile->m_nRestartPos = 0; // reset instruments (if there are any) - for(INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++) + for(INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++) if(pSndFile->Instruments[i]) { pSndFile->Instruments[i]->nFadeOut = 256; pSndFile->Instruments[i]->nGlobalVol = 64; Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -652,8 +652,13 @@ if (m_pModDoc) { MODINSTRUMENT *pIns = m_pModDoc->GetSoundFile()->Instruments[m_nInstrument]; - if (m_bIns) m_nOldIns = pIns->Keyboard[m_nNote]; - else m_nOldNote = pIns->NoteMap[m_nNote]; + if(pIns) + { + if (m_bIns) + m_nOldIns = pIns->Keyboard[m_nNote]; + else + m_nOldNote = pIns->NoteMap[m_nNote]; + } } return true; } @@ -2626,10 +2631,10 @@ { if (m_pModDoc == 0 || m_pSndFile == 0 || m_nInstrument > m_pSndFile->GetNumInstruments() - || m_pSndFile->Instruments[m_nInstrument] == NULL) return; + || m_pSndFile->Instruments[m_nInstrument] == nullptr) return; MODINSTRUMENT* const pIns = m_pSndFile->Instruments[m_nInstrument]; - if(pIns->pTuning == NULL) + if(pIns->pTuning == nullptr) { m_ComboTuning.SetCurSel(0); return; Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -285,9 +285,8 @@ { for (UINT i=1; i<=m_pSndFile->m_nInstruments; i++) { - if (m_pSndFile->Instruments[i] == NULL) { + if (m_pSndFile->Instruments[i] == nullptr) continue; - } CString sDisplayName; if (m_pModDoc->GetSplitKeyboardSettings()->IsSplitActive()) @@ -1180,7 +1179,7 @@ void CCtrlPatterns::TogglePluginEditor() //-------------------------------------- { - if ((m_nInstrument) && (m_pModDoc)) + if(m_nInstrument && m_pModDoc && m_pSndFile && m_pSndFile->Instruments[m_nInstrument]) { UINT nPlug = m_pSndFile->Instruments[m_nInstrument]->nMixPlug; if (nPlug) //if not no plugin Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -3515,7 +3515,7 @@ // If instrument name is empty, use name of the sample mapped to C-5. if (instrumentName.IsEmpty()) { - const SAMPLEINDEX nSmp = m_SndFile.Instruments[nInstr]->Keyboard[60]; + const SAMPLEINDEX nSmp = m_SndFile.Instruments[nInstr]->Keyboard[NOTE_MIDDLEC - 1]; if (nSmp < ARRAYELEMCOUNT(m_SndFile.Samples) && m_SndFile.Samples[nSmp].pSample) instrumentName.Format(TEXT("s: %s"), m_SndFile.GetSampleName(nSmp)); //60 is C-5 } Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -154,7 +154,7 @@ for (UINT i2=0; i2<m_SndFile.m_nInstruments; i2++) if (m_SndFile.Instruments[i2]) { delete m_SndFile.Instruments[i2]; - m_SndFile.Instruments[i2] = NULL; + m_SndFile.Instruments[i2] = nullptr; } m_SndFile.m_nInstruments = 0; END_CRITICAL(); @@ -1387,8 +1387,8 @@ } } // Effect value - if (s[9] > ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.param==0) || - (doITStyleMix && origModCmd.command==0 && origModCmd.param==0)))) + if (s[9] > ' ' && (!doMixPaste || ((!doITStyleMix && (origModCmd.command == CMD_NONE || origModCmd.param == 0)) || + (doITStyleMix && origModCmd.command == CMD_NONE && origModCmd.param == 0)))) { m[col].param = 0; if (s[9] != '.') Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -350,13 +350,8 @@ bool CViewInstrument::EnvGetVolEnv() const //---------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) return (pIns->VolEnv.dwFlags & ENV_ENABLED) ? true : false; - } + MODINSTRUMENT *pIns = GetInstrumentPtr(); + if (pIns) return (pIns->VolEnv.dwFlags & ENV_ENABLED) ? true : false; return false; } @@ -364,13 +359,8 @@ bool CViewInstrument::EnvGetPanEnv() const //---------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) return (pIns->PanEnv.dwFlags & ENV_ENABLED) ? true : false; - } + MODINSTRUMENT *pIns = GetInstrumentPtr(); + if (pIns) return (pIns->PanEnv.dwFlags & ENV_ENABLED) ? true : false; return false; } @@ -378,13 +368,8 @@ bool CViewInstrument::EnvGetPitchEnv() const //------------------------------------------ { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) return ((pIns->PitchEnv.dwFlags & (ENV_ENABLED|ENV_FILTER)) == ENV_ENABLED) ? true : false; - } + MODINSTRUMENT *pIns = GetInstrumentPtr(); + if (pIns) return ((pIns->PitchEnv.dwFlags & (ENV_ENABLED|ENV_FILTER)) == ENV_ENABLED) ? true : false; return false; } @@ -392,13 +377,8 @@ bool CViewInstrument::EnvGetFilterEnv() const //------------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) return ((pIns->PitchEnv.dwFlags & (ENV_ENABLED|ENV_FILTER)) == (ENV_ENABLED|ENV_FILTER)) ? true : false; - } + MODINSTRUMENT *pIns = GetInstrumentPtr(); + if (pIns) return ((pIns->PitchEnv.dwFlags & (ENV_ENABLED|ENV_FILTER)) == (ENV_ENABLED|ENV_FILTER)) ? true : false; return false; } @@ -559,12 +539,9 @@ bool CViewInstrument::EnvSetVolEnv(bool bEnable) //---------------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if(pModDoc == nullptr) return false; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return false; - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + MODINSTRUMENT *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() return EnvToggleEnv(&pIns->VolEnv, pSndFile, pIns, bEnable, 64, CHN_VOLENV); } @@ -573,12 +550,9 @@ bool CViewInstrument::EnvSetPanEnv(bool bEnable) //---------------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if(pModDoc == nullptr) return false; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return false; - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + MODINSTRUMENT *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() return EnvToggleEnv(&pIns->PanEnv, pSndFile, pIns, bEnable, 32, CHN_PANENV); } @@ -587,12 +561,9 @@ bool CViewInstrument::EnvSetPitchEnv(bool bEnable) //------------------------------------------------ { - CModDoc *pModDoc = GetDocument(); - if(pModDoc == nullptr) return false; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return false; - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + MODINSTRUMENT *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() pIns->PitchEnv.dwFlags &= ~ENV_FILTER; return EnvToggleEnv(&pIns->PitchEnv, pSndFile, pIns, bEnable, 32, CHN_PITCHENV); @@ -602,12 +573,9 @@ bool CViewInstrument::EnvSetFilterEnv(bool bEnable) //------------------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if(pModDoc == nullptr) return false; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return false; - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + MODINSTRUMENT *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() pIns->PitchEnv.dwFlags &= ~ENV_FILTER; return EnvToggleEnv(&pIns->PitchEnv, pSndFile, pIns, bEnable, 64, CHN_PITCHENV, ENV_FILTER); @@ -2435,16 +2403,23 @@ } -// Get a pointer to the currently selected envelope. -INSTRUMENTENVELOPE *CViewInstrument::GetEnvelopePtr() const -//--------------------------------------------------------- +// Get a pointer to the currently active instrument. +MODINSTRUMENT *CViewInstrument::GetInstrumentPtr() const +//------------------------------------------------------ { - // First do some standard checks... CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return nullptr; CSoundFile *pSndFile = pModDoc->GetSoundFile(); if(pSndFile == nullptr) return nullptr; - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + return pSndFile->Instruments[m_nInstrument]; +} + +// Get a pointer to the currently selected envelope. +INSTRUMENTENVELOPE *CViewInstrument::GetEnvelopePtr() const +//--------------------------------------------------------- +{ + // First do some standard checks... + MODINSTRUMENT *pIns = GetInstrumentPtr(); if(pIns == nullptr) return nullptr; // Now for the real thing. Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/View_ins.h 2010-03-26 23:11:20 UTC (rev 555) @@ -117,6 +117,7 @@ // Misc stuff void UpdateScrollSize(); BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME); + MODINSTRUMENT *GetInstrumentPtr() const; INSTRUMENTENVELOPE *GetEnvelopePtr() const; UINT EnvInsertPoint(int nTick, int nValue); bool EnvRemovePoint(UINT nPoint); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -409,7 +409,7 @@ BOOL CModTypeDlg::VerifyData() -//--------------------------------- +//---------------------------- { int temp_nRPB = GetDlgItemInt(IDC_ROWSPERBEAT); @@ -2735,9 +2735,8 @@ if (m_pSndFile->m_nInstruments) { for (INSTRUMENTINDEX nIns = 1; nIns <= m_pSndFile->m_nInstruments; nIns++) { - if (m_pSndFile->Instruments[nIns] == nullptr) { + if (m_pSndFile->Instruments[nIns] == nullptr) continue; - } CString displayName = m_pSndFile->GetpModDoc()->GetPatternViewInstrumentName(nIns); int n = m_CbnSplitInstrument.AddString(displayName); Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -120,8 +120,8 @@ // -! NEW_FEATURE#0023 MODINSTRUMENT *pIns = Instruments[nInstr]; - Instruments[nInstr] = NULL; - for (UINT i=0; i<MAX_CHANNELS; i++) + Instruments[nInstr] = nullptr; + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) { if (Chn[i].pModInstrument == pIns) { Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-26 23:00:54 UTC (rev 554) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-26 23:11:20 UTC (rev 555) @@ -860,10 +860,10 @@ pSmp->pSample = nullptr; } } - for (i=0; i<MAX_INSTRUMENTS; i++) + for (i = 0; i < MAX_INSTRUMENTS; i++) { delete Instruments[i]; - Instruments[i] = NULL; + Instruments[i] = nullptr; } for (i=0; i<MAX_MIXPLUGINS; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2010-03-28 16:24:30
|
Revision: 558 http://modplug.svn.sourceforge.net/modplug/?rev=558&view=rev Author: relabsoluness Date: 2010-03-28 16:24:23 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [Mod] MPTM: Increased internal file version number and now user will be shown warning about "last saved with a more recent version of OpenMPT" only if the internal file version has increased. Also OpenMPT will now reject to load MPTM file if its file version is above certain limit. [Mod] Version: Changed to 1.18.01.00. [Fix] Song cleanup: Fixed a memory leak in pattern name handling. [Mod] Resource: Removed resource ID duplicate. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -452,8 +452,8 @@ // Reorder patterns & Delete unused patterns BEGIN_CRITICAL(); { - UINT npatnames = pSndFile->m_nPatternNames; - LPSTR lpszpatnames = pSndFile->m_lpszPatternNames; + const UINT npatnames = pSndFile->m_nPatternNames; + const LPSTR lpszpatnames = pSndFile->m_lpszPatternNames; pSndFile->m_nPatternNames = 0; pSndFile->m_lpszPatternNames = NULL; for (PATTERNINDEX i = 0; i < maxPatIndex; i++) @@ -487,6 +487,8 @@ { pSndFile->Patterns[nPat].SetData(pPatterns[nPat], nPatRows[nPat]); } + + delete[] lpszpatnames; } END_CRITICAL(); EndWaitCursor(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -191,6 +191,16 @@ } EndWaitCursor(); + + // Show log messages from loaders. + if (GetLog() != nullptr) + { + CString sTemp; + sTemp.Format("File: %s\nLast saved with: %s, current version is %s\n\n%s", lpszPathName, (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), MptVersion::str, GetLog()); + AfxMessageBox(sTemp, MB_ICONINFORMATION); + ClearLog(); + } + if ((m_SndFile.m_nType == MOD_TYPE_NONE) || (!m_SndFile.m_nChannels)) return FALSE; // Midi Import if (m_SndFile.m_nType == MOD_TYPE_MID) @@ -366,7 +376,11 @@ // -> DESC="channels management dlg" ReinitRecordState(); // -! NEW_FEATURE#0015 - if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num) { + + // Show warning if file was made with more recent version of OpenMPT except for MPTM-files, + // which uses CModDocs log-mechanism to show messages. + if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num && m_SndFile.GetType() != MOD_TYPE_MPT) + { char s[256]; wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n", (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/resource.h 2010-03-28 16:24:23 UTC (rev 558) @@ -103,8 +103,7 @@ #define IDB_SPLASHTEST 432 #define IDB_SPLASHNOFOLDFIN 435 #define IDR_VSTMENU 436 -#define IDB_VISNODE1 436 -#define IDB_VISPCNODE 436 +#define IDB_VISPCNODE 437 #define IDD_DEFAULTPLUGINEDITOR 438 #define IDD_CHANNELMANAGER 440 #define IDD_SOUNDBANK_INFO1 441 Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/version.h 2010-03-28 16:24:23 UTC (rev 558) @@ -14,8 +14,8 @@ //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 18 -#define VER_MINOR 00 -#define VER_MINORMINOR 01 +#define VER_MINOR 01 +#define VER_MINORMINOR 00 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -28,7 +28,26 @@ #define str_pattern (GetStrI18N((_TEXT("pattern")))) #define str_PatternSetTruncationNote (GetStrI18N((_TEXT("The module contains %u patterns but only %u patterns can be loaded in this OpenMPT version.")))) #define str_SequenceTruncationNote (GetStrI18N((_TEXT("Module has sequence of length %u; it will be truncated to maximum supported length, %u.")))) +#define str_LoadingIncompatibleVersion TEXT("The file informed that it is incompatible with this version of OpenMPT. Loading was terminated.") +#define str_LoadingMoreRecentVersion TEXT("The loaded file was made with a more recent OpenMPT version and this version may not be able to load all the features or play the file correctly.") +const uint16 verMptFileVer = 0x88F; +const uint16 verMptFileVerLoadLimit = 0x1000; // If cwtv-field is greater or equal to this value, + // the MPTM file will not be loaded. + +/* +MPTM version history for cwtv-field in IT header: +0x88E(1.17.02.50) -> 0x88F(1.18.01.00): +0x88D(1.17.02.49) -> 0x88E(1.17.02.50): Changed ID to that of IT and undone the orderlist change done in + 0x88A->0x88B. Now extended orderlist is saved as extension. +0x88C(1.17.02.48) -> 0x88D(1.17.02.49): Some tuning related changes - that part fails to read on older versions. +0x88B -> 0x88C: Changed type in which tuning number is printed to file: size_t -> uint16. +0x88A -> 0x88B: Changed order-to-pattern-index table type from BYTE-array to vector<UINT>. +*/ + + + + static bool AreNonDefaultTuningsUsed(CSoundFile& sf) //-------------------------------------------------- { @@ -939,6 +958,20 @@ if(pifh->cwtv == 0x214 && pifh->cmwt == 0x202) m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 09, 00, 00); } + else // case: type == MOD_TYPE_MPT + { + if (pifh->cwtv >= verMptFileVerLoadLimit) + { + if (GetpModDoc()) + GetpModDoc()->AddToLog(str_LoadingIncompatibleVersion); + return false; + } + else if (pifh->cwtv > verMptFileVer) + { + if (GetpModDoc()) + GetpModDoc()->AddToLog(str_LoadingMoreRecentVersion); + } + } } if(GetType() == MOD_TYPE_IT) mptStartPos = dwMemLength; @@ -1500,7 +1533,7 @@ if(version >= 0x88D) { srlztn::Ssb ssb(iStrm); - ssb.BeginRead("mptm", 1); + ssb.BeginRead("mptm", MptVersion::num); ssb.ReadItem(GetTuneSpecificTunings(), "0", 1, &ReadTuningCollection); ssb.ReadItem(*this, "1", 1, &ReadTuningMap); ssb.ReadItem(Order, "2", 1, &ReadModSequenceOld); @@ -1847,17 +1880,8 @@ //VERSION if(GetType() == MOD_TYPE_MPT) { - header.cwtv = 0x88E; // Used in OMPT-hack versioning. + header.cwtv = verMptFileVer; // Used in OMPT-hack versioning. header.cmwt = 0x888; - /* - Version history: - 0x88D(v.02.49) -> 0x88E: Changed ID to that of IT and undone the orderlist change done in - 0x88A->0x88B. Now extended orderlist is saved as extension. - 0x88C(v.02.48) -> 0x88D: Some tuning related changes - that part fails to read on older versions. - 0x88B -> 0x88C: Changed type in which tuning number is printed - to file: size_t -> uint16. - 0x88A -> 0x88B: Changed order-to-pattern-index table type from BYTE-array to vector<UINT>. - */ } else //IT { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-28 17:21:51
|
Revision: 559 http://modplug.svn.sourceforge.net/modplug/?rev=559&view=rev Author: saga-games Date: 2010-03-28 17:21:44 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [New] INI Settings: When portable mode is enabled, the most common paths in mptrack.ini are now translated to relative paths (if possible). MIDI library, soundfont and plugin paths are not translated to relative paths (yet). [Fix] XM Loader: Some XMs not made with ModPlug were recognized as files made with MPT. [Imp/Ref] It's now possible to link several pattern undo commands together (to undo them in one step). That way, overflow paste now only uses undo step. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/soundlib/Load_xm.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-28 17:21:44 UTC (rev 559) @@ -267,6 +267,11 @@ TCHAR CMainFrame::m_szDefaultDirectory[NUM_DIRS][_MAX_PATH] = {0}; TCHAR CMainFrame::m_szWorkingDirectory[NUM_DIRS][_MAX_PATH] = {0}; TCHAR CMainFrame::m_szKbdFile[_MAX_PATH] = ""; //rewbs.customKeys +// Directory to INI setting translation +const TCHAR CMainFrame::m_szDirectoryToSettingsName[NUM_DIRS][32] = +{ + _T("Songs_Directory"), _T("Samples_Directory"), _T("Instruments_Directory"), _T("Plugins_Directory"), _T("Plugin_Presets_Directory"), _T("Export_Directory"), _T("") +}; CInputHandler *CMainFrame::m_InputHandler = NULL; //rewbs.customKeys @@ -451,19 +456,18 @@ m_nSampleUndoMaxBuffer = max(1, m_nSampleUndoMaxBuffer) << 20; TCHAR szPath[_MAX_PATH] = ""; - GetPrivateProfileString("Paths", "Songs_Directory", GetDefaultDirectory(DIR_MODS), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_MODS); - GetPrivateProfileString("Paths", "Samples_Directory", GetDefaultDirectory(DIR_SAMPLES), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_SAMPLES); - GetPrivateProfileString("Paths", "Instruments_Directory", GetDefaultDirectory(DIR_INSTRUMENTS), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_INSTRUMENTS); - GetPrivateProfileString("Paths", "Plugins_Directory", GetDefaultDirectory(DIR_PLUGINS), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_PLUGINS); - GetPrivateProfileString("Paths", "Plugin_Presets_Directory", GetDefaultDirectory(DIR_PLUGINPRESETS), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_PLUGINPRESETS); - GetPrivateProfileString("Paths", "Export_Directory", GetDefaultDirectory(DIR_EXPORT), szPath, INIBUFFERSIZE, iniFile); - SetDefaultDirectory(szPath, DIR_EXPORT); + for(size_t i = 0; i < NUM_DIRS; i++) + { + if(m_szDirectoryToSettingsName[i][0] == 0) + continue; + + GetPrivateProfileString("Paths", m_szDirectoryToSettingsName[i], GetDefaultDirectory(static_cast<Directory>(i)), szPath, INIBUFFERSIZE, iniFile); + RelativePathToAbsolute(szPath); + SetDefaultDirectory(szPath, static_cast<Directory>(i), false); + + } GetPrivateProfileString("Paths", "Key_Config_File", m_szKbdFile, m_szKbdFile, INIBUFFERSIZE, iniFile); + RelativePathToAbsolute(m_szKbdFile); CSoundFile::m_nXBassDepth = GetPrivateProfileLong("Effects", "XBassDepth", 0, iniFile); CSoundFile::m_nXBassRange = GetPrivateProfileLong("Effects", "XBassRange", 0, iniFile); @@ -980,14 +984,29 @@ WritePrivateProfileDWord("Pattern Editor", "Record", gbPatternRecord, iniFile); WritePrivateProfileDWord("Pattern Editor", "AutoChordWaitTime", gnAutoChordWaitTime, iniFile); - WritePrivateProfileString("Paths", "Songs_Directory", GetDefaultDirectory(DIR_MODS), iniFile); - WritePrivateProfileString("Paths", "Samples_Directory", GetDefaultDirectory(DIR_SAMPLES), iniFile); - WritePrivateProfileString("Paths", "Instruments_Directory", GetDefaultDirectory(DIR_INSTRUMENTS), iniFile); - WritePrivateProfileString("Paths", "Plugins_Directory", GetDefaultDirectory(DIR_PLUGINS), iniFile); - WritePrivateProfileString("Paths", "Plugin_Presets_Directory", GetDefaultDirectory(DIR_PLUGINPRESETS), iniFile); - WritePrivateProfileString("Paths", "Export_Directory", GetDefaultDirectory(DIR_EXPORT), iniFile); - WritePrivateProfileString("Paths", "Key_Config_File", m_szKbdFile, iniFile); + // Write default paths + const bool bConvertPaths = theApp.IsPortableMode(); + TCHAR szPath[_MAX_PATH] = ""; + for(size_t i = 0; i < NUM_DIRS; i++) + { + if(m_szDirectoryToSettingsName[i][0] == 0) + continue; + _tcscpy(szPath, GetDefaultDirectory(static_cast<Directory>(i))); + if(bConvertPaths) + { + AbsolutePathToRelative(szPath); + } + WritePrivateProfileString("Paths", m_szDirectoryToSettingsName[i], szPath, iniFile); + + } + _tcscpy(szPath, m_szKbdFile); + if(bConvertPaths) + { + AbsolutePathToRelative(szPath); + } + WritePrivateProfileString("Paths", "Key_Config_File", szPath, iniFile); + WritePrivateProfileLong("Effects", "XBassDepth", CSoundFile::m_nXBassDepth, iniFile); WritePrivateProfileLong("Effects", "XBassRange", CSoundFile::m_nXBassRange, iniFile); WritePrivateProfileLong("Effects", "ReverbDepth", CSoundFile::m_nReverbDepth, iniFile); @@ -3104,3 +3123,77 @@ { return m_szWorkingDirectory[dir]; } + + +// Convert an absolute path to a path that's relative to OpenMPT's directory. +// Paths are relative to the executable path. +// nLength specifies the maximum number of character that can be written into szPath, +// including the trailing null char. +template <size_t nLength> +void CMainFrame::AbsolutePathToRelative(TCHAR (&szPath)[nLength]) +//--------------------------------------------------------------- +{ + STATIC_ASSERT(nLength >= 3); + + if(_tcslen(szPath) == 0) + return; + + const size_t nStrLength = nLength - 1; // "usable" length, i.e. not including the null char. + TCHAR szExePath[nLength], szTempPath[nLength]; + _tcsncpy(szExePath, theApp.GetAppDirPath(), nStrLength); + SetNullTerminator(szExePath); + + // Path is OpenMPT's directory or a sub directory ("C:\OpenMPT\Somepath" => ".\Somepath") + if(!_tcsncicmp(szExePath, szPath, _tcslen(szExePath))) + { + _tcscpy(szTempPath, _T(".\\")); // ".\" + _tcsncat(szTempPath, &szPath[_tcslen(szExePath)], nStrLength - 2); // "Somepath" + _tcscpy(szPath, szTempPath); + } else + // Path is on the same drive as OpenMPT ("C:\Somepath" => "\Somepath") + if(!_tcsncicmp(szExePath, szPath, 1)) + { + _tcsncpy(szTempPath, &szPath[2], nStrLength); // "\Somepath" + _tcscpy(szPath, szTempPath); + } + SetNullTerminator(szPath); +} + + +// Convert a relative path to an absolute path. +// Paths are relative to the executable path. +// nLength specifies the maximum number of character that can be written into szPath, +// including the trailing null char. +template <size_t nLength> +void CMainFrame::RelativePathToAbsolute(TCHAR (&szPath)[nLength]) +//--------------------------------------------------------------- +{ + STATIC_ASSERT(nLength >= 3); + + if(_tcslen(szPath) == 0) + return; + + const size_t nStrLength = nLength - 1; // "usable" length, i.e. not including the null char. + TCHAR szExePath[nLength], szTempPath[nLength]; + _tcsncpy(szExePath, theApp.GetAppDirPath(), nStrLength); + SetNullTerminator(szExePath); + + // Path is on the same drive as OpenMPT ("\Somepath\" => "C:\Somepath\") + if(!_tcsncicmp(szPath, _T("\\"), 1)) + { + _tcsncpy(szTempPath, szExePath, 2); // "C:" + _tcsncat(szTempPath, szPath, nStrLength - 2); // "\Somepath\" + _tcscpy(szPath, szTempPath); + } else + // Path is OpenMPT's directory or a sub directory (".\Somepath\" => "C:\OpenMPT\Somepath\") + if(!_tcsncicmp(szPath, _T(".\\"), 2)) + { + _tcsncpy(szTempPath, szExePath, nStrLength); // "C:\OpenMPT\" + if(_tcslen(szTempPath) < nStrLength) + { + _tcsncat(szTempPath, &szPath[2], nStrLength - _tcslen(szTempPath)); // "Somepath" + } + _tcscpy(szPath, szTempPath); + } + SetNullTerminator(szPath); +} Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-28 17:21:44 UTC (rev 559) @@ -616,11 +616,19 @@ static LPCTSTR GetWorkingDirectory(Directory dir); static void SetDefaultDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename = false); static LPCTSTR GetDefaultDirectory(Directory dir); + + template <size_t nLength> + static void AbsolutePathToRelative(TCHAR (&szPath)[nLength]); + template <size_t nLength> + static void RelativePathToAbsolute(TCHAR (&szPath)[nLength]); + protected: static void SetDirectory(const LPCTSTR szFilenameFrom, Directory dir, TCHAR (&pDirs)[NUM_DIRS][_MAX_PATH], bool bStripFilename); + // Directory Arrays (default dir + last dir) static TCHAR m_szDefaultDirectory[NUM_DIRS][_MAX_PATH]; static TCHAR m_szWorkingDirectory[NUM_DIRS][_MAX_PATH]; + static const TCHAR m_szDirectoryToSettingsName[NUM_DIRS][32]; // Overrides Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-28 17:21:44 UTC (rev 559) @@ -1204,7 +1204,7 @@ UINT ncol = (dwBeginSel & 0xFFFF) >> 3; UINT col; bool bS3MCommands = false, bOk = false; - bool bPrepareUndo = true; + bool bPrepareUndo = true, bFirstUndo = true; MODTYPE origFormat = MOD_TYPE_IT; UINT len = 0, startLen; @@ -1278,8 +1278,9 @@ // Before changing anything in this pattern, we have to create an undo point. if(bPrepareUndo) { - GetPatternUndo()->PrepareUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); + GetPatternUndo()->PrepareUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern], !bFirstUndo); bPrepareUndo = false; + bFirstUndo = false; } // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/mptrack/Undo.cpp 2010-03-28 17:21:44 UTC (rev 559) @@ -37,8 +37,9 @@ // - y: first row // - cx: width // - cy: height -bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy) -//------------------------------------------------------------------------------------ +// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. +bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy, bool linkToPrevious) +//--------------------------------------------------------------------------------------------------------- { if(m_pModDoc == nullptr) return false; CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); @@ -73,6 +74,7 @@ sUndo.cx = cx; sUndo.cy = cy; sUndo.pbuffer = pUndoData; + sUndo.linkToPrevious = linkToPrevious; pPattern += x + y * pSndFile->m_nChannels; for (UINT iy = 0; iy < cy; iy++) { @@ -92,6 +94,15 @@ PATTERNINDEX CPatternUndo::Undo() //------------------------------- { + return Undo(false); +} + + +// Restore an undo point. Returns which pattern has been modified. +// linkedFromPrevious is true if a connected undo even is going to be deleted. +PATTERNINDEX CPatternUndo::Undo(bool linkedFromPrevious) +//------------------------------------------------------ +{ if(m_pModDoc == nullptr) return PATTERNINDEX_INVALID; CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); if(pSndFile == nullptr) return PATTERNINDEX_INVALID; @@ -99,6 +110,7 @@ MODCOMMAND *pUndoData, *pPattern; PATTERNINDEX nPattern; ROWINDEX nRows; + bool linkToPrevious = false; if (CanUndo() == false) return PATTERNINDEX_INVALID; @@ -106,6 +118,9 @@ while(UndoBuffer.back().pattern >= pSndFile->Patterns.Size()) { RemoveLastUndoStep(); + // The command which was connect to this command is no more valid, so don't search for the next command. + if(linkedFromPrevious) + return PATTERNINDEX_INVALID; } // Select most recent undo slot @@ -128,6 +143,7 @@ CSoundFile::FreePattern(oldPattern); } } + linkToPrevious = pUndo->linkToPrevious; pUndoData = pUndo->pbuffer; pPattern = pSndFile->Patterns[nPattern]; if (!pSndFile->Patterns[nPattern]) return PATTERNINDEX_INVALID; @@ -143,7 +159,13 @@ RemoveLastUndoStep(); if (CanUndo() == false) m_pModDoc->UpdateAllViews(NULL, HINT_UNDO); - return nPattern; + if(linkToPrevious) + { + return Undo(true); + } else + { + return nPattern; + } } Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/mptrack/Undo.h 2010-03-28 17:21:44 UTC (rev 559) @@ -21,6 +21,7 @@ UINT column, row; UINT cx, cy; MODCOMMAND *pbuffer; + bool linkToPrevious; }; //================ @@ -35,23 +36,26 @@ // Pattern undo helper functions void DeleteUndoStep(const UINT nStep); + PATTERNINDEX Undo(bool linkedFromPrevious); public: // Pattern undo functions void ClearUndo(); - bool PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy); + bool PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy, bool linkToPrevious = false); PATTERNINDEX Undo(); bool CanUndo(); void RemoveLastUndoStep(); void SetParent(CModDoc *pModDoc) {m_pModDoc = pModDoc;} - CPatternUndo() { + CPatternUndo() + { UndoBuffer.clear(); m_pModDoc = nullptr; }; - ~CPatternUndo() { + ~CPatternUndo() + { ClearUndo(); }; @@ -112,11 +116,13 @@ void SetParent(CModDoc *pModDoc) {m_pModDoc = pModDoc;} - CSampleUndo() { + CSampleUndo() + { UndoBuffer.clear(); m_pModDoc = nullptr; }; - ~CSampleUndo() { + ~CSampleUndo() + { ClearUndo(); }; Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-03-28 16:24:23 UTC (rev 558) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-03-28 17:21:44 UTC (rev 559) @@ -664,8 +664,10 @@ // Read mix plugins information if (dwMemPos + 8 < dwMemLength) { + DWORD dwOldPos = dwMemPos; dwMemPos += LoadMixPlugins(lpStream+dwMemPos, dwMemLength-dwMemPos); - bMadeWithModPlug = true; + if(dwMemPos != dwOldPos) + bMadeWithModPlug = true; } // Check various things to find out whether this has been made with MPT. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-28 22:53:49
|
Revision: 561 http://modplug.svn.sourceforge.net/modplug/?rev=561&view=rev Author: saga-games Date: 2010-03-28 22:53:43 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [Fix] IT Compatibility: S77 / S79/ S7B are supposed to pause the envelope, not disable it. [Ref] Added some comments to the CHN_* flags and in the pattern drawing code, minor refactoring there as well. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-28 19:31:53 UTC (rev 560) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-03-28 22:53:43 UTC (rev 561) @@ -93,8 +93,12 @@ -3, 1, 9, // InstrOfs + nInstrHiWidth }; +// NOTE: See also CViewPattern::DrawNote() when changing stuff here +// or adding new fonts - The custom tuning note names might require +// some additions there. + ///////////////////////////////////////////////////////////////////////////// // CViewPattern Drawing Implementation @@ -667,7 +671,7 @@ // -> CODE#0015 // -> DESC="channels management dlg" - BOOL activeDoc = pMainFrm ? pMainFrm->GetActiveDoc() == GetDocument() : FALSE; + bool activeDoc = pMainFrm ? (pMainFrm->GetActiveDoc() == GetDocument()) : false; if(activeDoc && CChannelManagerDlg::sharedInstance(FALSE) && CChannelManagerDlg::sharedInstance()->IsDisplayed()) CChannelManagerDlg::sharedInstance()->SetDocument((void*)this); @@ -1045,13 +1049,13 @@ CRect rect; POINT ptTopLeft, ptBottomRight; DWORD dwTopLeft, dwBottomRight; - BOOL bLeft, bTop, bRight, bBottom; + bool bLeft, bTop, bRight, bBottom; int x1, y1, x2, y2, dx, dy, c1, c2; int nChannels, nRows; - if ((pModDoc = GetDocument()) == NULL) return; + if ((pModDoc = GetDocument()) == nullptr) return; pSndFile = pModDoc->GetSoundFile(); - bLeft = bTop = bRight = bBottom = TRUE; + bLeft = bTop = bRight = bBottom = true; x1 = (m_dwBeginSel & 0xFFF8) >> 3; y1 = (m_dwBeginSel) >> 16; x2 = (m_dwEndSel & 0xFFF8) >> 3; @@ -1066,15 +1070,15 @@ y2 += dy; nChannels = pSndFile->m_nChannels; nRows = pSndFile->PatternSize[m_nPattern]; - if (x1 < GetXScrollPos()) bLeft = FALSE; - if (x1 >= nChannels) x1 = nChannels-1; - if (x1 < 0) { x1 = 0; c1 = 0; bLeft = FALSE; } - if (x2 >= nChannels) { x2 = nChannels-1; c2 = 4; bRight = FALSE; } + if (x1 < GetXScrollPos()) bLeft = false; + if (x1 >= nChannels) x1 = nChannels - 1; + if (x1 < 0) { x1 = 0; c1 = 0; bLeft = false; } + if (x2 >= nChannels) { x2 = nChannels-1; c2 = 4; bRight = false; } if (x2 < 0) x2 = 0; - if (y1 < GetYScrollPos() - (int)m_nMidRow) bTop = FALSE; + if (y1 < GetYScrollPos() - (int)m_nMidRow) bTop = false; if (y1 >= nRows) y1 = nRows-1; - if (y1 < 0) { y1 = 0; bTop = FALSE; } - if (y2 >= nRows) { y2 = nRows-1; bBottom = FALSE; } + if (y1 < 0) { y1 = 0; bTop = false; } + if (y2 >= nRows) { y2 = nRows-1; bBottom = false; } if (y2 < 0) y2 = 0; dwTopLeft = (y1<<16)|(x1<<3)|c1; dwBottomRight = ((y2+1)<<16)|(x2<<3)|(c2+1); @@ -1300,13 +1304,15 @@ } // rewbs.fix3417: adding error checking CModDoc *pModDoc = GetDocument(); - if (pModDoc) { + if (pModDoc) + { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if (pSndFile) { + if (pSndFile) + { y1 = max(y1, 0); - y2 = min(y2, (int)pSndFile->PatternSize[m_nPattern]); + y2 = min(y2, (int)pSndFile->Patterns[m_nPattern].GetNumRows()); x1 = max(x1, 0); - x2 = min(x2, pSndFile->m_nChannels*8 - 4); + x2 = min(x2, pSndFile->GetNumChannels() * 8 - 4); } } // end rewbs.fix3417 Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2010-03-28 19:31:53 UTC (rev 560) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2010-03-28 22:53:43 UTC (rev 561) @@ -123,39 +123,39 @@ // Channel flags: // Bits 0-7: Sample Flags -#define CHN_16BIT 0x01 -#define CHN_LOOP 0x02 -#define CHN_PINGPONGLOOP 0x04 -#define CHN_SUSTAINLOOP 0x08 -#define CHN_PINGPONGSUSTAIN 0x10 -#define CHN_PANNING 0x20 -#define CHN_STEREO 0x40 -#define CHN_PINGPONGFLAG 0x80 //When flag is on, sample is processed backwards +#define CHN_16BIT 0x01 // 16-bit sample +#define CHN_LOOP 0x02 // looped sample +#define CHN_PINGPONGLOOP 0x04 // bidi-looped sample +#define CHN_SUSTAINLOOP 0x08 // sample with sustain loop +#define CHN_PINGPONGSUSTAIN 0x10 // sample with bidi sustain loop +#define CHN_PANNING 0x20 // sample with forced panning +#define CHN_STEREO 0x40 // stereo sample +#define CHN_PINGPONGFLAG 0x80 // when flag is on, sample is processed backwards // Bits 8-31: Channel Flags -#define CHN_MUTE 0x100 -#define CHN_KEYOFF 0x200 -#define CHN_NOTEFADE 0x400 -#define CHN_SURROUND 0x800 -#define CHN_NOIDO 0x1000 -#define CHN_HQSRC 0x2000 -#define CHN_FILTER 0x4000 -#define CHN_VOLUMERAMP 0x8000 -#define CHN_VIBRATO 0x10000 -#define CHN_TREMOLO 0x20000 -#define CHN_PANBRELLO 0x40000 -#define CHN_PORTAMENTO 0x80000 -#define CHN_GLISSANDO 0x100000 -#define CHN_VOLENV 0x200000 -#define CHN_PANENV 0x400000 -#define CHN_PITCHENV 0x800000 -#define CHN_FASTVOLRAMP 0x1000000 -#define CHN_EXTRALOUD 0x2000000 -#define CHN_REVERB 0x4000000 -#define CHN_NOREVERB 0x8000000 -#define CHN_SOLO 0x10000000 // -> CODE#0012 -> DESC="midi keyboard split" -! NEW_FEATURE#0012 -#define CHN_NOFX 0x20000000 // -> CODE#0015 -> DESC="channels management dlg" -! NEW_FEATURE#0015 -#define CHN_SYNCMUTE 0x40000000 -#define CHN_FILTERENV 0x80000000 +#define CHN_MUTE 0x100 // muted channel +#define CHN_KEYOFF 0x200 // exit sustain +#define CHN_NOTEFADE 0x400 // fade note (instrument mode) +#define CHN_SURROUND 0x800 // use surround channel +#define CHN_NOIDO 0x1000 // ??? +#define CHN_HQSRC 0x2000 // ??? +#define CHN_FILTER 0x4000 // filtered output +#define CHN_VOLUMERAMP 0x8000 // ramp volume +#define CHN_VIBRATO 0x10000 // apply vibrato +#define CHN_TREMOLO 0x20000 // apply tremolo +#define CHN_PANBRELLO 0x40000 // apply panbrello +#define CHN_PORTAMENTO 0x80000 // apply portamento +#define CHN_GLISSANDO 0x100000 // glissando mode +#define CHN_VOLENV 0x200000 // volume envelope is active +#define CHN_PANENV 0x400000 // pan envelope is active +#define CHN_PITCHENV 0x800000 // pitch envelope is active +#define CHN_FASTVOLRAMP 0x1000000 // ramp volume very fast +#define CHN_EXTRALOUD 0x2000000 // force master volume to 0x100 +#define CHN_REVERB 0x4000000 // apply reverb +#define CHN_NOREVERB 0x8000000 // forbid reverb +#define CHN_SOLO 0x10000000 // solo channel -> CODE#0012 -> DESC="midi keyboard split" -! NEW_FEATURE#0012 +#define CHN_NOFX 0x20000000 // dry channel -> CODE#0015 -> DESC="channels management dlg" -! NEW_FEATURE#0015 +#define CHN_SYNCMUTE 0x40000000 // keep sample sync on mute +#define CHN_FILTERENV 0x80000000 // force pitch envelope to act as filter envelope #define CHN_SAMPLEFLAGS (CHN_16BIT|CHN_LOOP|CHN_PINGPONGLOOP|CHN_SUSTAINLOOP|CHN_PINGPONGSUSTAIN|CHN_PANNING|CHN_STEREO|CHN_PINGPONGFLAG) #define CHN_CHANNELFLAGS (~CHN_SAMPLEFLAGS) Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-28 19:31:53 UTC (rev 560) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-03-28 22:53:43 UTC (rev 561) @@ -912,6 +912,9 @@ for (UINT nChn=0; nChn<MAX_CHANNELS; nChn++,pChn++) { skipchn: + + MODINSTRUMENT *pIns = pChn->pModInstrument; + if ((pChn->dwFlags & CHN_NOTEFADE) && (!(pChn->nFadeOutVol|pChn->nRightVol|pChn->nLeftVol))) { pChn->nLength = 0; @@ -1071,7 +1074,8 @@ { MODINSTRUMENT *pIns = pChn->pModInstrument; // Volume Envelope - if ((pChn->dwFlags & CHN_VOLENV) && (pIns->VolEnv.nNodes)) + // IT Compatibility: S77 does not disable the volume envelope, it just pauses the counter + if (((pChn->dwFlags & CHN_VOLENV) || ((pIns->VolEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->VolEnv.nNodes)) { int envvol = getVolEnvValueFromPosition(pChn->nVolEnvPosition, pIns); @@ -1097,7 +1101,8 @@ vol = (vol * CLAMP(envvol, 0, 512)) >> 8; } // Panning Envelope - if ((pChn->dwFlags & CHN_PANENV) && (pIns->PanEnv.nNodes)) + // IT Compatibility: S79 does not disable the panning envelope, it just pauses the counter + if (((pChn->dwFlags & CHN_PANENV) || ((pIns->PanEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->PanEnv.nNodes)) { int envpos = pChn->nPanEnvPosition; UINT pt = pIns->PanEnv.nNodes - 1; @@ -1273,9 +1278,9 @@ period = CLAMP(period, 113 * 4, 856 * 4); // Pitch/Filter Envelope - if ((pChn->pModInstrument) && (pChn->dwFlags & CHN_PITCHENV) && (pChn->pModInstrument->PitchEnv.nNodes)) + // IT Compatibility: S7B does not disable the pitch envelope, it just pauses the counter + if ((pIns) && ((pChn->dwFlags & CHN_PITCHENV) || ((pIns->PitchEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pChn->pModInstrument->PitchEnv.nNodes)) { - MODINSTRUMENT *pIns = pChn->pModInstrument; int envpos = pChn->nPitchEnvPosition; UINT pt = pIns->PitchEnv.nNodes - 1; for (UINT i=0; i<(UINT)(pIns->PitchEnv.nNodes-1); i++) @@ -1583,7 +1588,7 @@ }*/ UINT freq = 0; - if(m_nType != MOD_TYPE_MPT || !pChn->pModInstrument || pChn->pModInstrument->pTuning == NULL) + if(m_nType != MOD_TYPE_MPT || !pIns || pIns->pTuning == nullptr) { freq = GetFreqFromPeriod(period, pChn->nC5Speed, nPeriodFrac); } @@ -1591,7 +1596,7 @@ { if(pChn->m_CalculateFreq || (pChn->m_ReCalculateFreqOnFirstTick && m_nTickCount == 0)) { - pChn->m_Freq = pChn->nC5Speed * vibratoFactor * pChn->pModInstrument->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps); + pChn->m_Freq = pChn->nC5Speed * vibratoFactor * pIns->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps); if(!pChn->m_CalculateFreq) pChn->m_ReCalculateFreqOnFirstTick = false; else @@ -1602,8 +1607,8 @@ } //Applying Pitch/Tempo lock. - if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT) && pChn->pModInstrument && pChn->pModInstrument->wPitchToTempoLock) - freq *= (float)m_nMusicTempo / (float)pChn->pModInstrument->wPitchToTempoLock; + if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT) && pIns && pIns->wPitchToTempoLock) + freq *= (float)m_nMusicTempo / (float)pIns->wPitchToTempoLock; if ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (freq < 256)) @@ -1621,9 +1626,8 @@ } // Increment envelope position - if (pChn->pModInstrument) + if (pIns) { - MODINSTRUMENT *pIns = pChn->pModInstrument; // Volume Envelope if (pChn->dwFlags & CHN_VOLENV) { @@ -1852,7 +1856,8 @@ if (pChn->nInc >= 0xFE00) pChn->dwFlags |= CHN_NOIDO; #endif // FASTSOUNDLIB } - if (m_pConfig->getUseGlobalPreAmp()) { + if (m_pConfig->getUseGlobalPreAmp()) + { pChn->nNewRightVol >>= MIXING_ATTENUATION; pChn->nNewLeftVol >>= MIXING_ATTENUATION; } @@ -1989,9 +1994,9 @@ MODINSTRUMENT *pIns = pChn->pModInstrument; IMixPlugin *pPlugin = NULL; - if ((instr) && (instr < MAX_INSTRUMENTS)) { + if ((instr) && (instr < MAX_INSTRUMENTS)) pIns = Instruments[instr]; - } + if ((pIns) && (pIns->nMidiChannel >= 1) && (pIns->nMidiChannel <= 16)) { UINT nPlugin = GetBestPlugin(nChn, PRIORITISE_INSTRUMENT, RESPECT_MUTES); if ((nPlugin) && (nPlugin <= MAX_MIXPLUGINS)) { @@ -2060,7 +2065,7 @@ } int CSoundFile::getVolEnvValueFromPosition(int position, MODINSTRUMENT* pIns) -//------------------------------------------------------------------------------ +//--------------------------------------------------------------------------- { UINT pt = pIns->VolEnv.nNodes - 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-03-29 20:00:13
|
Revision: 563 http://modplug.svn.sourceforge.net/modplug/?rev=563&view=rev Author: saga-games Date: 2010-03-29 20:00:06 +0000 (Mon, 29 Mar 2010) Log Message: ----------- [Fix] IT Compatibility: Always reset autovibrato settings when there's an instrument number (fix from SchismTracker) [Imp] Instrument Editor: When pasting an envelope, it's now also automatically enabled. [Ref] Simplified the IsCompatibleMode macro. This was unnecessarily confusing. Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-29 14:19:36 UTC (rev 562) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-29 20:00:06 UTC (rev 563) @@ -1602,7 +1602,7 @@ pEnv->nLoopStart = loopBegin; pEnv->nLoopEnd = loopEnd; pEnv->nReleaseNode = releaseNode; - pEnv->dwFlags = (pEnv->dwFlags & ~(ENV_LOOP|ENV_SUSTAIN|ENV_CARRY)) | (bLoop ? ENV_LOOP : 0) | (bSus ? ENV_SUSTAIN : 0) | (bCarry ? ENV_CARRY: 0); + pEnv->dwFlags = (pEnv->dwFlags & ~(ENV_LOOP|ENV_SUSTAIN|ENV_CARRY)) | (bLoop ? ENV_LOOP : 0) | (bSus ? ENV_SUSTAIN : 0) | (bCarry ? ENV_CARRY: 0) | ENV_ENABLED; int oldn = 0; for (UINT i=0; i<nPoints; i++) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-29 14:19:36 UTC (rev 562) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-29 20:00:06 UTC (rev 563) @@ -553,8 +553,12 @@ } else { resetEnvelopes(pChn); } - pChn->nAutoVibDepth = 0; - pChn->nAutoVibPos = 0; + // IT Compatibility: Always reset autovibrato settings when there's an instrument number + if(!IsCompatibleMode(TRK_IMPULSETRACKER)) + { + pChn->nAutoVibDepth = 0; + pChn->nAutoVibPos = 0; + } } else if ((pIns) && (!(pIns->VolEnv.dwFlags & ENV_ENABLED))) { resetEnvelopes(pChn); @@ -568,6 +572,13 @@ return; } + // IT Compatibility: Always reset autovibrato settings when there's an instrument number + if(IsCompatibleMode(TRK_IMPULSETRACKER)) + { + pChn->nAutoVibDepth = 0; + pChn->nAutoVibPos = 0; + } + // Tone-Portamento doesn't reset the pingpong direction flag if ((bPorta) && (pSmp == pChn->pModSample)) { Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-03-29 14:19:36 UTC (rev 562) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-03-29 20:00:06 UTC (rev 563) @@ -485,12 +485,13 @@ void SetModFlag(BYTE i, bool val) {if(i < 8*sizeof(m_ModFlags)) {m_ModFlags = (val) ? m_ModFlags |= (1 << i) : m_ModFlags &= ~(1 << i);}} // Is compatible mode for a specific tracker turned on? - // Hint 1: No need to poll for MOD_TYPE_MPT, as it will automatically be linked with MOD_TYPE_IT - // Hint 2: Always returns true for MOD / S3M format (if that is the format of the current file) - bool IsCompatibleMode(MODTYPE type) { + // Hint 1: No need to poll for MOD_TYPE_MPT, as it will automatically be linked with MOD_TYPE_IT when using TRK_IMPULSETRACKER + // Hint 2: Always returns true for MOD / S3M format (if that is the format of the current file) + bool IsCompatibleMode(MODTYPE type) + { if(GetType() & type & (MOD_TYPE_MOD | MOD_TYPE_S3M)) - return true; // those formats don't have flags so we will always return true - return ((GetType() & ((type & MOD_TYPE_IT) ? type | MOD_TYPE_MPT : type)) && GetModFlag(MSF_COMPATIBLE_PLAY)) ? true : false; + return true; // S3M and MOD format don't have compatibility flags, so we will always return true + return ((GetType() & type) && GetModFlag(MSF_COMPATIBLE_PLAY)) ? true : false; } //Tuning--> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-04-07 15:19:42
|
Revision: 565 http://modplug.svn.sourceforge.net/modplug/?rev=565&view=rev Author: saga-games Date: 2010-04-07 15:19:36 +0000 (Wed, 07 Apr 2010) Log Message: ----------- [Fix] MOD Saving: Samples were shifted badly if the sample size was odd. (wow, this is an OLD bug!) [Fix] Sample Editor: It was not possible to create the last sample slot (i.e. pressing "new sample" with a MOD file that had 30 samples would result in an error, although MOD supports 31 samples). Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/soundlib/Load_mod.cpp Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-30 19:13:11 UTC (rev 564) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-07 15:19:36 UTC (rev 565) @@ -742,7 +742,7 @@ } } if (((bLimit) && (i >= 200) && (!m_SndFile.m_nInstruments)) - || (i >= m_SndFile.GetModSpecifications().samplesMax)) + || (i > m_SndFile.GetModSpecifications().samplesMax)) { ErrorBox(IDS_ERR_TOOMANYSMP, CMainFrame::GetMainFrame()); return SAMPLEINDEX_INVALID; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2010-03-30 19:13:11 UTC (rev 564) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2010-04-07 15:19:36 UTC (rev 565) @@ -487,6 +487,9 @@ MODSAMPLE *pSmp = &Samples[insmap[iins]]; memcpy(bTab, m_szNames[iins],22); inslen[iins] = pSmp->nLength; + // if the sample size is odd, we have to add a padding byte, as all sample sizes in MODs are even. + if(inslen[iins] & 1) + inslen[iins]++; if (inslen[iins] > 0x1fff0) inslen[iins] = 0x1fff0; bTab[22] = inslen[iins] >> 9; bTab[23] = inslen[iins] >> 1; @@ -509,7 +512,7 @@ fwrite(bTab, 30, 1, f); } // Writing number of patterns - UINT nbp=0, norders=128; + UINT nbp = 0, norders = 128; for (UINT iord=0; iord<128; iord++) { if (Order[iord] == Order.GetInvalidPatIndex()) @@ -535,7 +538,8 @@ // Writing patterns for (UINT ipat=0; ipat<nbp; ipat++) { //for all patterns BYTE s[64*4]; - if (Patterns[ipat]) { //if pattern exists + if (Patterns[ipat]) //if pattern exists + { MODCOMMAND *m = Patterns[ipat]; for (UINT i=0; i<64; i++) { //for all rows if (i < PatternSize[ipat]) { //if row exists @@ -584,7 +588,7 @@ } // Writing instruments - for (UINT ismpd=1; ismpd<=31; ismpd++) if (inslen[ismpd]) + for (UINT ismpd = 1; ismpd <= 31; ismpd++) if (inslen[ismpd]) { MODSAMPLE *pSmp = &Samples[insmap[ismpd]]; if(bCompatibilityExport == true) // first two bytes have to be 0 due to PT's one-shot loop ("no loop") @@ -604,6 +608,12 @@ } #endif WriteSample(f, pSmp, flags, inslen[ismpd]); + // write padding byte if the sample size is odd. + if((pSmp->nLength & 1) && !nPacking) + { + int8 padding = 0; + fwrite(&padding, 1, 1, f); + } } fclose(f); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-04-10 22:44:04
|
Revision: 567 http://modplug.svn.sourceforge.net/modplug/?rev=567&view=rev Author: saga-games Date: 2010-04-10 22:43:18 +0000 (Sat, 10 Apr 2010) Log Message: ----------- [Mod] Updated Paul Legovitch's keymap (now also suitable for desktop keyboards); use this as the default "french" keymap in the installer. [Mod] Options: Removed the "space bar repeats previous action" option, as it did not work anymore since the new keyhandler is used; in fact, this option can be achieved instead by using the "on key hold" for the "quick paste" key shortcut. [Imp] Note Properties: Don't allow values > 63 for "break to row" commands in MOD/S3M. [Fix] ITI/ITS Loader: Sample flags were not reset when a sample slot was overwritten when loading ITI or ITS files. That way, it was possible that f.e. the bidi loop flag was not disabled when loading a new sample that had a normal loop. [Fix] Mod Conversion: When converting between XM and IT, the sample autovibrato "sweep" factor is now fixed a bit. [Mod] Removed the RegisterExtensions() call on startup (useless). Modified Paths: -------------- trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/soundlib/Sampleio.cpp Added Paths: ----------- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb Removed Paths: ------------- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/installer/install.iss 2010-04-10 22:43:18 UTC (rev 567) @@ -167,7 +167,7 @@ end; $0c: // French begin - keyboardFilepath := 'FR_mpt_classic_(vanisherIII)'; + keyboardFilepath := 'FR_mpt_(legovitch)'; end; $14: // Norwegian begin @@ -234,3 +234,4 @@ end; end; + Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -197,7 +197,7 @@ DWORD CMainFrame::m_dwMidiSetup = MIDISETUP_RECORDVELOCITY|MIDISETUP_RECORDNOTEOFF; // Pattern Setup DWORD CMainFrame::m_dwPatternSetup = PATTERN_PLAYNEWNOTE | PATTERN_EFFECTHILIGHT - | PATTERN_SMALLFONT | PATTERN_CENTERROW | PATTERN_AUTOSPACEBAR + | PATTERN_SMALLFONT | PATTERN_CENTERROW | PATTERN_DRAGNDROPEDIT | PATTERN_FLATBUTTONS | PATTERN_2NDHIGHLIGHT | PATTERN_STDHIGHLIGHT | PATTERN_HILITETIMESIGS | PATTERN_SHOWPREVIOUS | PATTERN_CONTSCROLL | PATTERN_SYNCMUTE | PATTERN_AUTODELAY | PATTERN_NOTEFADE; @@ -437,6 +437,8 @@ m_dwPatternSetup |= PATTERN_NOTEFADE; if(vIniVersion < MAKE_VERSION_NUMERIC(1,17,03,01)) m_dwPatternSetup |= PATTERN_RESETCHANNELS; + if(vIniVersion < MAKE_VERSION_NUMERIC(1,18,01,00)) + m_dwPatternSetup &= ~0x800; // quick paste autorepeat is now a keymap option m_nRowSpacing = GetPrivateProfileDWord("Pattern Editor", "RowSpacing", 16, iniFile); m_nRowSpacing2 = GetPrivateProfileDWord("Pattern Editor", "RowSpacing2", 4, iniFile); @@ -576,6 +578,7 @@ RegQueryValueEx(key, "PatternSetup", NULL, &dwREG_DWORD, (LPBYTE)&m_dwPatternSetup, &dwDWORDSize); m_dwPatternSetup |= PATTERN_NOTEFADE; // Set flag to maintain old behaviour(was changed in 1.17.02.50). m_dwPatternSetup |= PATTERN_RESETCHANNELS; // Set flag to reset channels on loop was changed in 1.17.03.01). + m_dwPatternSetup &= ~0x800; // quick paste autorepeat is now a keymap option RegQueryValueEx(key, "RowSpacing", NULL, &dwREG_DWORD, (LPBYTE)&m_nRowSpacing, &dwDWORDSize); RegQueryValueEx(key, "RowSpacing2", NULL, &dwREG_DWORD, (LPBYTE)&m_nRowSpacing2, &dwDWORDSize); RegQueryValueEx(key, "LoopSong", NULL, &dwREG_DWORD, (LPBYTE)&gbLoopSong, &dwDWORDSize); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-04-10 22:43:18 UTC (rev 567) @@ -174,7 +174,7 @@ #define PATTERN_FLATBUTTONS 0x100 // flat toolbar buttons #define PATTERN_CREATEBACKUP 0x200 // create .bak files when saving #define PATTERN_SINGLEEXPAND 0x400 // single click to expand tree -#define PATTERN_AUTOSPACEBAR 0x800 // space bar repeats previous action +//#define PATTERN_AUTOSPACEBAR 0x800 // space bar repeats previous action - DOES NOT EXIST ANYMORE, use "on key hold" instead #define PATTERN_NOEXTRALOUD 0x1000 // no loud samples in sample editor #define PATTERN_DRAGNDROPEDIT 0x2000 // enable drag and drop editing #define PATTERN_2NDHIGHLIGHT 0x4000 // activate secondary highlight Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -2325,6 +2325,11 @@ // adjust waveform types for IT/S3M if(gFXInfo[ndx].dwParamValue >= 0x30 && gFXInfo[ndx].dwParamValue <= 0x50) nmax = gFXInfo[ndx].dwParamValue | (m_SndFile.IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER) ? 0x03 : 0x07); break; + case CMD_PATTERNBREAK: + // no big patterns in MOD/S3M files + if(nType & (MOD_TYPE_MOD|MOD_TYPE_S3M)) + nmax = 63; + break; } *prangeMin = nmin; *prangeMax = nmax; @@ -2503,7 +2508,7 @@ case CMD_PANNING8: wsprintf(s, "%d", param); - if(m_SndFile.m_nType & MOD_TYPE_S3M) + if(m_SndFile.GetType() == MOD_TYPE_S3M) { if(param == 0xA4) strcpy(s, "Surround"); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -232,7 +232,7 @@ } // Transpose to Frequency (MOD/XM to S3M/IT/MPT) - if (oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT) + if(oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT) { m_SndFile.Samples[nSmp].nC5Speed = CSoundFile::TransposeToFrequency(m_SndFile.Samples[nSmp].RelativeTone, m_SndFile.Samples[nSmp].nFineTune); m_SndFile.Samples[nSmp].RelativeTone = 0; @@ -240,14 +240,26 @@ } // Frequency to Transpose (S3M/IT/MPT to MOD/XM) - if (oldTypeIsS3M_IT_MPT && newTypeIsXM) + if(oldTypeIsS3M_IT_MPT && newTypeIsXM) { CSoundFile::FrequencyToTranspose(&m_SndFile.Samples[nSmp]); if (!(m_SndFile.Samples[nSmp].uFlags & CHN_PANNING)) m_SndFile.Samples[nSmp].nPan = 128; } + + if(oldTypeIsXM && newTypeIsIT_MPT) + { + // Autovibrato settings (XM to IT, where sweep 0 means "no vibrato") + if(m_SndFile.Samples[nSmp].nVibSweep == 0 && m_SndFile.Samples[nSmp].nVibRate != 0 && m_SndFile.Samples[nSmp].nVibDepth != 0) + m_SndFile.Samples[nSmp].nVibSweep = 255; + } else if(oldTypeIsIT_MPT && newTypeIsXM) + { + // Autovibrato settings (IT to XM, where sweep 0 means "no sweep") + if(m_SndFile.Samples[nSmp].nVibSweep == 0) + m_SndFile.Samples[nSmp].nVibRate = m_SndFile.Samples[nSmp].nVibDepth = 0; + } } - // No Vibrato for MOD/S3M + // No Autovibrato for MOD/S3M if(newTypeIsMOD || newTypeIsS3M) { ctrlSmp::ResetSamples(m_SndFile, ctrlSmp::SmpResetVibrato); @@ -1197,8 +1209,8 @@ if ((hCpy) && ((p = (LPSTR)GlobalLock(hCpy)) != NULL)) { - TEMPO spdmax = m_SndFile.GetModSpecifications().speedMax; - DWORD dwMemSize = GlobalSize(hCpy); + const TEMPO spdmax = m_SndFile.GetModSpecifications().speedMax; + const DWORD dwMemSize = GlobalSize(hCpy); MODCOMMAND *m = m_SndFile.Patterns[nPattern]; UINT nrow = dwBeginSel >> 16; UINT ncol = (dwBeginSel & 0xFFFF) >> 3; Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -613,7 +613,6 @@ {PATTERN_FLATBUTTONS, "Flat Buttons", "Use flat buttons in toolbars"}, {PATTERN_SINGLEEXPAND, "Single click to expand tree", "Single-clicking in the left tree view will expand a branch"}, {PATTERN_MUTECHNMODE, "Ignored muted channels", "Notes will not be played on muted channels (unmuting will only start on a new note)."}, - {PATTERN_AUTOSPACEBAR, "Quick cursor paste Auto-Repeat", "Leaving the space bar pressed will auto-repeat the action"}, {PATTERN_NOEXTRALOUD, "No loud samples", "Disable loud playback of samples in the sample/instrument editor. Sample volume depends on the sample volume slider on the general tab when activated."}, {PATTERN_SHOWPREVIOUS, "Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor. Does not work if \"always center active row\" is disabled."}, {PATTERN_CONTSCROLL, "Continuous scroll", "Jumps to the next pattern when moving past the end of a pattern"}, Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -973,7 +973,7 @@ EnableShellOpen(); // Register MOD extensions - RegisterExtensions(); + //RegisterExtensions(); // Load DirectSound (if available) m_bExWaveSupport = cmdInfo.m_bWavEx; Added: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb (rev 0) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb 2010-04-10 22:43:18 UTC (rev 567) @@ -0,0 +1,356 @@ +//-------- OpenMPT key binding definition file ------- +//-Format is: - +//- Context:Command ID:Modifiers:Key:KeypressEventType //Comments - +//---------------------------------------------------------------------- +version:1 + +//----( Global Context (0) )------------ +0:1347:2:78:1 //File/New: Ctrl+N (KeyDown) +0:1346:2:79:1 //File/Open: Ctrl+O (KeyDown) +0:1348:2:87:1 //File/Close: Ctrl+W (KeyDown) +0:1349:2:83:1 //File/Save: Ctrl+S (KeyDown) +0:1350:3:83:1 //File/Save As: Shift+Ctrl+S (KeyDown) +0:1693:6:37:1 //Previous Document: Ctrl+Alt+GAUCHE (KeyDown) +0:1694:6:39:1 //Next Document: Ctrl+Alt+DROITE (KeyDown) +0:1030:0:114:1 //Play song/Pause song: F3 (KeyDown) +0:1375:0:27:1 //Stop Song: ECHAP (KeyDown) +0:1026:0:115:1 //Play pattern from cursor: F4 (KeyDown) +0:1359:2:90:1 //Undo: Ctrl+Z (KeyDown) +0:1360:2:88:1 //Cut: Ctrl+X (KeyDown) +0:1361:2:67:1 //Copy: Ctrl+C (KeyDown) +0:1361:2:45:1 //Copy: Ctrl+INS (KeyDown) +0:1362:2:86:1 //Paste: Ctrl+V (KeyDown) +0:1362:1:45:1 //Paste: Shift+INS (KeyDown) +0:1363:6:86:1 //Mix Paste: Ctrl+Alt+V (KeyDown) +0:1793:7:86:1 //Paste Flood: Shift+Ctrl+Alt+V (KeyDown) +0:1364:2:53:1 //SelectAll: Ctrl+( (KeyDown) +0:1365:2:70:1 //Find: Ctrl+F (KeyDown) +0:1366:6:70:1 //Find Next: Ctrl+Alt+F (KeyDown) +0:1021:0:116:1 //View General: F5 (KeyDown) +0:1022:0:117:1 //View Pattern: F6 (KeyDown) +0:1023:0:118:1 //View Samples: F7 (KeyDown) +0:1024:0:119:1 //View Instruments: F8 (KeyDown) +0:1025:0:120:1 //View Comments: F9 (KeyDown) +0:1367:6:87:1 //Toggle Main View: Ctrl+Alt+W (KeyDown) +0:1368:0:112:1 //Toggle Tree View: F1 (KeyDown) +0:1369:2:112:1 //View Options: Ctrl+F1 (KeyDown) +0:1670:2:116:1 //View Channel Manager: Ctrl+F5 (KeyDown) +0:1669:2:117:1 //View Plugin Manager: Ctrl+F6 (KeyDown) +0:1775:6:112:1 //Show song properties window: Ctrl+Alt+F1 (KeyDown) +0:1032:2:38:1 //Previous instrument: Ctrl+HAUT (KeyDown) +0:1033:2:40:1 //Next instrument: Ctrl+BAS (KeyDown) +0:1036:0:122:1 //Previous octave: F11 (KeyDown) +0:1037:0:123:1 //Next octave: F12 (KeyDown) +0:1034:2:37:5 //Previous order: Ctrl+GAUCHE (KeyDown|KeyHold) +0:1035:2:39:5 //Next order: Ctrl+DROITE (KeyDown|KeyHold) + +//----( General Context [bottom] (1) )------------ + +//----( Pattern Context [bottom] (2) )------------ +2:1017:0:34:1 //Jump down by measure: PG.SUIV (KeyDown) +2:1018:0:33:1 //Jump up by measure: PG.PREC (KeyDown) +2:1338:4:34:1 //Jump down by beat: Alt+PG.SUIV (KeyDown) +2:1339:4:33:1 //Jump up by beat: Alt+PG.PREC (KeyDown) +2:1340:6:34:5 //Snap down to beat: Ctrl+Alt+PG.SUIV (KeyDown|KeyHold) +2:1341:6:33:5 //Snap up to beat: Ctrl+Alt+PG.PREC (KeyDown|KeyHold) +2:1038:0:40:5 //Navigate down by 1 row: BAS (KeyDown|KeyHold) +2:1039:0:38:5 //Navigate up by 1 row: HAUT (KeyDown|KeyHold) +2:1691:4:40:5 //Navigate down by spacing: Alt+BAS (KeyDown|KeyHold) +2:1692:4:38:5 //Navigate up by spacing: Alt+HAUT (KeyDown|KeyHold) +2:1040:0:37:5 //Navigate left: GAUCHE (KeyDown|KeyHold) +2:1041:0:39:5 //Navigate right: DROITE (KeyDown|KeyHold) +2:1042:0:9:1 //Navigate to next channel: TAB (KeyDown) +2:1042:4:39:1 //Navigate to next channel: Alt+DROITE (KeyDown) +2:1043:1:9:1 //Navigate to previous channel: Shift+TAB (KeyDown) +2:1043:4:37:1 //Navigate to previous channel: Alt+GAUCHE (KeyDown) +2:1044:2:36:1 //Go to first channel: Ctrl+ORIGINE (KeyDown) +2:1045:0:36:1 //Go to first row: ORIGINE (KeyDown) +2:1046:6:36:1 //Go to first row of first channel: Ctrl+Alt+ORIGINE (KeyDown) +2:1047:2:35:1 //Go to last channel: Ctrl+FIN (KeyDown) +2:1048:0:35:1 //Go to last row: FIN (KeyDown) +2:1049:6:35:1 //Go to last row of last channel: Ctrl+Alt+FIN (KeyDown) +2:1050:1:16:1 //Selection key: Shift+MAJ (KeyDown) +2:1011:2:76:1 //Select channel / Select all: Ctrl+L (KeyDown) +2:1663:0:32:1 //Toggle follow song: ESPACE (KeyDown) +2:1003:0:13:1 //Quick copy: ENTREE (KeyDown) +2:1004:1:13:1 //Quick paste: Shift+ENTREE (KeyDown) +2:1001:2:32:1 //Enable recording: Ctrl+ESPACE (KeyDown) +2:1002:2:13:5 //Play row: Ctrl+ENTREE (KeyDown|KeyHold) +2:1317:4:18:1 //Set row jump on note entry: Alt (KeyDown) +2:1685:2:9:1 //Switch to order list: Ctrl+TAB (KeyDown) +2:1806:2:68:1 //Duplicate pattern: Ctrl+D (KeyDown) +2:1836:2:222:1 //Edit plugin assigned to PC note: Ctrl+\xB2 (KeyDown) +2:1662:6:80:1 //Toggle channel's plugin editor: Ctrl+Alt+P (KeyDown) +2:1062:0:110:1 //Show note properties: . (PAVE NUM.) (KeyDown) +2:1776:4:32:1 //Toggle loop pattern: Alt+ESPACE (KeyDown) +2:1006:0:113:1 //Solo current channel: F2 (KeyDown) +2:1778:2:113:1 //Unmute all channels on pattern transition: Ctrl+F2 (KeyDown) +2:1779:1:113:1 //Solo channel on pattern transition: Shift+F2 (KeyDown) +2:1007:2:65:1 //Transpose +1: Ctrl+A (KeyDown) +2:1008:2:81:1 //Transpose -1: Ctrl+Q (KeyDown) +2:1009:6:65:5 //Transpose +12: Ctrl+Alt+A (KeyDown|KeyHold) +2:1010:6:81:5 //Transpose -12: Ctrl+Alt+Q (KeyDown|KeyHold) +2:1012:2:77:1 //Amplify selection: Ctrl+M (KeyDown) +2:1014:2:74:1 //Interpolate volume: Ctrl+J (KeyDown) +2:1015:2:75:1 //Interpolate effect: Ctrl+K (KeyDown) +2:1016:4:66:1 //Open effect visualizer: Alt+B (KeyDown) +2:1013:2:73:1 //Apply current instrument: Ctrl+I (KeyDown) +2:1660:4:69:5 //Grow selection: Alt+E (KeyDown|KeyHold) +2:1661:4:68:5 //Shrink selection: Alt+D (KeyDown|KeyHold) +2:1057:2:46:1 //Clear row: Ctrl+SUPPR (KeyDown) +2:1058:1:46:1 //Clear field: Shift+SUPPR (KeyDown) +2:1664:0:46:1 //Clear field (IT Style): SUPPR (KeyDown) +2:1059:3:46:1 //Clear row and step: Shift+Ctrl+SUPPR (KeyDown) +2:1061:0:8:1 //Delete rows: RET.ARR (KeyDown) +2:1377:4:8:5 //Delete all rows: Alt+RET.ARR (KeyDown|KeyHold) +2:1378:0:45:1 //Insert Row: INS (KeyDown) +2:1379:4:45:1 //Insert All Rows: Alt+INS (KeyDown) +2:1055:2:109:5 //Previous pattern: Ctrl+- (PAVE NUM.) (KeyDown|KeyHold) +2:1054:2:107:5 //Next pattern: Ctrl++ (PAVE NUM.) (KeyDown|KeyHold) + +//----( Pattern Context [bottom] - Note Col (3) )------------ +3:1064:0:65:1 //Base octave C: A (KeyDown) +3:1065:0:90:1 //Base octave C#: Z (KeyDown) +3:1066:0:69:1 //Base octave D: E (KeyDown) +3:1067:0:82:1 //Base octave D#: R (KeyDown) +3:1068:0:84:1 //Base octave E: T (KeyDown) +3:1069:0:89:1 //Base octave F: Y (KeyDown) +3:1070:0:85:1 //Base octave F#: U (KeyDown) +3:1071:0:73:1 //Base octave G: I (KeyDown) +3:1072:0:79:1 //Base octave G#: O (KeyDown) +3:1073:0:80:1 //Base octave A: P (KeyDown) +3:1074:0:221:1 //Base octave A#: ACCENT CIRCONFLEXE (KeyDown) +3:1075:0:186:1 //Base octave B: $ (KeyDown) +3:1076:0:81:1 //Base octave +1 C: Q (KeyDown) +3:1077:0:83:1 //Base octave +1 C#: S (KeyDown) +3:1078:0:68:1 //Base octave +1 D: D (KeyDown) +3:1079:0:70:1 //Base octave +1 D#: F (KeyDown) +3:1080:0:71:1 //Base octave +1 E: G (KeyDown) +3:1081:0:72:1 //Base octave +1 F: H (KeyDown) +3:1082:0:74:1 //Base octave +1 F#: J (KeyDown) +3:1083:0:75:1 //Base octave +1 G: K (KeyDown) +3:1084:0:76:1 //Base octave +1 G#: L (KeyDown) +3:1085:0:77:1 //Base octave +1 A: M (KeyDown) +3:1086:0:192:1 //Base octave +1 A#: \xF9 (KeyDown) +3:1087:0:220:1 //Base octave +1 B: * (KeyDown) +3:1088:0:87:1 //Base octave +2 C: W (KeyDown) +3:1089:0:88:1 //Base octave +2 C#: X (KeyDown) +3:1090:0:67:1 //Base octave +2 D: C (KeyDown) +3:1091:0:86:1 //Base octave +2 D#: V (KeyDown) +3:1092:0:66:1 //Base octave +2 E: B (KeyDown) +3:1093:0:78:1 //Base octave +2 F: N (KeyDown) +3:1094:0:188:1 //Base octave +2 F#: , (KeyDown) +3:1095:0:190:1 //Base octave +2 G: ; (KeyDown) +3:1096:0:191:1 //Base octave +2 G#: : (KeyDown) +3:1097:0:223:1 //Base octave +2 A: ! (KeyDown) +3:1212:0:48:1 //Set octave 0: \xE0 (KeyDown) +3:1212:0:96:1 //Set octave 0: 0 (PAVE NUM.) (KeyDown) +3:1213:0:49:1 //Set octave 1: & (KeyDown) +3:1213:0:97:1 //Set octave 1: 1 (PAVE NUM.) (KeyDown) +3:1214:0:50:1 //Set octave 2: \xE9 (KeyDown) +3:1214:0:98:1 //Set octave 2: 2 (PAVE NUM.) (KeyDown) +3:1215:0:51:1 //Set octave 3: " (KeyDown) +3:1215:0:99:1 //Set octave 3: 3 (PAVE NUM.) (KeyDown) +3:1216:0:52:1 //Set octave 4: ' (KeyDown) +3:1216:0:100:1 //Set octave 4: 4 (PAVE NUM.) (KeyDown) +3:1217:0:53:1 //Set octave 5: ( (KeyDown) +3:1217:0:101:1 //Set octave 5: 5 (PAVE NUM.) (KeyDown) +3:1218:0:54:1 //Set octave 6: - (KeyDown) +3:1218:0:102:1 //Set octave 6: 6 (PAVE NUM.) (KeyDown) +3:1219:0:55:1 //Set octave 7: \xE8 (KeyDown) +3:1219:0:103:1 //Set octave 7: 7 (PAVE NUM.) (KeyDown) +3:1220:0:56:1 //Set octave 8: _ (KeyDown) +3:1220:0:104:1 //Set octave 8: 8 (PAVE NUM.) (KeyDown) +3:1221:0:57:1 //Set octave 9: \xE7 (KeyDown) +3:1221:0:105:1 //Set octave 9: 9 (PAVE NUM.) (KeyDown) +3:1316:1:16:1 //Chord Modifier: Shift+MAJ (KeyDown) +3:1200:1:219:1 //Note Cut: Shift+) (KeyDown) +3:1201:1:187:1 //Note Off: Shift+= (KeyDown) +3:1791:3:219:1 //Note Fade: Shift+Ctrl+) (KeyDown) +3:1667:0:219:1 //Note Cut (don't remember instrument): ) (KeyDown) +3:1668:0:187:1 //Note Off (don't remember instrument): = (KeyDown) +3:1792:2:219:1 //Note Fade (don't remember instrument): Ctrl+) (KeyDown) +3:1788:0:222:1 //Parameter control(MPTm only): \xB2 (KeyDown) +3:1789:1:222:1 //Parameter control(smooth)(MPTm only): Shift+\xB2 (KeyDown) + +//----( Pattern Context [bottom] - Ins Col (4) )------------ +4:1202:0:96:1 //Set instrument digit 0: 0 (PAVE NUM.) (KeyDown) +4:1202:0:48:1 //Set instrument digit 0: \xE0 (KeyDown) +4:1203:0:97:1 //Set instrument digit 1: 1 (PAVE NUM.) (KeyDown) +4:1203:0:49:1 //Set instrument digit 1: & (KeyDown) +4:1204:0:98:1 //Set instrument digit 2: 2 (PAVE NUM.) (KeyDown) +4:1204:0:50:1 //Set instrument digit 2: \xE9 (KeyDown) +4:1205:0:99:1 //Set instrument digit 3: 3 (PAVE NUM.) (KeyDown) +4:1205:0:51:1 //Set instrument digit 3: " (KeyDown) +4:1206:0:100:1 //Set instrument digit 4: 4 (PAVE NUM.) (KeyDown) +4:1206:0:52:1 //Set instrument digit 4: ' (KeyDown) +4:1207:0:101:1 //Set instrument digit 5: 5 (PAVE NUM.) (KeyDown) +4:1207:0:53:1 //Set instrument digit 5: ( (KeyDown) +4:1208:0:102:1 //Set instrument digit 6: 6 (PAVE NUM.) (KeyDown) +4:1208:0:54:1 //Set instrument digit 6: - (KeyDown) +4:1209:0:103:1 //Set instrument digit 7: 7 (PAVE NUM.) (KeyDown) +4:1209:0:55:1 //Set instrument digit 7: \xE8 (KeyDown) +4:1210:0:104:1 //Set instrument digit 8: 8 (PAVE NUM.) (KeyDown) +4:1211:0:105:1 //Set instrument digit 9: 9 (PAVE NUM.) (KeyDown) +4:1211:0:57:1 //Set instrument digit 9: \xE7 (KeyDown) + +//----( Pattern Context [bottom] - Vol Col (5) )------------ +5:1222:0:48:1 //Set volume digit 0: \xE0 (KeyDown) +5:1222:0:96:1 //Set volume digit 0: 0 (PAVE NUM.) (KeyDown) +5:1223:0:49:1 //Set volume digit 1: & (KeyDown) +5:1223:0:97:1 //Set volume digit 1: 1 (PAVE NUM.) (KeyDown) +5:1224:0:50:1 //Set volume digit 2: \xE9 (KeyDown) +5:1224:0:98:1 //Set volume digit 2: 2 (PAVE NUM.) (KeyDown) +5:1225:0:51:1 //Set volume digit 3: " (KeyDown) +5:1225:0:99:1 //Set volume digit 3: 3 (PAVE NUM.) (KeyDown) +5:1226:0:52:1 //Set volume digit 4: ' (KeyDown) +5:1226:0:100:1 //Set volume digit 4: 4 (PAVE NUM.) (KeyDown) +5:1227:0:53:1 //Set volume digit 5: ( (KeyDown) +5:1227:0:101:1 //Set volume digit 5: 5 (PAVE NUM.) (KeyDown) +5:1228:0:54:1 //Set volume digit 6: - (KeyDown) +5:1228:0:102:1 //Set volume digit 6: 6 (PAVE NUM.) (KeyDown) +5:1229:0:55:1 //Set volume digit 7: \xE8 (KeyDown) +5:1229:0:103:1 //Set volume digit 7: 7 (PAVE NUM.) (KeyDown) +5:1230:0:56:1 //Set volume digit 8: _ (KeyDown) +5:1231:0:57:1 //Set volume digit 9: \xE7 (KeyDown) +5:1231:0:105:1 //Set volume digit 9: 9 (PAVE NUM.) (KeyDown) +5:1232:0:86:1 //Vol command - volume: V (KeyDown) +5:1233:0:80:1 //Vol command - pan: P (KeyDown) +5:1234:0:67:1 //Vol command - vol slide up: C (KeyDown) +5:1235:0:68:1 //Vol command - vol slide down: D (KeyDown) +5:1236:0:65:1 //Vol command - vol fine slide up: A (KeyDown) +5:1237:0:66:1 //Vol command - vol fine slide down: B (KeyDown) +5:1238:0:85:1 //Vol command - vibrato speed: U (KeyDown) +5:1239:0:72:1 //Vol command - vibrato: H (KeyDown) +5:1240:0:76:1 //Vol command - XM pan left: L (KeyDown) +5:1241:0:82:1 //Vol command - XM pan right: R (KeyDown) +5:1242:0:71:1 //Vol command - Portamento: G (KeyDown) +5:1243:0:70:1 //Vol command - Portamento Up: F (KeyDown) +5:1244:0:69:1 //Vol command - Portamento Down: E (KeyDown) +5:1245:1:186:1 //Vol command - Velocity: Shift+$ (KeyDown) +5:1246:0:79:1 //Vol command - Offset: O (KeyDown) + +//----( Pattern Context [bottom] - FX Col (6) )------------ +6:1294:0:220:1 //FX midi macro slide: * (KeyDown) +6:1295:1:186:1 //FX pseudo-velocity (experimental): Shift+$ (KeyDown) +6:1666:6:51:1 //FX parameter extension command: Ctrl+Alt+" (KeyDown) + +//----( Pattern Context [bottom] - Param Col (7) )------------ +7:1247:0:48:1 //FX Param digit 0: \xE0 (KeyDown) +7:1247:0:96:1 //FX Param digit 0: 0 (PAVE NUM.) (KeyDown) +7:1248:0:49:1 //FX Param digit 1: & (KeyDown) +7:1248:0:97:1 //FX Param digit 1: 1 (PAVE NUM.) (KeyDown) +7:1249:0:50:1 //FX Param digit 2: \xE9 (KeyDown) +7:1249:0:98:1 //FX Param digit 2: 2 (PAVE NUM.) (KeyDown) +7:1250:0:51:1 //FX Param digit 3: " (KeyDown) +7:1250:0:99:1 //FX Param digit 3: 3 (PAVE NUM.) (KeyDown) +7:1251:0:52:1 //FX Param digit 4: ' (KeyDown) +7:1251:0:100:1 //FX Param digit 4: 4 (PAVE NUM.) (KeyDown) +7:1252:0:53:1 //FX Param digit 5: ( (KeyDown) +7:1252:0:101:1 //FX Param digit 5: 5 (PAVE NUM.) (KeyDown) +7:1253:0:54:1 //FX Param digit 6: - (KeyDown) +7:1253:0:102:1 //FX Param digit 6: 6 (PAVE NUM.) (KeyDown) +7:1254:0:55:1 //FX Param digit 7: \xE8 (KeyDown) +7:1254:0:103:1 //FX Param digit 7: 7 (PAVE NUM.) (KeyDown) +7:1255:0:56:1 //FX Param digit 8: _ (KeyDown) +7:1255:0:104:1 //FX Param digit 8: 8 (PAVE NUM.) (KeyDown) +7:1256:0:57:1 //FX Param digit 9: \xE7 (KeyDown) +7:1256:0:105:1 //FX Param digit 9: 9 (PAVE NUM.) (KeyDown) +7:1257:0:65:1 //FX Param digit A: A (KeyDown) +7:1258:0:66:1 //FX Param digit B: B (KeyDown) +7:1259:0:67:1 //FX Param digit C: C (KeyDown) +7:1260:0:68:1 //FX Param digit D: D (KeyDown) +7:1261:0:69:1 //FX Param digit E: E (KeyDown) +7:1262:0:70:1 //FX Param digit F: F (KeyDown) + +//----( Sample Context [bottom] (8) )------------ +8:1673:4:79:1 //Load a Sample: Alt+O (KeyDown) +8:1674:4:83:1 //Save Sample: Alt+S (KeyDown) +8:1675:4:78:1 //New Sample: Alt+N (KeyDown) +8:1380:2:84:1 //Trim sample around loop points: Ctrl+T (KeyDown) +8:1383:0:8:1 //Silence sample selection: RET.ARR (KeyDown) +8:1385:3:65:1 //Amplify Sample: Shift+Ctrl+A (KeyDown) +8:1381:3:82:1 //Reverse sample: Shift+Ctrl+R (KeyDown) +8:1382:0:46:1 //Delete sample selection: SUPPR (KeyDown) +8:1386:0:33:1 //Zoom Out: PG.PREC (KeyDown) +8:1387:0:34:1 //Zoom In: PG.SUIV (KeyDown) +8:1790:6:68:1 //Remove DC Offset: Ctrl+Alt+D (KeyDown) + +//----( Instrument Context [bottom] (9) )------------ +9:1837:2:107:5 //Zoom In: Ctrl++ (PAVE NUM.) (KeyDown|KeyHold) +9:1838:2:109:5 //Zoom Out: Ctrl+- (PAVE NUM.) (KeyDown|KeyHold) +9:1825:1:9:5 //Select previous envelope point: Shift+TAB (KeyDown|KeyHold) +9:1825:4:37:5 //Select previous envelope point: Alt+GAUCHE (KeyDown|KeyHold) +9:1826:0:9:5 //Select next envelope point: TAB (KeyDown|KeyHold) +9:1826:4:39:5 //Select next envelope point: Alt+DROITE (KeyDown|KeyHold) +9:1821:0:37:5 //Move envelope point left: GAUCHE (KeyDown|KeyHold) +9:1822:0:39:5 //Move envelope point right: DROITE (KeyDown|KeyHold) +9:1823:0:38:5 //Move envelope point up: HAUT (KeyDown|KeyHold) +9:1834:0:33:5 //Move envelope point up (big step): PG.PREC (KeyDown|KeyHold) +9:1824:0:40:5 //Move envelope point down: BAS (KeyDown|KeyHold) +9:1835:0:34:5 //Move envelope point down (big step): PG.SUIV (KeyDown|KeyHold) +9:1827:0:45:5 //Insert envelope point: INS (KeyDown|KeyHold) +9:1828:0:46:5 //Remove envelope point: SUPPR (KeyDown|KeyHold) +9:1829:0:36:1 //Set loop start: ORIGINE (KeyDown) +9:1830:0:35:1 //Set loop end: FIN (KeyDown) +9:1831:2:36:1 //Set sustain loop start: Ctrl+ORIGINE (KeyDown) +9:1832:2:35:1 //Set sustain loop end: Ctrl+FIN (KeyDown) +9:1833:2:82:1 //Toggle release node: Ctrl+R (KeyDown) + +//----( Comments Context [bottom] (10) )------------ + +//----( Unknown Context (11) )------------ + +//----( Unknown Context (12) )------------ + +//----( Plugin GUI Context (13) )------------ +13:1763:2:109:1 //Previous plugin preset: Ctrl+- (PAVE NUM.) (KeyDown) +13:1764:2:107:1 //Next plugin preset: Ctrl++ (PAVE NUM.) (KeyDown) +13:1782:2:33:1 //Plugin preset backward jump: Ctrl+PG.PREC (KeyDown) +13:1783:2:34:1 //Plugin preset forward jump: Ctrl+PG.SUIV (KeyDown) +13:1765:6:82:1 //Randomize plugin parameters: Ctrl+Alt+R (KeyDown) +13:1839:6:80:1 //Toggle parameter recording: Ctrl+Alt+P (KeyDown) + +//----( General Context [top] (14) )------------ + +//----( Pattern Context [top] (15) )------------ + +//----( Sample Context [top] (16) )------------ + +//----( Instrument Context [top] (17) )------------ + +//----( Comments Context [top] (18) )------------ + +//----( Orderlist (19) )------------ +19:1802:0:46:5 //Delete Order: SUPPR (KeyDown|KeyHold) +19:1803:0:45:5 //Insert Order: INS (KeyDown|KeyHold) +19:1804:0:13:5 //Edit Pattern: ENTREE (KeyDown|KeyHold) +19:1805:0:9:5 //Switch to pattern editor: TAB (KeyDown|KeyHold) +19:1794:0:37:5 //Previous Order: GAUCHE (KeyDown|KeyHold) +19:1795:0:39:5 //Next Order: DROITE (KeyDown|KeyHold) +19:1796:0:36:5 //First Order: ORIGINE (KeyDown|KeyHold) +19:1797:0:35:5 //Last Order: FIN (KeyDown|KeyHold) +19:1807:0:48:5 //Pattern index digit 0: \xE0 (KeyDown|KeyHold) +19:1807:0:96:5 //Pattern index digit 0: 0 (PAVE NUM.) (KeyDown|KeyHold) +19:1808:0:49:5 //Pattern index digit 1: & (KeyDown|KeyHold) +19:1808:0:97:5 //Pattern index digit 1: 1 (PAVE NUM.) (KeyDown|KeyHold) +19:1809:0:50:5 //Pattern index digit 2: \xE9 (KeyDown|KeyHold) +19:1809:0:98:5 //Pattern index digit 2: 2 (PAVE NUM.) (KeyDown|KeyHold) +19:1810:0:51:5 //Pattern index digit 3: " (KeyDown|KeyHold) +19:1810:0:99:5 //Pattern index digit 3: 3 (PAVE NUM.) (KeyDown|KeyHold) +19:1811:0:52:5 //Pattern index digit 4: ' (KeyDown|KeyHold) +19:1811:0:100:5 //Pattern index digit 4: 4 (PAVE NUM.) (KeyDown|KeyHold) +19:1812:0:53:5 //Pattern index digit 5: ( (KeyDown|KeyHold) +19:1812:0:101:5 //Pattern index digit 5: 5 (PAVE NUM.) (KeyDown|KeyHold) +19:1813:0:54:5 //Pattern index digit 6: - (KeyDown|KeyHold) +19:1813:0:102:5 //Pattern index digit 6: 6 (PAVE NUM.) (KeyDown|KeyHold) +19:1814:0:55:5 //Pattern index digit 7: \xE8 (KeyDown|KeyHold) +19:1814:0:103:5 //Pattern index digit 7: 7 (PAVE NUM.) (KeyDown|KeyHold) +19:1815:0:56:5 //Pattern index digit 8: _ (KeyDown|KeyHold) +19:1815:0:104:5 //Pattern index digit 8: 8 (PAVE NUM.) (KeyDown|KeyHold) +19:1816:0:57:5 //Pattern index digit 9: \xE7 (KeyDown|KeyHold) +19:1816:0:105:5 //Pattern index digit 9: 9 (PAVE NUM.) (KeyDown|KeyHold) +19:1817:0:38:5 //Increase pattern index : HAUT (KeyDown|KeyHold) +19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) +19:1818:0:40:5 //Decrease pattern index: BAS (KeyDown|KeyHold) +19:1818:0:189:5 //Decrease pattern index: (KeyDown|KeyHold) Deleted: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_laptop_(legovitch).mkb 2010-04-10 22:43:18 UTC (rev 567) @@ -1,343 +0,0 @@ -//-------- OpenMPT key binding definition file ------- -//-Format is: - -//- Context:Command ID:Modifiers:Key:KeypressEventType //Comments - -//---------------------------------------------------------------------- -version:1 - -//----( Global Context (0) )------------ -0:1347:2:78:1 //File/New: Ctrl+N (KeyDown) -0:1346:2:79:1 //File/Open: Ctrl+O (KeyDown) -0:1348:2:87:1 //File/Close: Ctrl+W (KeyDown) -0:1349:2:83:1 //File/Save: Ctrl+S (KeyDown) -0:1350:3:83:1 //File/Save As: Shift+Ctrl+S (KeyDown) -0:1693:6:37:1 //Previous Document: Ctrl+Alt+GAUCHE (KeyDown) -0:1694:6:39:1 //Next Document: Ctrl+Alt+DROITE (KeyDown) -0:1030:0:114:1 //Play song/Pause song: F3 (KeyDown) -0:1375:0:27:1 //Stop Song: ECHAP (KeyDown) -0:1026:0:115:1 //Play pattern from cursor: F4 (KeyDown) -0:1359:2:90:1 //Undo: Ctrl+Z (KeyDown) -0:1360:2:88:1 //Cut: Ctrl+X (KeyDown) -0:1361:2:67:1 //Copy: Ctrl+C (KeyDown) -0:1361:2:45:1 //Copy: Ctrl+INS (KeyDown) -0:1362:2:86:1 //Paste: Ctrl+V (KeyDown) -0:1362:1:45:1 //Paste: Shift+INS (KeyDown) -0:1363:6:86:1 //Mix Paste: Ctrl+Alt+V (KeyDown) -0:1793:7:86:1 //Paste Flood: Shift+Ctrl+Alt+V (KeyDown) -0:1364:2:53:1 //SelectAll: Ctrl+( (KeyDown) -0:1365:2:70:1 //Find: Ctrl+F (KeyDown) -0:1366:6:70:1 //Find Next: Ctrl+Alt+F (KeyDown) -0:1021:0:116:1 //View General: F5 (KeyDown) -0:1022:0:117:1 //View Pattern: F6 (KeyDown) -0:1023:0:118:1 //View Samples: F7 (KeyDown) -0:1024:0:119:1 //View Instruments: F8 (KeyDown) -0:1025:0:120:1 //View Comments: F9 (KeyDown) -0:1367:6:87:1 //Toggle Main View: Ctrl+Alt+W (KeyDown) -0:1368:0:112:1 //Toggle Tree View: F1 (KeyDown) -0:1369:2:112:1 //View Options: Ctrl+F1 (KeyDown) -0:1670:2:116:1 //View Channel Manager: Ctrl+F5 (KeyDown) -0:1669:2:117:1 //View Plugin Manager: Ctrl+F6 (KeyDown) -0:1775:6:112:1 //Show song properties window: Ctrl+Alt+F1 (KeyDown) -0:1032:2:38:1 //Previous instrument: Ctrl+HAUT (KeyDown) -0:1033:2:40:1 //Next instrument: Ctrl+BAS (KeyDown) -0:1036:0:122:1 //Previous octave: F11 (KeyDown) -0:1037:0:123:1 //Next octave: F12 (KeyDown) -0:1034:2:37:5 //Previous order: Ctrl+GAUCHE (KeyDown|KeyHold) -0:1035:2:39:5 //Next order: Ctrl+DROITE (KeyDown|KeyHold) - -//----( General Context [bottom] (1) )------------ - -//----( Pattern Context [bottom] (2) )------------ -2:1017:0:34:1 //Jump down by measure: PG.SUIV (KeyDown) -2:1018:0:33:1 //Jump up by measure: PG.PREC (KeyDown) -2:1338:4:34:1 //Jump down by beat: Alt+PG.SUIV (KeyDown) -2:1339:4:33:1 //Jump up by beat: Alt+PG.PREC (KeyDown) -2:1340:6:34:5 //Snap down to beat: Ctrl+Alt+PG.SUIV (KeyDown|KeyHold) -2:1341:6:33:5 //Snap up to beat: Ctrl+Alt+PG.PREC (KeyDown|KeyHold) -2:1038:0:40:5 //Navigate down by 1 row: BAS (KeyDown|KeyHold) -2:1039:0:38:5 //Navigate up by 1 row: HAUT (KeyDown|KeyHold) -2:1691:4:167:5 //Navigate down by spacing: Alt+ (KeyDown|KeyHold) -2:1692:4:166:5 //Navigate up by spacing: Alt+ (KeyDown|KeyHold) -2:1040:0:37:5 //Navigate left: GAUCHE (KeyDown|KeyHold) -2:1041:0:39:5 //Navigate right: DROITE (KeyDown|KeyHold) -2:1042:0:9:1 //Navigate to next channel: TAB (KeyDown) -2:1042:0:167:1 //Navigate to next channel: (KeyDown) -2:1043:1:9:1 //Navigate to previous channel: Shift+TAB (KeyDown) -2:1043:0:166:1 //Navigate to previous channel: (KeyDown) -2:1044:2:36:1 //Go to first channel: Ctrl+ORIGINE (KeyDown) -2:1045:0:36:1 //Go to first row: ORIGINE (KeyDown) -2:1046:6:36:1 //Go to first row of first channel: Ctrl+Alt+ORIGINE (KeyDown) -2:1047:2:35:1 //Go to last channel: Ctrl+FIN (KeyDown) -2:1048:0:35:1 //Go to last row: FIN (KeyDown) -2:1049:6:35:1 //Go to last row of last channel: Ctrl+Alt+FIN (KeyDown) -2:1050:1:16:1 //Selection key: Shift+MAJ (KeyDown) -2:1011:2:76:1 //Select channel / Select all: Ctrl+L (KeyDown) -2:1663:0:32:1 //Toggle follow song: ESPACE (KeyDown) -2:1003:0:13:1 //Quick copy: ENTREE (KeyDown) -2:1004:1:13:1 //Quick paste: Shift+ENTREE (KeyDown) -2:1001:2:32:1 //Enable recording: Ctrl+ESPACE (KeyDown) -2:1002:2:13:5 //Play row: Ctrl+ENTREE (KeyDown|KeyHold) -2:1317:4:18:1 //Set row jump on note entry: Alt (KeyDown) -2:1685:2:9:1 //Switch to order list: Ctrl+TAB (KeyDown) -2:1806:2:68:1 //Duplicate pattern: Ctrl+D (KeyDown) -2:1662:6:80:1 //Toggle channel's plugin editor: Ctrl+Alt+P (KeyDown) -2:1062:0:255:1 //Show note properties: (KeyDown) -2:1776:4:32:1 //Toggle loop pattern: Alt+ESPACE (KeyDown) -2:1006:0:113:1 //Solo current channel: F2 (KeyDown) -2:1778:2:113:1 //Unmute all channels on pattern transition: Ctrl+F2 (KeyDown) -2:1779:1:113:1 //Solo channel on pattern transition: Shift+F2 (KeyDown) -2:1007:2:65:5 //Transpose +1: Ctrl+A (KeyDown|KeyHold) -2:1008:2:81:1 //Transpose -1: Ctrl+Q (KeyDown) -2:1009:6:65:5 //Transpose +12: Ctrl+Alt+A (KeyDown|KeyHold) -2:1010:6:81:5 //Transpose -12: Ctrl+Alt+Q (KeyDown|KeyHold) -2:1012:2:77:1 //Amplify selection: Ctrl+M (KeyDown) -2:1014:2:74:1 //Interpolate volume: Ctrl+J (KeyDown) -2:1015:2:75:1 //Interpolate effect: Ctrl+K (KeyDown) -2:1016:4:66:1 //Open effect visualizer: Alt+B (KeyDown) -2:1013:2:73:1 //Apply current instrument: Ctrl+I (KeyDown) -2:1660:4:69:5 //Grow selection: Alt+E (KeyDown|KeyHold) -2:1661:4:68:5 //Shrink selection: Alt+D (KeyDown|KeyHold) -2:1057:2:46:1 //Clear row: Ctrl+SUPPR (KeyDown) -2:1058:1:46:1 //Clear field: Shift+SUPPR (KeyDown) -2:1664:0:46:1 //Clear field (IT Style): SUPPR (KeyDown) -2:1059:3:46:1 //Clear row and step: Shift+Ctrl+SUPPR (KeyDown) -2:1061:0:8:1 //Delete rows: RET.ARR (KeyDown) -2:1377:4:8:5 //Delete all rows: Alt+RET.ARR (KeyDown|KeyHold) -2:1378:0:45:1 //Insert Row: INS (KeyDown) -2:1379:4:45:1 //Insert All Rows: Alt+INS (KeyDown) -2:1055:2:166:5 //Previous pattern: Ctrl+ (KeyDown|KeyHold) -2:1054:2:167:5 //Next pattern: Ctrl+ (KeyDown|KeyHold) - -//----( Pattern Context [bottom] - Note Col (3) )------------ -3:1064:0:65:1 //Base octave C: A (KeyDown) -3:1065:0:90:1 //Base octave C#: Z (KeyDown) -3:1066:0:69:1 //Base octave D: E (KeyDown) -3:1067:0:82:1 //Base octave D#: R (KeyDown) -3:1068:0:84:1 //Base octave E: T (KeyDown) -3:1069:0:89:1 //Base octave F: Y (KeyDown) -3:1070:0:85:1 //Base octave F#: U (KeyDown) -3:1071:0:73:1 //Base octave G: I (KeyDown) -3:1072:0:79:1 //Base octave G#: O (KeyDown) -3:1073:0:80:1 //Base octave A: P (KeyDown) -3:1074:0:221:1 //Base octave A#: ACCENT CIRCONFLEXE (KeyDown) -3:1075:0:186:1 //Base octave B: $ (KeyDown) -3:1076:0:81:1 //Base octave +1 C: Q (KeyDown) -3:1077:0:83:1 //Base octave +1 C#: S (KeyDown) -3:1078:0:68:1 //Base octave +1 D: D (KeyDown) -3:1079:0:70:1 //Base octave +1 D#: F (KeyDown) -3:1080:0:71:1 //Base octave +1 E: G (KeyDown) -3:1081:0:72:1 //Base octave +1 F: H (KeyDown) -3:1082:0:74:1 //Base octave +1 F#: J (KeyDown) -3:1083:0:75:1 //Base octave +1 G: K (KeyDown) -3:1084:0:76:1 //Base octave +1 G#: L (KeyDown) -3:1085:0:77:1 //Base octave +1 A: M (KeyDown) -3:1086:0:192:1 //Base octave +1 A#: \xF9 (KeyDown) -3:1087:0:220:1 //Base octave +1 B: * (KeyDown) -3:1088:0:87:1 //Base octave +2 C: W (KeyDown) -3:1089:0:88:1 //Base octave +2 C#: X (KeyDown) -3:1090:0:67:1 //Base octave +2 D: C (KeyDown) -3:1091:0:86:1 //Base octave +2 D#: V (KeyDown) -3:1092:0:66:1 //Base octave +2 E: B (KeyDown) -3:1093:0:78:1 //Base octave +2 F: N (KeyDown) -3:1094:0:188:1 //Base octave +2 F#: , (KeyDown) -3:1095:0:190:1 //Base octave +2 G: ; (KeyDown) -3:1096:0:191:1 //Base octave +2 G#: : (KeyDown) -3:1097:0:223:1 //Base octave +2 A: ! (KeyDown) -3:1212:0:48:1 //Set octave 0: \xE0 (KeyDown) -3:1212:0:96:1 //Set octave 0: 0 (PAVE NUM.) (KeyDown) -3:1213:0:49:1 //Set octave 1: & (KeyDown) -3:1214:0:50:1 //Set octave 2: \xE9 (KeyDown) -3:1215:0:51:1 //Set octave 3: " (KeyDown) -3:1216:0:52:1 //Set octave 4: ' (KeyDown) -3:1217:0:53:1 //Set octave 5: ( (KeyDown) -3:1218:0:54:1 //Set octave 6: - (KeyDown) -3:1219:0:55:1 //Set octave 7: \xE8 (KeyDown) -3:1220:0:56:1 //Set octave 8: _ (KeyDown) -3:1221:0:57:1 //Set octave 9: \xE7 (KeyDown) -3:1316:1:16:1 //Chord Modifier: Shift+MAJ (KeyDown) -3:1200:1:219:1 //Note Cut: Shift+) (KeyDown) -3:1201:1:187:1 //Note Off: Shift+= (KeyDown) -3:1791:3:219:1 //Note Fade: Shift+Ctrl+) (KeyDown) -3:1667:0:219:1 //Note Cut (don't remember instrument): ) (KeyDown) -3:1668:0:187:1 //Note Off (don't remember instrument): = (KeyDown) -3:1792:2:219:1 //Note Fade (don't remember instrument): Ctrl+) (KeyDown) -3:1788:0:222:1 //Parameter control(MPTm only): \xB2 (KeyDown) -3:1789:1:222:1 //Parameter control(smooth)(MPTm only): Shift+\xB2 (KeyDown) - -//----( Pattern Context [bottom] - Ins Col (4) )------------ -4:1202:0:96:1 //Set instrument digit 0: 0 (PAVE NUM.) (KeyDown) -4:1202:0:48:1 //Set instrument digit 0: \xE0 (KeyDown) -4:1203:0:97:1 //Set instrument digit 1: 1 (PAVE NUM.) (KeyDown) -4:1203:0:49:1 //Set instrument digit 1: & (KeyDown) -4:1204:0:98:1 //Set instrument digit 2: 2 (PAVE NUM.) (KeyDown) -4:1204:0:50:1 //Set instrument digit 2: \xE9 (KeyDown) -4:1205:0:99:1 //Set instrument digit 3: 3 (PAVE NUM.) (KeyDown) -4:1205:0:51:1 //Set instrument digit 3: " (KeyDown) -4:1206:0:100:1 //Set instrument digit 4: 4 (PAVE NUM.) (KeyDown) -4:1206:0:52:1 //Set instrument digit 4: ' (KeyDown) -4:1207:0:101:1 //Set instrument digit 5: 5 (PAVE NUM.) (KeyDown) -4:1207:0:53:1 //Set instrument digit 5: ( (KeyDown) -4:1208:0:102:1 //Set instrument digit 6: 6 (PAVE NUM.) (KeyDown) -4:1208:0:54:1 //Set instrument digit 6: - (KeyDown) -4:1209:0:103:1 //Set instrument digit 7: 7 (PAVE NUM.) (KeyDown) -4:1209:0:55:1 //Set instrument digit 7: \xE8 (KeyDown) -4:1210:0:104:1 //Set instrument digit 8: 8 (PAVE NUM.) (KeyDown) -4:1211:0:105:1 //Set instrument digit 9: 9 (PAVE NUM.) (KeyDown) -4:1211:0:57:1 //Set instrument digit 9: \xE7 (KeyDown) - -//----( Pattern Context [bottom] - Vol Col (5) )------------ -5:1222:0:48:1 //Set volume digit 0: \xE0 (KeyDown) -5:1222:0:96:1 //Set volume digit 0: 0 (PAVE NUM.) (KeyDown) -5:1223:0:49:1 //Set volume digit 1: & (KeyDown) -5:1223:0:97:1 //Set volume digit 1: 1 (PAVE NUM.) (KeyDown) -5:1224:0:50:1 //Set volume digit 2: \xE9 (KeyDown) -5:1224:0:98:1 //Set volume digit 2: 2 (PAVE NUM.) (KeyDown) -5:1225:0:51:1 //Set volume digit 3: " (KeyDown) -5:1225:0:99:1 //Set volume digit 3: 3 (PAVE NUM.) (KeyDown) -5:1226:0:52:1 //Set volume digit 4: ' (KeyDown) -5:1226:0:100:1 //Set volume digit 4: 4 (PAVE NUM.) (KeyDown) -5:1227:0:53:1 //Set volume digit 5: ( (KeyDown) -5:1227:0:101:1 //Set volume digit 5: 5 (PAVE NUM.) (KeyDown) -5:1228:0:54:1 //Set volume digit 6: - (KeyDown) -5:1228:0:102:1 //Set volume digit 6: 6 (PAVE NUM.) (KeyDown) -5:1229:0:55:1 //Set volume digit 7: \xE8 (KeyDown) -5:1229:0:103:1 //Set volume digit 7: 7 (PAVE NUM.) (KeyDown) -5:1230:0:56:1 //Set volume digit 8: _ (KeyDown) -5:1231:0:57:1 //Set volume digit 9: \xE7 (KeyDown) -5:1231:0:105:1 //Set volume digit 9: 9 (PAVE NUM.) (KeyDown) -5:1232:0:86:1 //Vol command - volume: V (KeyDown) -5:1233:0:80:1 //Vol command - pan: P (KeyDown) -5:1234:0:67:1 //Vol command - vol slide up: C (KeyDown) -5:1235:0:68:1 //Vol command - vol slide down: D (KeyDown) -5:1236:0:65:1 //Vol command - vol fine slide up: A (KeyDown) -5:1237:0:66:1 //Vol command - vol fine slide down: B (KeyDown) -5:1238:0:85:1 //Vol command - vibrato speed: U (KeyDown) -5:1239:0:72:1 //Vol command - vibrato: H (KeyDown) -5:1240:0:76:1 //Vol command - XM pan left: L (KeyDown) -5:1241:0:82:1 //Vol command - XM pan right: R (KeyDown) -5:1242:0:71:1 //Vol command - Portamento: G (KeyDown) -5:1243:0:70:1 //Vol command - Portamento Up: F (KeyDown) -5:1244:0:69:1 //Vol command - Portamento Down: E (KeyDown) -5:1245:1:186:1 //Vol command - Velocity: Shift+$ (KeyDown) -5:1246:0:79:1 //Vol command - Offset: O (KeyDown) - -//----( Pattern Context [bottom] - FX Col (6) )------------ -6:1294:0:220:1 //FX midi macro slide: * (KeyDown) -6:1295:1:186:1 //FX pseudo-velocity (experimental): Shift+$ (KeyDown) -6:1666:6:51:1 //FX parameter extension command: Ctrl+Alt+" (KeyDown) - -//----( Pattern Context [bottom] - Param Col (7) )------------ -7:1247:0:48:1 //FX Param digit 0: \xE0 (KeyDown) -7:1247:0:96:1 //FX Param digit 0: 0 (PAVE NUM.) (KeyDown) -7:1248:0:49:1 //FX Param digit 1: & (KeyDown) -7:1248:0:97:1 //FX Param digit 1: 1 (PAVE NUM.) (KeyDown) -7:1249:0:50:1 //FX Param digit 2: \xE9 (KeyDown) -7:1249:0:98:1 //FX Param digit 2: 2 (PAVE NUM.) (KeyDown) -7:1250:0:51:1 //FX Param digit 3: " (KeyDown) -7:1250:0:99:1 //FX Param digit 3: 3 (PAVE NUM.) (KeyDown) -7:1251:0:52:1 //FX Param digit 4: ' (KeyDown) -7:1251:0:100:1 //FX Param digit 4: 4 (PAVE NUM.) (KeyDown) -7:1252:0:53:1 //FX Param digit 5: ( (KeyDown) -7:1252:0:101:1 //FX Param digit 5: 5 (PAVE NUM.) (KeyDown) -7:1253:0:54:1 //FX Param digit 6: - (KeyDown) -7:1253:0:102:1 //FX Param digit 6: 6 (PAVE NUM.) (KeyDown) -7:1254:0:55:1 //FX Param digit 7: \xE8 (KeyDown) -7:1254:0:103:1 //FX Param digit 7: 7 (PAVE NUM.) (KeyDown) -7:1255:0:56:1 //FX Param digit 8: _ (KeyDown) -7:1255:0:104:1 //FX Param digit 8: 8 (PAVE NUM.) (KeyDown) -7:1256:0:57:1 //FX Param digit 9: \xE7 (KeyDown) -7:1256:0:105:1 //FX Param digit 9: 9 (PAVE NUM.) (KeyDown) -7:1257:0:65:1 //FX Param digit A: A (KeyDown) -7:1258:0:66:1 //FX Param digit B: B (KeyDown) -7:1259:0:67:1 //FX Param digit C: C (KeyDown) -7:1260:0:68:1 //FX Param digit D: D (KeyDown) -7:1261:0:69:1 //FX Param digit E: E (KeyDown) -7:1262:0:70:1 //FX Param digit F: F (KeyDown) - -//----( Sample Context [bottom] (8) )------------ -8:1673:4:79:1 //Load a Sample: Alt+O (KeyDown) -8:1674:4:83:1 //Save Sample: Alt+S (KeyDown) -8:1675:4:78:1 //New Sample: Alt+N (KeyDown) -8:1380:2:84:1 //Trim sample around loop points: Ctrl+T (KeyDown) -8:1383:0:8:1 //Silence sample selection: RET.ARR (KeyDown) -8:1385:3:65:1 //Amplify Sample: Shift+Ctrl+A (KeyDown) -8:1381:3:82:1 //Reverse sample: Shift+Ctrl+R (KeyDown) -8:1382:0:46:1 //Delete sample selection: SUPPR (KeyDown) -8:1386:0:33:1 //Zoom Out: PG.PREC (KeyDown) -8:1387:0:34:1 //Zoom In: PG.SUIV (KeyDown) -8:1790:6:68:1 //Remove DC Offset: Ctrl+Alt+D (KeyDown) - -//----( Instrument Context [bottom] (9) )------------ -9:1825:1:9:5 //Select previous envelope point: Shift+TAB (KeyDown|KeyHold) -9:1825:0:166:5 //Select previous envelope point: (KeyDown|KeyHold) -9:1826:0:9:5 //Select next envelope point: TAB (KeyDown|KeyHold) -9:1826:0:167:5 //Select next envelope point: (KeyDown|KeyHold) -9:1821:0:37:5 //Move envelope point left: GAUCHE (KeyDown|KeyHold) -9:1822:0:39:5 //Move envelope point right: DROITE (KeyDown|KeyHold) -9:1823:0:38:5 //Move envelope point up: HAUT (KeyDown|KeyHold) -9:1834:0:33:5 //Move envelope point up (big step): PG.PREC (KeyDown|KeyHold) -9:1824:0:40:5 //Move envelope point down: BAS (KeyDown|KeyHold) -9:1835:0:34:5 //Move envelope point down (big step): PG.SUIV (KeyDown|KeyHold) -9:1827:0:45:5 //Insert envelope point: INS (KeyDown|KeyHold) -9:1828:0:46:5 //Remove envelope point: SUPPR (KeyDown|KeyHold) -9:1829:0:36:1 //Set loop start: ORIGINE (KeyDown) -9:1830:0:35:1 //Set loop end: FIN (KeyDown) -9:1831:2:36:1 //Set sustain loop start: Ctrl+ORIGINE (KeyDown) -9:1832:2:35:1 //Set sustain loop end: Ctrl+FIN (KeyDown) -9:1833:2:82:1 //Toggle release node: Ctrl+R (KeyDown) - -//----( Comments Context [bottom] (10) )------------ - -//----( Unknown Context (11) )------------ - -//----( Unknown Context (12) )------------ - -//----( Plugin GUI Context (13) )------------ -13:1763:0:166:1 //Previous plugin preset: (KeyDown) -13:1764:0:167:1 //Next plugin preset: (KeyDown) -13:1782:2:166:1 //Plugin preset backward jump: Ctrl+ (KeyDown) -13:1783:2:167:1 //Plugin preset forward jump: Ctrl+ (KeyDown) -13:1765:6:82:1 //Randomize plugin parameters: Ctrl+Alt+R (KeyDown) - -//----( General Context [top] (14) )------------ - -//----( Pattern Context [top] (15) )------------ - -//----( Sample Context [top] (16) )------------ - -//----( Instrument Context [top] (17) )------------ - -//----( Comments Context [top] (18) )------------ - -//----( Orderlist (19) )------------ -19:1802:0:46:5 //Delete Order: SUPPR (KeyDown|KeyHold) -19:1803:0:45:5 //Insert Order: INS (KeyDown|KeyHold) -19:1804:0:13:5 //Edit Pattern: ENTREE (KeyDown|KeyHold) -19:1805:0:9:5 //Switch to pattern editor: TAB (KeyDown|KeyHold) -19:1794:0:37:5 //Previous Order: GAUCHE (KeyDown|KeyHold) -19:1795:0:39:5 //Next Order: DROITE (KeyDown|KeyHold) -19:1796:0:36:5 //First Order: ORIGINE (KeyDown|KeyHold) -19:1797:0:35:5 //Last Order: FIN (KeyDown|KeyHold) -19:1807:0:48:5 //Pattern index digit 0: \xE0 (KeyDown|KeyHold) -19:1807:0:96:5 //Pattern index digit 0: 0 (PAVE NUM.) (KeyDown|KeyHold) -19:1808:0:49:5 //Pattern index digit 1: & (KeyDown|KeyHold) -19:1808:0:97:5 //Pattern index digit 1: 1 (PAVE NUM.) (KeyDown|KeyHold) -19:1809:0:50:5 //Pattern index digit 2: \xE9 (KeyDown|KeyHold) -19:1809:0:98:5 //Pattern index digit 2: 2 (PAVE NUM.) (KeyDown|KeyHold) -19:1810:0:51:5 //Pattern index digit 3: " (KeyDown|KeyHold) -19:1810:0:99:5 //Pattern index digit 3: 3 (PAVE NUM.) (KeyDown|KeyHold) -19:1811:0:52:5 //Pattern index digit 4: ' (KeyDown|KeyHold) -19:1811:0:100:5 //Pattern index digit 4: 4 (PAVE NUM.) (KeyDown|KeyHold) -19:1812:0:53:5 //Pattern index digit 5: ( (KeyDown|KeyHold) -19:1812:0:101:5 //Pattern index digit 5: 5 (PAVE NUM.) (KeyDown|KeyHold) -19:1813:0:54:5 //Pattern index digit 6: - (KeyDown|KeyHold) -19:1813:0:102:5 //Pattern index digit 6: 6 (PAVE NUM.) (KeyDown|KeyHold) -19:1814:0:55:5 //Pattern index digit 7: \xE8 (KeyDown|KeyHold) -19:1814:0:103:5 //Pattern index digit 7: 7 (PAVE NUM.) (KeyDown|KeyHold) -19:1815:0:56:5 //Pattern index digit 8: _ (KeyDown|KeyHold) -19:1815:0:104:5 //Pattern index digit 8: 8 (PAVE NUM.) (KeyDown|KeyHold) -19:1816:0:57:5 //Pattern index digit 9: \xE7 (KeyDown|KeyHold) -19:1816:0:105:5 //Pattern index digit 9: 9 (PAVE NUM.) (KeyDown|KeyHold) -19:1817:0:38:5 //Increase pattern index : HAUT (KeyDown|KeyHold) -19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) -19:1818:0:40:5 //Decrease pattern index: BAS (KeyDown|KeyHold) -19:1818:0:189:5 //Decrease pattern index: (KeyDown|KeyHold) Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-04-07 17:23:25 UTC (rev 566) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-04-10 22:43:18 UTC (rev 567) @@ -1680,11 +1680,12 @@ if (pis->C5Speed < 256) pSmp->nC5Speed = 256; pSmp->RelativeTone = 0; pSmp->nFineTune = 0; - if (m_nType & MOD_TYPE_XM) FrequencyToTranspose(pSmp); + if (GetType() == MOD_TYPE_XM) FrequencyToTranspose(pSmp); pSmp->nVolume = pis->vol << 2; if (pSmp->nVolume > 256) pSmp->nVolume = 256; pSmp->nGlobalVol = pis->gvl; if (pSmp->nGlobalVol > 64) pSmp->nGlobalVol = 64; + pSmp->uFlags = 0; if (pis->flags & 0x10) pSmp->uFlags |= CHN_LOOP; if (pis->flags & 0x20) pSmp->uFlags |= CHN_SUSTAINLOOP; if (pis->flags & 0x40) pSmp->uFlags |= CHN_PINGPONGLOOP; @@ -1700,7 +1701,8 @@ if (pis->flags & 2) { flags += 5; - if (pis->flags & 4) { + if (pis->flags & 4) + { flags |= RSF_STEREO; // -> CODE#0001 // -> DESC="enable saving stereo ITI" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-04-14 21:32:06
|
Revision: 568 http://modplug.svn.sourceforge.net/modplug/?rev=568&view=rev Author: saga-games Date: 2010-04-14 21:31:59 +0000 (Wed, 14 Apr 2010) Log Message: ----------- [Fix] XM compatibility: Volume column doesn't have an effect memory, most effects with param = 0 are useless. Those are ignored in compatibility mode playback and also when exporting the file in compatibility mode. [Fix] When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticable for example when pasting PC notes into an IT module. [Fix] Mod Conversion: When converting from MPTM to another format, the first sequence name is removed and the sequence is now sized properly when merging multiple sequences. [Imp] Treeview: Display sequence index next to sequence names. Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-10 22:43:18 UTC (rev 567) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-14 21:31:59 UTC (rev 568) @@ -392,7 +392,7 @@ ChangeFileExtension(nNewType); // Multisequences not suppported by other formats - if(!(m_SndFile.GetType() == MOD_TYPE_MPT)) MergeSequences(); + if(m_SndFile.GetType() != MOD_TYPE_MPT) MergeSequences(); // Convert sequence with separator patterns into multiple sequences? if(m_SndFile.GetType() == MOD_TYPE_MPT && m_SndFile.Order.GetNumSequences() == 1) { @@ -1097,7 +1097,7 @@ UINT note = m->note; switch(note) { - case 0: p[1] = p[2] = p[3] = '.'; break; + case NOTE_NONE: p[1] = p[2] = p[3] = '.'; break; case NOTE_KEYOFF: p[1] = p[2] = p[3] = '='; break; case NOTE_NOTECUT: p[1] = p[2] = p[3] = '^'; break; case NOTE_FADE: p[1] = p[2] = p[3] = '~'; break; @@ -1754,6 +1754,9 @@ } m_SndFile.Order.RemoveSequence(1); } + // Remove order name + fill up with empty patterns. + m_SndFile.Order.m_sName = ""; + m_SndFile.Order.resize(min(MAX_ORDERS, m_SndFile.GetModSpecifications().ordersMax)); return true; } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-04-10 22:43:18 UTC (rev 567) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-04-14 21:31:59 UTC (rev 568) @@ -760,7 +760,8 @@ if(pSndFile->Order.GetNumSequences() > 1) { // more than one sequence -> add folder - CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName; + CString sSeqName; + sSeqName.Format("%d: %s", nSeq, pSndFile->Order.GetSequence(nSeq).m_sName); if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq); UINT state = (nSeq == pSndFile->Order.GetCurrentSequenceIndex()) ? TVIS_BOLD : 0; Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-04-10 22:43:18 UTC (rev 567) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-04-14 21:31:59 UTC (rev 568) @@ -835,8 +835,7 @@ UINT vol = 0; if (p->volcmd) { - UINT volcmd = p->volcmd; - switch(volcmd) + switch(p->volcmd) { case VOLCMD_VOLUME: vol = 0x10 + p->vol; break; case VOLCMD_VOLSLIDEDOWN: vol = 0x60 + (p->vol & 0x0F); break; @@ -850,6 +849,21 @@ case VOLCMD_PANSLIDERIGHT: vol = 0xE0 + (p->vol & 0x0F); break; case VOLCMD_TONEPORTAMENTO: vol = 0xF0 + (p->vol & 0x0F); break; } + // Those values are ignored in FT2. Don't save them, also to avoid possible problems with other trackers (or MPT itself) + if(bCompatibilityExport && p->vol == 0) + { + switch(p->volcmd) + { + case VOLCMD_VOLUME: + case VOLCMD_PANNING: + case VOLCMD_VIBRATODEPTH: + case VOLCMD_TONEPORTAMENTO: + break; + default: + // no memory here. + vol = 0; + } + } } if ((note) && (p->instr) && (vol > 0x0F) && (command) && (param)) { @@ -946,13 +960,16 @@ UINT sample = pIns->Keyboard[j+12]; // Check to see if sample mapped to this note is already accounted for in this instrument - for (k=0; k<xmih.samples; k++) { - if (smptable[k] == sample) { + for (k=0; k<xmih.samples; k++) + { + if (smptable[k] == sample) + { break; } } - if (k == xmih.samples) { //we got to the end of the loop: sample unnaccounted for. + if (k == xmih.samples) //we got to the end of the loop: sample unnaccounted for. + { smptable[xmih.samples++] = sample; //record in instrument's sample table } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-10 22:43:18 UTC (rev 567) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-14 21:31:59 UTC (rev 568) @@ -1486,7 +1486,26 @@ TonePortamento(pChn, vol * 16); } else { - if (vol) pChn->nOldVolParam = vol; else vol = pChn->nOldVolParam; + // XM Compatibility: FT2 ignores some voluem commands with parameter = 0. + if(IsCompatibleMode(TRK_FASTTRACKER2) && vol == 0) + { + switch(volcmd) + { + case VOLCMD_VOLUME: + case VOLCMD_PANNING: + case VOLCMD_VIBRATODEPTH: + case VOLCMD_TONEPORTAMENTO: + break; + default: + // no memory here. + volcmd = VOLCMD_NONE; + } + + } else + { + if(vol) pChn->nOldVolParam = vol; else vol = pChn->nOldVolParam; + } + switch(volcmd) { case VOLCMD_VOLSLIDEUP: Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-10 22:43:18 UTC (rev 567) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-14 21:31:59 UTC (rev 568) @@ -3332,6 +3332,7 @@ m->command = (m->note == NOTE_PC) ? CMD_MIDI : CMD_SMOOTHMIDI; // might be removed later m->volcmd = VOLCMD_NONE; m->note = NOTE_NONE; + m->instr = 0; } // adjust extended envelope control commands This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-04-17 13:14:57
|
Revision: 569 http://modplug.svn.sourceforge.net/modplug/?rev=569&view=rev Author: saga-games Date: 2010-04-17 13:14:48 +0000 (Sat, 17 Apr 2010) Log Message: ----------- [Fix] IT Loader: ChibiTracker uses \n instead of \r in the IT comment text, which was not handled properly. [Fix] S3M Loader: Slightly improved the AdLib instrument detection. [Ref] Using #defined constants for sample (file)name length now. [Ref] Some more refactoring, especially in the j2b loader. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/IT_DEFS.H trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -306,7 +306,7 @@ { wsprintf(s, "%d: ", j); UINT l = strlen(s); - memcpy(s+l, pSndFile->m_szNames[j], 32); + memcpy(s+l, pSndFile->m_szNames[j], MAX_SAMPLENAME); s[l+32] = 0; AppendMenu(hSubMenu, MF_STRING, ID_NOTEMAP_EDITSAMPLE+j, s); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -615,11 +615,11 @@ wsprintf(s, "%d-bit %s, len: %d", pSmp->GetElementarySampleSize() * 8, (pSmp->uFlags & CHN_STEREO) ? "stereo" : "mono", pSmp->nLength); SetDlgItemText(IDC_TEXT5, s); // Name - memcpy(s, m_pSndFile->m_szNames[m_nSample], 32); + memcpy(s, m_pSndFile->m_szNames[m_nSample], MAX_SAMPLENAME); s[31] = 0; SetDlgItemText(IDC_SAMPLE_NAME, s); // File Name - memcpy(s, pSmp->filename, 22); + memcpy(s, pSmp->filename, MAX_SAMPLEFILENAME); s[21] = 0; if (m_pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) s[0] = 0; SetDlgItemText(IDC_SAMPLE_FILENAME, s); @@ -791,16 +791,16 @@ // MOD/XM strcat(szFullFilename, szExt); szFullFilename[31] = 0; - memcpy(m_pSndFile->m_szNames[m_nSample], szFullFilename, 32); + memcpy(m_pSndFile->m_szNames[m_nSample], szFullFilename, MAX_SAMPLENAME); } else { // S3M/IT szFullFilename[31] = 0; - if (!m_pSndFile->m_szNames[m_nSample][0]) memcpy(m_pSndFile->m_szNames[m_nSample], szFullFilename, 32); + if (!m_pSndFile->m_szNames[m_nSample][0]) memcpy(m_pSndFile->m_szNames[m_nSample], szFullFilename, MAX_SAMPLENAME); if (strlen(szFullFilename) < 9) strcat(szFullFilename, szExt); } szFullFilename[21] = 0; - memcpy(pSmp->filename, szFullFilename, 22); + memcpy(pSmp->filename, szFullFilename, MAX_SAMPLEFILENAME); } if ((m_pSndFile->m_nType & MOD_TYPE_XM) && (!(pSmp->uFlags & CHN_PANNING))) { @@ -980,11 +980,11 @@ } if (m_pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { - memcpy(szFileName, m_pSndFile->Samples[m_nSample].filename, 22); + memcpy(szFileName, m_pSndFile->Samples[m_nSample].filename, MAX_SAMPLEFILENAME); szFileName[22] = 0; } else { - memcpy(szFileName, m_pSndFile->m_szNames[m_nSample], 32); + memcpy(szFileName, m_pSndFile->m_szNames[m_nSample], MAX_SAMPLENAME); szFileName[32] = 0; } if (!szFileName[0]) strcpy(szFileName, "untitled"); } @@ -2313,9 +2313,9 @@ m_EditName.GetWindowText(s, sizeof(s)); for (UINT i=strlen(s); i<32; i++) s[i] = 0; s[31] = 0; - if (strncmp(s, m_pSndFile->m_szNames[m_nSample], 32)) + if (strncmp(s, m_pSndFile->m_szNames[m_nSample], MAX_SAMPLENAME)) { - memcpy(m_pSndFile->m_szNames[m_nSample], s, 32); + memcpy(m_pSndFile->m_szNames[m_nSample], s, MAX_SAMPLENAME); m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this); m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); m_pModDoc->SetModified(); @@ -2333,9 +2333,9 @@ m_EditFileName.GetWindowText(s, sizeof(s)); s[21] = 0; for (UINT i=strlen(s); i<22; i++) s[i] = 0; - if (strncmp(s, m_pSndFile->Samples[m_nSample].filename, 22)) + if (strncmp(s, m_pSndFile->Samples[m_nSample].filename, MAX_SAMPLEFILENAME)) { - memcpy(m_pSndFile->Samples[m_nSample].filename, s, 22); + memcpy(m_pSndFile->Samples[m_nSample].filename, s, MAX_SAMPLEFILENAME); m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, this); if (m_pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) m_pModDoc->SetModified(); } Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -947,7 +947,8 @@ { UINT command = m->command & 0x3F; int n = (pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands[command] : gszS3mCommands[command]; - if (n <= ' ') n = '?'; + ASSERT(n > ' '); + //if (n <= ' ') n = '?'; DrawLetter(xbmp+x, 0, (char)n, pfnt->nEltWidths[3], pfnt->nCmdOfs); } else { @@ -1472,7 +1473,7 @@ if ((nsmp) && (nsmp <= pSndFile->m_nSamples)) { CHAR sztmp2[64] = ""; - memcpy(sztmp2, pSndFile->m_szNames[nsmp], 32); + memcpy(sztmp2, pSndFile->m_szNames[nsmp], MAX_SAMPLENAME); sztmp2[32] = 0; if (sztmp2[0]) { @@ -1485,7 +1486,7 @@ { if (m->instr <= pSndFile->m_nSamples) { - memcpy(sztmp, pSndFile->m_szNames[m->instr], 32); + memcpy(sztmp, pSndFile->m_szNames[m->instr], MAX_SAMPLENAME); sztmp[32] = 0; } } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -1421,7 +1421,8 @@ { CHAR s[256]; DWORD dwPos = ScreenToSample(pt.x); - if (dwPos <= pSmp->nLength) { + if (dwPos <= pSmp->nLength) + { //Set loop points wsprintf(s, "Set Loop Start to:\t%d", dwPos); ::AppendMenu(hMenu, MF_STRING|((dwPos+4<=pSmp->nLoopEnd)?0:MF_GRAYED), @@ -1475,7 +1476,7 @@ // if there's no selection, but loop points //::AppendMenu(hMenu, MF_STRING|(m_dwEndSel>m_dwBeginSel)?0:MF_GRAYED, // ID_SAMPLE_TRIM, "Trim\t" + ih->GetKeyTextFromCommand(kcSampleTrim)); - ::AppendMenu(hMenu, MF_STRING|(bIsGrayed)?MF_GRAYED:0, ID_SAMPLE_TRIM, sTrimMenuText.c_str()); + ::AppendMenu(hMenu, MF_STRING|(bIsGrayed) ? MF_GRAYED : 0, ID_SAMPLE_TRIM, sTrimMenuText.c_str()); ::AppendMenu(hMenu, MF_STRING, ID_EDIT_CUT, "Cut\t" + ih->GetKeyTextFromCommand(kcEditCut)); ::AppendMenu(hMenu, MF_STRING, ID_EDIT_COPY, "Copy\t" + ih->GetKeyTextFromCommand(kcEditCopy)); } @@ -1857,8 +1858,8 @@ pxh->xtra_len += 32; if (pSmp->filename[0]) { - memcpy(pszText+32, pSmp->filename, 22); - pxh->xtra_len += 22; + memcpy(pszText + 32, pSmp->filename, MAX_SAMPLEFILENAME); + pxh->xtra_len += MAX_SAMPLEFILENAME; } } phdr->filesize += sizeof(WAVESMPLHEADER) + pxh->xtra_len + 8; Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -1337,7 +1337,7 @@ if (pSndFile->Instruments[i]) memcpy(s+k, pSndFile->Instruments[i]->name, 32); } else - memcpy(s+k, pSndFile->m_szNames[i], 32); + memcpy(s+k, pSndFile->m_szNames[i], MAX_SAMPLENAME); s[k+32] = 0; combo->SetItemData(combo->AddString(s), i); } Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/mptrack/view_com.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -247,7 +247,7 @@ switch(iCol) { case SMPLIST_SAMPLENAME: - lstrcpyn(s, pSndFile->m_szNames[iSmp+1], 32); + lstrcpyn(s, pSndFile->m_szNames[iSmp+1], MAX_SAMPLENAME); break; case SMPLIST_SAMPLENO: wsprintf(s, "%02d", iSmp+1); Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -1592,7 +1592,7 @@ if (pSndFile->m_nType & MOD_TYPE_XM) psmp->uFlags |= CHN_PANNING; } } - if (pDlsIns->szName[0]) memcpy(pSndFile->m_szNames[nSample], pDlsIns->szName, 31); + if (pDlsIns->szName[0]) memcpy(pSndFile->m_szNames[nSample], pDlsIns->szName, MAX_SAMPLENAME - 1); bOk = TRUE; } FreeWaveForm(pWaveForm); Modified: trunk/OpenMPT/soundlib/IT_DEFS.H =================================================================== --- trunk/OpenMPT/soundlib/IT_DEFS.H 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/IT_DEFS.H 2010-04-17 13:14:48 UTC (rev 569) @@ -25,7 +25,7 @@ BYTE pwd; // pitch wheel depth WORD msglength; DWORD msgoffset; - DWORD reserved; + DWORD reserved; // ChibiTracker writes "CHBI" here. BYTE chnpan[64]; BYTE chnvol[64]; } ITFILEHEADER; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -1030,6 +1030,15 @@ { memcpy(m_lpszSongComments, lpStream+pifh->msgoffset, pifh->msglength); m_lpszSongComments[pifh->msglength] = 0; + // ChibiTracker uses \n instead of \r. + if(pifh->cwtv == 0x0214 && pifh->cmwt == 0x0214 && LittleEndian(pifh->reserved) == 0x49424843) + { + for(size_t i = 0; i < pifh->msglength; i++) + { + if(m_lpszSongComments[i] == '\n') + m_lpszSongComments[i] = '\r'; + } + } } } // Reading orders Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -393,7 +393,7 @@ Samples[iSmp].nLoopStart = Samples[iSmp].nLoopEnd = 0; Samples[iSmp].nPan = 0x80; //ASSERT(iLooplength == 0 || iLooplength > 4); - } else if(s[0] == S3I_TYPE_ADMEL) + } else if(s[0] >= S3I_TYPE_ADMEL) { bHasAdlibPatches = true; } Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -557,15 +557,15 @@ // Name present (clipboard only) UINT xtrabytes = pxh->xtra_len + 8 - sizeof(WAVEEXTRAHEADER); LPSTR pszTextEx = (LPSTR)(pxh+1); - if (xtrabytes >= 32) + if (xtrabytes >= MAX_SAMPLENAME) { - memcpy(m_szNames[nSample], pszTextEx, 31); - pszTextEx += 32; - xtrabytes -= 32; - if (xtrabytes >= 22) + memcpy(m_szNames[nSample], pszTextEx, MAX_SAMPLENAME - 1); + pszTextEx += MAX_SAMPLENAME; + xtrabytes -= MAX_SAMPLENAME; + if (xtrabytes >= MAX_SAMPLEFILENAME) { - memcpy(pSmp->filename, pszTextEx, 22); - xtrabytes -= 22; + memcpy(pSmp->filename, pszTextEx, MAX_SAMPLEFILENAME); + xtrabytes -= MAX_SAMPLEFILENAME; } } } Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2010-04-17 13:14:48 UTC (rev 569) @@ -75,6 +75,9 @@ #define MAX_ENVPOINTS 240 #define MIN_PERIOD 0x0020 #define MAX_PERIOD 0xFFFF +// String lengths +#define MAX_SAMPLENAME 32 // also affects module name! +#define MAX_SAMPLEFILENAME 22 #define MAX_PATTERNNAME 32 #define MAX_CHANNELNAME 20 #define MAX_INFONAME 80 @@ -136,7 +139,7 @@ #define CHN_KEYOFF 0x200 // exit sustain #define CHN_NOTEFADE 0x400 // fade note (instrument mode) #define CHN_SURROUND 0x800 // use surround channel -#define CHN_NOIDO 0x1000 // ??? +#define CHN_NOIDO 0x1000 // Indicates if the channel is near enough to an exact multiple of the base frequency that any interpolation won't be noticeable - or if interpolation was switched off completely. --Storlek #define CHN_HQSRC 0x2000 // ??? #define CHN_FILTER 0x4000 // filtered output #define CHN_VOLUMERAMP 0x8000 // ramp volume @@ -391,4 +394,11 @@ INST_NUMFILTERMODES };*/ +// Vibrato Types +#define VIB_SINE 0 +#define VIB_SQUARE 1 +#define VIB_RAMP_UP 2 +#define VIB_RAMP_DOWN 3 +#define VIB_RANDOM 4 + #endif Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-04-17 13:14:48 UTC (rev 569) @@ -41,7 +41,7 @@ BYTE nVibDepth; BYTE nVibRate; CHAR name[32]; - CHAR filename[22]; + CHAR filename[MAX_SAMPLEFILENAME]; // Return the size of one (elementary) sample in bytes. uint8 GetElementarySampleSize() const {return (uFlags & CHN_16BIT) ? 2 : 1;} @@ -596,7 +596,7 @@ MODSAMPLE Samples[MAX_SAMPLES]; // Sample Headers MODINSTRUMENT *Instruments[MAX_INSTRUMENTS]; // Instrument Headers MODINSTRUMENT m_defaultInstrument; // Currently only used to get default values for extented properties. - CHAR m_szNames[MAX_SAMPLES][32]; // Song and sample names + CHAR m_szNames[MAX_SAMPLES][MAX_SAMPLENAME]; // Song and sample names MODMIDICFG m_MidiCfg; // Midi macro config table SNDMIXPLUGIN m_MixPlugins[MAX_MIXPLUGINS]; // Mix plugins SNDMIXSONGEQ m_SongEQ; // Default song EQ preset Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -872,7 +872,8 @@ { int nchn32 = 0; MODCHANNEL *pChn = Chn; - for (UINT nChn=0; nChn<m_nChannels; nChn++,pChn++) { + for (UINT nChn=0; nChn<m_nChannels; nChn++,pChn++) + { //if(!(pChn->dwFlags & CHN_MUTE)) //removed by rewbs: fix http://www.modplug.com/forum/viewtopic.php?t=3358 nchn32++; } @@ -880,7 +881,8 @@ DWORD mastervol; - if (m_pConfig->getUseGlobalPreAmp()) { + if (m_pConfig->getUseGlobalPreAmp()) + { int realmastervol = m_nMasterVolume; if (realmastervol > 0x80) { //Attenuate global pre-amp depending on num channels @@ -909,7 +911,7 @@ // Update channels data m_nMixChannels = 0; MODCHANNEL *pChn = Chn; - for (UINT nChn=0; nChn<MAX_CHANNELS; nChn++,pChn++) + for (UINT nChn = 0; nChn < MAX_CHANNELS; nChn++, pChn++) { skipchn: @@ -937,8 +939,9 @@ pChn++; } } - if (nChn < MAX_CHANNELS) goto skipchn; - goto done; + if (nChn < MAX_CHANNELS) + goto skipchn; // >:( + break; } // Reset channel data pChn->nInc = 0; @@ -973,13 +976,12 @@ { if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) || GetModFlag(MSF_OLDVOLSWING)) { - vol = pChn->nVolume + pChn->nVolSwing; + vol += pChn->nVolSwing; } else { pChn->nVolume += pChn->nVolSwing; - if(pChn->nVolume > 256) pChn->nVolume = 256; - if(pChn->nVolume < 0) pChn->nVolume = 0; + pChn->nVolume = CLAMP(pChn->nVolume, 0, 256); vol = pChn->nVolume; pChn->nVolSwing = 0; } @@ -1034,7 +1036,8 @@ // IT compatibility 12. / 13.: Tremor if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - if ((pChn->nTremorCount & 128) && pChn->nLength) { + if ((pChn->nTremorCount & 128) && pChn->nLength) + { if (pChn->nTremorCount == 128) pChn->nTremorCount = (pChn->nTremorParam >> 4) | 192; else if (pChn->nTremorCount == 192) @@ -1934,7 +1937,7 @@ pChn->nLength = 0; } } -done: + // Checking Max Mix Channels reached: ordering by volume if ((m_nMixChannels >= m_nMaxMixChannels) && (!(gdwSoundSetup & SNDMIX_DIRECTTODISK))) { Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2010-04-17 13:14:48 UTC (rev 569) @@ -17,84 +17,84 @@ // header for compressed j2b files struct J2BHEADER { - DWORD signature; // MUSE - DWORD deadbeaf; // 0xDEADBEAF (AM) or 0xDEADBABE (AMFF) - DWORD j2blength; // complete filesize - DWORD crc32; // checksum of the compressed data block - DWORD packed_length; // length of the compressed data block - DWORD unpacked_length; // length of the decompressed module + uint32 signature; // MUSE + uint32 deadbeaf; // 0xDEADBEAF (AM) or 0xDEADBABE (AMFF) + uint32 j2blength; // complete filesize + uint32 crc32; // checksum of the compressed data block + uint32 packed_length; // length of the compressed data block + uint32 unpacked_length; // length of the decompressed module }; // am(ff) stuff -struct RIFFCHUNK +struct AMFF_RIFFCHUNK { - DWORD signature; // "RIFF" - DWORD chunksize; // chunk size without header + uint32 signature; // "RIFF" + uint32 chunksize; // chunk size without header }; // this header is used for both AM's "INIT" as well as AMFF's "MAIN" chunk struct AMFFCHUNK_MAIN { - char songname[64]; - BYTE flags; - BYTE channels; - BYTE speed; - BYTE tempo; - DWORD unknown; - BYTE globalvolume; + char songname[64]; + uint8 flags; + uint8 channels; + uint8 speed; + uint8 tempo; + uint32 unknown; + uint8 globalvolume; }; struct AMFFCHUNK_INSTRUMENT { - BYTE unknown; // 0x00 - BYTE sample; // sample number + uint8 unknown; // 0x00 + uint8 sample; // sample number char name[28]; char stuff[195]; // lots of NULs? }; struct AMFFCHUNK_SAMPLE { - DWORD signature; // "SAMP" - DWORD chunksize; // header + sample size - char name[28]; - BYTE pan; - BYTE volume; - WORD flags; - DWORD length; - DWORD loopstart; - DWORD loopend; - DWORD samplerate; - DWORD reserved1; - DWORD reserved2; + uint32 signature; // "SAMP" + uint32 chunksize; // header + sample size + char name[28]; + uint8 pan; + uint8 volume; + uint16 flags; + uint32 length; + uint32 loopstart; + uint32 loopend; + uint32 samplerate; + uint32 reserved1; + uint32 reserved2; }; struct AMCHUNK_INSTRUMENT { - BYTE unknown; // 0x00 - BYTE sample; // sample number + uint8 unknown; // 0x00 + uint8 sample; // sample number char name[32]; }; struct AMCHUNK_SAMPLE { - DWORD signature; // "SAMP" - DWORD chunksize; // header + sample size - DWORD headsize; // header size - char name[32]; - WORD pan; - WORD volume; - WORD flags; - WORD unkown; - DWORD length; - DWORD loopstart; - DWORD loopend; - DWORD samplerate; + uint32 signature; // "SAMP" + uint32 chunksize; // header + sample size + uint32 headsize; // header size + char name[32]; + uint16 pan; + uint16 volume; + uint16 flags; + uint16 unkown; + uint32 length; + uint32 loopstart; + uint32 loopend; + uint32 samplerate; }; #pragma pack() -static BYTE riffam_efftrans[26] = +static uint8 riffam_efftrans[26] = { CMD_ARPEGGIO, CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_TONEPORTAMENTO, CMD_VIBRATO, CMD_TONEPORTAVOL, CMD_VIBRATOVOL, CMD_TREMOLO, @@ -126,7 +126,7 @@ MODCOMMAND *mrow = Patterns[nPat]; MODCOMMAND *m = mrow; ROWINDEX nRow = 0; - BYTE flags; + uint8 flags; while((nRow < nRows) && (dwMemPos < dwMemLength)) { @@ -245,29 +245,29 @@ DWORD dwMemPos = 0; - ASSERT_CAN_READ(sizeof(RIFFCHUNK)); - RIFFCHUNK *chunkheader = (RIFFCHUNK *)lpStream; + ASSERT_CAN_READ(sizeof(AMFF_RIFFCHUNK)); + AMFF_RIFFCHUNK *chunkheader = (AMFF_RIFFCHUNK *)lpStream; if(LittleEndian(chunkheader->signature) != 0x46464952 // "RIFF" - || LittleEndian(chunkheader->chunksize) != dwMemLength - sizeof(RIFFCHUNK) + || LittleEndian(chunkheader->chunksize) != dwMemLength - sizeof(AMFF_RIFFCHUNK) ) return false; - dwMemPos += sizeof(RIFFCHUNK); + dwMemPos += sizeof(AMFF_RIFFCHUNK); bool bIsAM; // false: AMFF, true: AM ASSERT_CAN_READ(4); - if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x46464D41) bIsAM = false; // "AMFF" - else if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x20204D41) bIsAM = true; // "AM " + if(LittleEndian(*(uint32 *)(lpStream + dwMemPos)) == 0x46464D41) bIsAM = false; // "AMFF" + else if(LittleEndian(*(uint32 *)(lpStream + dwMemPos)) == 0x20204D41) bIsAM = true; // "AM " else return false; dwMemPos += 4; // go through all chunks now while(dwMemPos < dwMemLength) { - ASSERT_CAN_READ(sizeof(RIFFCHUNK)); - chunkheader = (RIFFCHUNK *)(lpStream + dwMemPos); - dwMemPos += sizeof(RIFFCHUNK); + ASSERT_CAN_READ(sizeof(AMFF_RIFFCHUNK)); + chunkheader = (AMFF_RIFFCHUNK *)(lpStream + dwMemPos); + dwMemPos += sizeof(AMFF_RIFFCHUNK); ASSERT_CAN_READ(LittleEndian(chunkheader->chunksize)); DWORD dwChunkEnd = dwMemPos + LittleEndian(chunkheader->chunksize); @@ -380,17 +380,17 @@ if(bIsAM) { ASSERT_CAN_READ_CHUNK(4); - if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) != 0x20204941) break; // "AI " + if(LittleEndian(*(uint32 *)(lpStream + dwMemPos)) != 0x20204941) break; // "AI " dwMemPos += 4; - ASSERT_CAN_READ_CHUNK(sizeof(RIFFCHUNK)); - RIFFCHUNK *instchunk = (RIFFCHUNK *)(lpStream + dwMemPos); - dwMemPos += sizeof(RIFFCHUNK); + ASSERT_CAN_READ_CHUNK(sizeof(AMFF_RIFFCHUNK)); + AMFF_RIFFCHUNK *instchunk = (AMFF_RIFFCHUNK *)(lpStream + dwMemPos); + dwMemPos += sizeof(AMFF_RIFFCHUNK); ASSERT_CAN_READ_CHUNK(LittleEndian(instchunk->chunksize)); if(LittleEndian(instchunk->signature) != 0x54534E49) break; // "INST" ASSERT_CAN_READ_CHUNK(4); - DWORD dwHeadlen = LittleEndian(*(DWORD *)(lpStream + dwMemPos)); + DWORD dwHeadlen = LittleEndian(*(uint32 *)(lpStream + dwMemPos)); dwMemPos +=4 ; ASSERT_CAN_READ_CHUNK(sizeof(AMCHUNK_INSTRUMENT)); @@ -405,14 +405,14 @@ memcpy(m_szNames[nSmp], instheadchunk->name, 32); SpaceToNullStringFixed(m_szNames[nSmp], 31); - ASSERT_CAN_READ_CHUNK(sizeof(RIFFCHUNK)); - instchunk = (RIFFCHUNK *)(lpStream + dwMemPos); - dwMemPos += sizeof(RIFFCHUNK); + ASSERT_CAN_READ_CHUNK(sizeof(AMFF_RIFFCHUNK)); + instchunk = (AMFF_RIFFCHUNK *)(lpStream + dwMemPos); + dwMemPos += sizeof(AMFF_RIFFCHUNK); ASSERT_CAN_READ_CHUNK(LittleEndian(instchunk->chunksize)); if(LittleEndian(instchunk->signature) != 0x46464952) break; // yet another "RIFF"... ASSERT_CAN_READ_CHUNK(4); - if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) != 0x20205341) break; // "AS " (ain't this boring?) + if(LittleEndian(*(uint32 *)(lpStream + dwMemPos)) != 0x20205341) break; // "AS " (ain't this boring?) dwMemPos += 4; ASSERT_CAN_READ_CHUNK(sizeof(AMCHUNK_SAMPLE)); Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2010-04-14 21:31:59 UTC (rev 568) +++ trunk/OpenMPT/soundlib/modcommand.h 2010-04-17 13:14:48 UTC (rev 569) @@ -59,17 +59,13 @@ // 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(MODCOMMAND::NOTE note_id) {return note_id == NOTE_PC || note_id == NOTE_PCS;} + static bool IsPcNote(NOTE note_id) {return note_id == NOTE_PC || note_id == NOTE_PCS;} // 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() { - VOLCMD vcold = volcmd; - VOL vold = vol; - volcmd = command; - vol = param; - command = vcold; - param = vold; + std::swap(volcmd, command); + std::swap(vol, param); } public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2010-04-18 14:46:51
|
Revision: 570 http://modplug.svn.sourceforge.net/modplug/?rev=570&view=rev Author: relabsoluness Date: 2010-04-18 14:46:44 +0000 (Sun, 18 Apr 2010) Log Message: ----------- [Fix] Mod conversion: Merging multiple sequences didn't properly convert '---'/'+++' orders. [Fix] Mod cleanup: Merging sequences could truncate the result sequence to length 256 even for MPTM files (bug introduced in r568). [Ref] Some refactoring and minor fixing(e.g. moved some mod conversion code that modifies sequences to ModSequence classes). Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/ModSequence.h trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -1044,9 +1044,9 @@ return true; } -// Remove all plugins + bool CModCleanupDlg::MergeSequences() //----------------------------------- { - return m_pModDoc->MergeSequences(); + return m_pModDoc->GetSoundFile()->Order.MergeSequences(); } Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -1374,7 +1374,7 @@ CSoundFile& rSf = *m_pModDoc->GetSoundFile(); if (nSeq == MAX_SEQUENCES + 2) { - CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), rSf.Order.m_sName); + CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), (LPCTSTR)rSf.Order.m_sName); CString str; AfxFormatString1(str, IDS_CONFIRM_SEQUENCE_DELETE, strParam); if (AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION) == IDYES) Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-04-18 14:46:44 UTC (rev 570) @@ -289,9 +289,6 @@ BOOL RemoveChannels(BOOL bChnMask[MAX_CHANNELS]); - bool MergeSequences(); - bool ConvertSubsongsToMultipleSequences(); - bool HasMPTHacks(bool autofix = false); bool m_bHasValidPath; //becomes true if document is loaded or saved. Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -324,38 +324,6 @@ } } - // Order list too long? -> remove unnecessary order items first. - if(m_SndFile.Order.GetLengthTailTrimmed() > specs.ordersMax) - { - for(ORDERINDEX nOrd = m_SndFile.Order.GetLengthTailTrimmed() - 1; nOrd > 0; nOrd--) - { - if(m_SndFile.Patterns.IsValidPat(m_SndFile.Order[nOrd]) == false) - { - for(ORDERINDEX nMoveOrd = nOrd; nMoveOrd < m_SndFile.Order.GetLengthTailTrimmed() - 1; nMoveOrd++) - { - m_SndFile.Order[nMoveOrd] = m_SndFile.Order[nMoveOrd + 1]; - } - m_SndFile.Order[m_SndFile.Order.GetLengthTailTrimmed() - 1] = m_SndFile.Order.GetInvalidPatIndex(); - } - } - if(m_SndFile.Order.GetLengthTailTrimmed() > specs.ordersMax) - { - AddToLog("WARNING: Order list has been trimmed!\n"); - } - } - - // If not supported, remove "+++" separator order items. - if(CSoundFile::GetModSpecifications(nNewType).hasIgnoreIndex == false) - { - for(ORDERINDEX nOrd = m_SndFile.Order.GetLengthTailTrimmed() - 1; nOrd > 0; nOrd--) - { - if(m_SndFile.Order[nOrd] == m_SndFile.Order.GetIgnoreIndex()) - { - m_SndFile.Order.Remove(nOrd, nOrd); - } - } - } - // Is the "restart position" value allowed in this format? if(m_SndFile.m_nRestartPos > 0 && !CSoundFile::GetModSpecifications(nNewType).hasRestartPos) { @@ -391,29 +359,6 @@ END_CRITICAL(); ChangeFileExtension(nNewType); - // Multisequences not suppported by other formats - if(m_SndFile.GetType() != MOD_TYPE_MPT) MergeSequences(); - // Convert sequence with separator patterns into multiple sequences? - if(m_SndFile.GetType() == MOD_TYPE_MPT && m_SndFile.Order.GetNumSequences() == 1) - { - bool hasSepPatterns = false; - for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++) - { - if(!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) - { - hasSepPatterns = true; - break; - } - } - if(hasSepPatterns && - ::MessageBox(NULL, - "The order list contains separator items.\nThe new format supports multiple sequences, do you want to convert those separate tracks into multiple song sequences?", - "Order list conversion", MB_YESNO | MB_ICONQUESTION) == IDYES) - { - ConvertSubsongsToMultipleSequences(); - } - } - //rewbs.cutomKeys: update effect key commands CInputHandler *ih = CMainFrame::GetMainFrame()->GetInputHandler(); if (newTypeIsMOD_XM) { @@ -1680,149 +1625,4 @@ } } -// Merge multiple sequences into one sequence -bool CModDoc::MergeSequences() -//---------------------------- -{ - if(m_SndFile.Order.GetNumSequences() <= 1) return false; - CHAR s[256]; - m_SndFile.Order.SetSequence(0); - m_SndFile.Order.resize(m_SndFile.Order.GetLengthTailTrimmed()); - SEQUENCEINDEX removedSequences = 0; // sequence count - vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already? - patternsFixed.resize(m_SndFile.Patterns.Size(), SEQUENCEINDEX_INVALID); - // Set up vector - for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++) - { - PATTERNINDEX nPat = m_SndFile.Order[nOrd]; - if(!m_SndFile.Patterns.IsValidPat(nPat)) continue; - patternsFixed[nPat] = 0; - } - - while(m_SndFile.Order.GetNumSequences() > 1) - { - removedSequences++; - const ORDERINDEX nFirstOrder = m_SndFile.Order.GetLengthTailTrimmed() + 1; // +1 for separator item - if(nFirstOrder + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications().ordersMax) - { - wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences); - AddToLog(s); - m_SndFile.Order.RemoveSequence(1); - continue; - } - m_SndFile.Order.Append(m_SndFile.Order.GetInvalidPatIndex()); // Separator item - for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed(); nOrd++) - { - PATTERNINDEX nPat = m_SndFile.Order.GetSequence(1)[nOrd]; - m_SndFile.Order.Append(nPat); - - // Try to fix patterns (Bxx commands) - if(!m_SndFile.Patterns.IsValidPat(nPat)) continue; - - MODCOMMAND *m = m_SndFile.Patterns[nPat]; - for (UINT len = 0; len < m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels; m++, len++) - { - if(m->command == CMD_POSITIONJUMP) - { - if(patternsFixed[nPat] != SEQUENCEINDEX_INVALID && patternsFixed[nPat] != removedSequences) - { - // Oops, some other sequence uses this pattern already. - const PATTERNINDEX nNewPat = m_SndFile.Patterns.Insert(m_SndFile.PatternSize[nPat]); - if(nNewPat != SEQUENCEINDEX_INVALID) - { - // could create new pattern - copy data over and continue from here. - m_SndFile.Order[nFirstOrder + nOrd] = nNewPat; - MODCOMMAND *pSrc = m_SndFile.Patterns[nPat]; - MODCOMMAND *pDest = m_SndFile.Patterns[nNewPat]; - memcpy(pDest, pSrc, m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels * sizeof(MODCOMMAND)); - m = pDest + len; - patternsFixed.resize(max(nNewPat + 1, (PATTERNINDEX)patternsFixed.size()), SEQUENCEINDEX_INVALID); - nPat = nNewPat; - } else - { - // cannot create new pattern: notify the user - wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat); - AddToLog(s); - } - } - m->param += nFirstOrder; - patternsFixed[nPat] = removedSequences; - } - } - - } - m_SndFile.Order.RemoveSequence(1); - } - // Remove order name + fill up with empty patterns. - m_SndFile.Order.m_sName = ""; - m_SndFile.Order.resize(min(MAX_ORDERS, m_SndFile.GetModSpecifications().ordersMax)); - return true; -} - - -// Split subsongs (separated by "---" or "+++" patterns) into sequences -bool CModDoc::ConvertSubsongsToMultipleSequences() -//------------------------------------------------ -{ - if(m_SndFile.GetType() != MOD_TYPE_MPT || m_SndFile.Order.GetNumSequences() != 1) return false; - bool modified = false; - - m_SndFile.Order.SetSequence(0); - for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++) - { - // end of subsong? - if(!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) - { - ORDERINDEX oldLength = m_SndFile.Order.GetLengthTailTrimmed(); - // remove all separator patterns between current and next subsong first - while(nOrd < oldLength && (!m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd]))) - { - m_SndFile.Order[nOrd] = m_SndFile.Order.GetInvalidPatIndex(); - nOrd++; - modified = true; - } - if(nOrd >= oldLength) break; - ORDERINDEX startOrd = nOrd; - modified = true; - - SEQUENCEINDEX newSeq = m_SndFile.Order.AddSequence(false); - m_SndFile.Order.SetSequence(newSeq); - - // resize new seqeuence if necessary - if(m_SndFile.Order.GetLength() < oldLength - startOrd) - { - m_SndFile.Order.resize(oldLength - startOrd); - } - - // now, move all following orders to the new sequence - while(nOrd < oldLength) - { - PATTERNINDEX copyPat = m_SndFile.Order.GetSequence(newSeq - 1)[nOrd]; - m_SndFile.Order[nOrd - startOrd] = copyPat; - nOrd++; - - // is this a valid pattern? adjust pattern jump commands, if necessary. - if(m_SndFile.Patterns.IsValidPat(copyPat)) - { - MODCOMMAND *m = m_SndFile.Patterns[copyPat]; - for (UINT len = m_SndFile.PatternSize[copyPat] * m_SndFile.m_nChannels; len; m++, len--) - { - if(m->command == CMD_POSITIONJUMP && m->param >= startOrd) - { - m->param -= startOrd; - } - } - } - } - m_SndFile.Order.SetSequence(newSeq - 1); - m_SndFile.Order.Remove(startOrd, oldLength - 1); - m_SndFile.Order.SetSequence(newSeq); - // start from beginning... - nOrd = 0; - if(m_SndFile.Order.GetLengthTailTrimmed() == 0 || !m_SndFile.Patterns.IsValidIndex(m_SndFile.Order[nOrd])) break; - } - } - m_SndFile.Order.SetSequence(0); - return modified; -} Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -761,7 +761,7 @@ { // more than one sequence -> add folder CString sSeqName; - sSeqName.Format("%d: %s", nSeq, pSndFile->Order.GetSequence(nSeq).m_sName); + sSeqName.Format("%d: %s", nSeq, (LPCTSTR)pSndFile->Order.GetSequence(nSeq).m_sName); if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq); UINT state = (nSeq == pSndFile->Order.GetCurrentSequenceIndex()) ? TVIS_BOLD : 0; Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -1,15 +1,17 @@ #include "stdafx.h" #include "sndfile.h" #include "ModSequence.h" +#include "../mptrack/moddoc.h" #include "../mptrack/version.h" #include "../mptrack/serialization_utils.h" +#include <functional> #define str_SequenceTruncationNote (GetStrI18N((_TEXT("Module has sequence of length %u; it will be truncated to maximum supported length, %u.")))) #define new DEBUG_NEW -ModSequence::ModSequence(const CSoundFile& rSf, +ModSequence::ModSequence(CSoundFile& rSf, PATTERNINDEX* pArray, ORDERINDEX nSize, ORDERINDEX nCapacity, @@ -25,7 +27,7 @@ {} -ModSequence::ModSequence(const CSoundFile& rSf, ORDERINDEX nSize) : +ModSequence::ModSequence(CSoundFile& rSf, ORDERINDEX nSize) : m_pSndFile(&rSf), m_bDeletableArray(true), m_nInvalidIndex(GetInvalidPatIndex(MOD_TYPE_MPT)), @@ -62,26 +64,58 @@ return false; } +namespace +{ + // Functor for detecting non-valid patterns from sequence. + struct IsNotValidPat + { + IsNotValidPat(CSoundFile& sndFile) : rSndFile(sndFile) {} + bool operator()(PATTERNINDEX i) {return !rSndFile.Patterns.IsValidPat(i);} + CSoundFile& rSndFile; + }; +} -void ModSequence::OnModTypeChanged(const MODTYPE oldtype) -//------------------------------------------------------- + +void ModSequence::AdjustToNewModType(const MODTYPE oldtype) +//--------------------------------------------------------- { const CModSpecifications specs = m_pSndFile->GetModSpecifications(); + const MODTYPE newtype = m_pSndFile->GetType(); - m_nInvalidIndex = GetInvalidPatIndex(m_pSndFile->GetType()); - m_nIgnoreIndex = GetIgnoreIndex(m_pSndFile->GetType()); + m_nInvalidIndex = GetInvalidPatIndex(newtype); + m_nIgnoreIndex = GetIgnoreIndex(newtype); + // If not supported, remove "+++" separator order items. + if (specs.hasIgnoreIndex == false) + { + if (oldtype != MOD_TYPE_NONE) + { + iterator i = std::remove_if(begin(), end(), std::bind2nd(std::equal_to<PATTERNINDEX>(), GetIgnoreIndex(oldtype))); + std::fill(i, end(), GetInvalidPatIndex()); + } + } + else + Replace(GetIgnoreIndex(oldtype), GetIgnoreIndex()); + //Resize orderlist if needed. - if (specs.ordersMax < GetLength()) + if (specs.ordersMax < GetLength()) { + // Order list too long? -> remove unnecessary order items first. + if (oldtype != MOD_TYPE_NONE && specs.ordersMax < GetLengthTailTrimmed()) + { + iterator iter = std::remove_if(begin(), end(), IsNotValidPat(*m_pSndFile)); + std::fill(iter, end(), GetInvalidPatIndex()); + if(GetLengthTailTrimmed() > specs.ordersMax) + { + if (m_pSndFile->GetpModDoc()) + m_pSndFile->GetpModDoc()->AddToLog("WARNING: Order list has been trimmed!\n"); + } + } resize(specs.ordersMax); - /*resize(max(MAX_ORDERS, specs.ordersMax)); - std::fill(begin() + specs.ordersMax, end(), GetInvalidPatIndex());*/ } - - //Replace items used to denote end of song/skip order. - Replace(GetInvalidPatIndex(oldtype), GetInvalidPatIndex()); - Replace(GetIgnoreIndex(oldtype), GetIgnoreIndex()); + + // Replace items used to denote end of song order. + Replace(GetInvalidPatIndex(oldtype), GetInvalidPatIndex()); } @@ -235,7 +269,7 @@ ///////////////////////////////////// -ModSequenceSet::ModSequenceSet(const CSoundFile& sndFile) +ModSequenceSet::ModSequenceSet(CSoundFile& sndFile) : ModSequence(sndFile, m_Cache, s_nCacheSize, s_nCacheSize, NoArrayDelete), m_nCurrentSeq(0) //------------------------------------------------------------------- @@ -244,8 +278,8 @@ } -const ModSequence& ModSequenceSet::GetSequence(SEQUENCEINDEX nSeq) -//---------------------------------------------------------------- +const ModSequence& ModSequenceSet::GetSequence(SEQUENCEINDEX nSeq) const +//---------------------------------------------------------------------- { if (nSeq == GetCurrentSequenceIndex()) return *this; @@ -254,6 +288,16 @@ } +ModSequence& ModSequenceSet::GetSequence(SEQUENCEINDEX nSeq) +//---------------------------------------------------------- +{ + if (nSeq == GetCurrentSequenceIndex()) + return *this; + else + return m_Sequences[nSeq]; +} + + void ModSequenceSet::CopyCacheToStorage() //--------------------------------------- { @@ -322,6 +366,195 @@ } +void ModSequenceSet::OnModTypeChanged(const MODTYPE oldtype) +//---------------------------------------------------------- +{ + const MODTYPE newtype = m_pSndFile->GetType(); + const SEQUENCEINDEX nSeqs = GetNumSequences(); + for(SEQUENCEINDEX n = 0; n < nSeqs; n++) + { + GetSequence(n).AdjustToNewModType(oldtype); + } + // Multisequences not suppported by other formats + if (oldtype != MOD_TYPE_NONE && newtype != MOD_TYPE_MPT) + MergeSequences(); + + // Convert sequence with separator patterns into multiple sequences? + if (oldtype != MOD_TYPE_NONE && newtype == MOD_TYPE_MPT && GetNumSequences() == 1) + ConvertSubsongsToMultipleSequences(); +} + + +bool ModSequenceSet::ConvertSubsongsToMultipleSequences() +//------------------------------------------------------- +{ + // Allow conversion only if there's only one sequence. + if (GetNumSequences() != 1 || m_pSndFile->GetType() != MOD_TYPE_MPT) + return false; + + bool hasSepPatterns = false; + const ORDERINDEX nLengthTt = GetLengthTailTrimmed(); + for(ORDERINDEX nOrd = 0; nOrd < nLengthTt; nOrd++) + { + if(!m_pSndFile->Patterns.IsValidIndex(At(nOrd))) + { + hasSepPatterns = true; + break; + } + } + bool modified = false; + + if(hasSepPatterns && + ::MessageBox(NULL, + "The order list contains separator items.\nThe new format supports multiple sequences, do you want to convert those separate tracks into multiple song sequences?", + "Order list conversion", MB_YESNO | MB_ICONQUESTION) == IDYES) + { + + SetSequence(0); + for(ORDERINDEX nOrd = 0; nOrd < GetLengthTailTrimmed(); nOrd++) + { + // end of subsong? + if(!m_pSndFile->Patterns.IsValidIndex(At(nOrd))) + { + ORDERINDEX oldLength = GetLengthTailTrimmed(); + // remove all separator patterns between current and next subsong first + while(nOrd < oldLength && (!m_pSndFile->Patterns.IsValidIndex(At(nOrd)))) + { + At(nOrd) = GetInvalidPatIndex(); + nOrd++; + modified = true; + } + if(nOrd >= oldLength) break; + ORDERINDEX startOrd = nOrd; + modified = true; + + SEQUENCEINDEX newSeq = AddSequence(false); + SetSequence(newSeq); + + // resize new seqeuence if necessary + if(GetLength() < oldLength - startOrd) + { + resize(oldLength - startOrd); + } + + // now, move all following orders to the new sequence + while(nOrd < oldLength) + { + PATTERNINDEX copyPat = GetSequence(newSeq - 1)[nOrd]; + At(nOrd - startOrd) = copyPat; + nOrd++; + + // is this a valid pattern? adjust pattern jump commands, if necessary. + if(m_pSndFile->Patterns.IsValidPat(copyPat)) + { + MODCOMMAND *m = m_pSndFile->Patterns[copyPat]; + for (UINT len = m_pSndFile->PatternSize[copyPat] * m_pSndFile->m_nChannels; len; m++, len--) + { + if(m->command == CMD_POSITIONJUMP && m->param >= startOrd) + { + m->param = static_cast<BYTE>(m->param - startOrd); + } + } + } + } + SetSequence(newSeq - 1); + Remove(startOrd, oldLength - 1); + SetSequence(newSeq); + // start from beginning... + nOrd = 0; + if(GetLengthTailTrimmed() == 0 || !m_pSndFile->Patterns.IsValidIndex(At(nOrd))) break; + } + } + SetSequence(0); + } + return modified; +} + +bool ModSequenceSet::MergeSequences() +//----------------------------------- +{ + if(GetNumSequences() <= 1) + return false; + + CHAR s[256]; + SetSequence(0); + resize(GetLengthTailTrimmed()); + SEQUENCEINDEX removedSequences = 0; // sequence count + vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already? + patternsFixed.resize(m_pSndFile->Patterns.Size(), SEQUENCEINDEX_INVALID); + // Set up vector + for(ORDERINDEX nOrd = 0; nOrd < GetLengthTailTrimmed(); nOrd++) + { + PATTERNINDEX nPat = At(nOrd); + if(!m_pSndFile->Patterns.IsValidPat(nPat)) continue; + patternsFixed[nPat] = 0; + } + + while(GetNumSequences() > 1) + { + removedSequences++; + const ORDERINDEX nFirstOrder = GetLengthTailTrimmed() + 1; // +1 for separator item + if(nFirstOrder + GetSequence(1).GetLengthTailTrimmed() > m_pSndFile->GetModSpecifications().ordersMax) + { + wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences); + if (m_pSndFile->GetpModDoc()) + m_pSndFile->GetpModDoc()->AddToLog(s); + RemoveSequence(1); + continue; + } + Append(GetInvalidPatIndex()); // Separator item + for(ORDERINDEX nOrd = 0; nOrd < GetSequence(1).GetLengthTailTrimmed(); nOrd++) + { + PATTERNINDEX nPat = GetSequence(1)[nOrd]; + Append(nPat); + + // Try to fix patterns (Bxx commands) + if(!m_pSndFile->Patterns.IsValidPat(nPat)) continue; + + MODCOMMAND *m = m_pSndFile->Patterns[nPat]; + for (UINT len = 0; len < m_pSndFile->PatternSize[nPat] * m_pSndFile->m_nChannels; m++, len++) + { + if(m->command == CMD_POSITIONJUMP) + { + if(patternsFixed[nPat] != SEQUENCEINDEX_INVALID && patternsFixed[nPat] != removedSequences) + { + // Oops, some other sequence uses this pattern already. + const PATTERNINDEX nNewPat = m_pSndFile->Patterns.Insert(m_pSndFile->PatternSize[nPat]); + if(nNewPat != SEQUENCEINDEX_INVALID) + { + // could create new pattern - copy data over and continue from here. + At(nFirstOrder + nOrd) = nNewPat; + MODCOMMAND *pSrc = m_pSndFile->Patterns[nPat]; + MODCOMMAND *pDest = m_pSndFile->Patterns[nNewPat]; + memcpy(pDest, pSrc, m_pSndFile->PatternSize[nPat] * m_pSndFile->m_nChannels * sizeof(MODCOMMAND)); + m = pDest + len; + patternsFixed.resize(max(nNewPat + 1, (PATTERNINDEX)patternsFixed.size()), SEQUENCEINDEX_INVALID); + nPat = nNewPat; + } else + { + // cannot create new pattern: notify the user + wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat); + if (m_pSndFile->GetpModDoc()) + m_pSndFile->GetpModDoc()->AddToLog(s); + } + } + m->param = static_cast<BYTE>(m->param + nFirstOrder); + patternsFixed[nPat] = removedSequences; + } + } + + } + RemoveSequence(1); + } + // Remove order name + fill up with empty patterns. + m_sName = ""; + const ORDERINDEX nMinLength = (std::min)(ModSequenceSet::s_nCacheSize, m_pSndFile->GetModSpecifications().ordersMax); + if (GetLength() < nMinLength) + resize(nMinLength); + return true; +} + + ///////////////////////////////////// // Read/Write ///////////////////////////////////// Modified: trunk/OpenMPT/soundlib/ModSequence.h =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.h 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/soundlib/ModSequence.h 2010-04-18 14:46:44 UTC (rev 570) @@ -19,14 +19,16 @@ virtual ~ModSequence() {if (m_bDeletableArray) delete[] m_pArray;} ModSequence(const ModSequence&); - ModSequence(const CSoundFile& rSf, ORDERINDEX nSize); - ModSequence(const CSoundFile& rSf, PATTERNINDEX* pArray, ORDERINDEX nSize, ORDERINDEX nCapacity, bool bDeletableArray); + ModSequence(CSoundFile& rSf, ORDERINDEX nSize); + ModSequence(CSoundFile& rSf, PATTERNINDEX* pArray, ORDERINDEX nSize, ORDERINDEX nCapacity, bool bDeletableArray); // Initialize default sized sequence. void Init(); PATTERNINDEX& operator[](const size_t i) {ASSERT(i < m_nSize); return m_pArray[i];} const PATTERNINDEX& operator[](const size_t i) const {ASSERT(i < m_nSize); return m_pArray[i];} + PATTERNINDEX& At(const size_t i) {return (*this)[i];} + const PATTERNINDEX& At(const size_t i) const {return (*this)[i];} PATTERNINDEX& Last() {ASSERT(m_nSize > 0); return m_pArray[m_nSize-1];} const PATTERNINDEX& Last() const {ASSERT(m_nSize > 0); return m_pArray[m_nSize-1];} @@ -52,9 +54,9 @@ void resize(ORDERINDEX nNewSize, PATTERNINDEX nFill); // Replaces all occurences of nOld with nNew. - void Replace(PATTERNINDEX nOld, PATTERNINDEX nNew) {std::replace(begin(), end(), nOld, nNew);} + void Replace(PATTERNINDEX nOld, PATTERNINDEX nNew) {if (nOld != nNew) std::replace(begin(), end(), nOld, nNew);} - void OnModTypeChanged(const MODTYPE oldtype); + void AdjustToNewModType(const MODTYPE oldtype); ORDERINDEX size() const {return GetLength();} ORDERINDEX GetLength() const {return m_nSize;} @@ -106,7 +108,7 @@ PATTERNINDEX m_nInvalidIndex; // Invalid pat index. PATTERNINDEX m_nIgnoreIndex; // Ignore pat index. bool m_bDeletableArray; // True if m_pArray points the deletable(with delete[]) array. - const CSoundFile* m_pSndFile; // Pointer to associated CSoundFile. + CSoundFile* m_pSndFile; // Pointer to associated CSoundFile. static const bool NoArrayDelete = false; }; @@ -127,10 +129,11 @@ friend void ReadModSequence(std::istream& iStrm, ModSequence& seq, const size_t); public: - ModSequenceSet(const CSoundFile& sndFile); + ModSequenceSet(CSoundFile& sndFile); const ModSequence& GetSequence() {return GetSequence(GetCurrentSequenceIndex());} - const ModSequence& GetSequence(SEQUENCEINDEX nSeq); + const ModSequence& GetSequence(SEQUENCEINDEX nSeq) const; + ModSequence& GetSequence(SEQUENCEINDEX nSeq); SEQUENCEINDEX GetNumSequences() const {return static_cast<SEQUENCEINDEX>(m_Sequences.size());} void SetSequence(SEQUENCEINDEX); // Sets working sequence. SEQUENCEINDEX AddSequence(bool bDuplicate = true); // Adds new sequence. If bDuplicate is true, new sequence is a duplicate of the old one. Returns the ID of the new sequence. @@ -138,8 +141,20 @@ void RemoveSequence(SEQUENCEINDEX); // Removes given sequence SEQUENCEINDEX GetCurrentSequenceIndex() const {return m_nCurrentSeq;} + void OnModTypeChanged(const MODTYPE oldtype); + ModSequenceSet& operator=(const ModSequence& seq) {ModSequence::operator=(seq); return *this;} + // Merges multiple sequences into one and destroys all other sequences. + // Returns false if there were no sequences to merge, true otherwise. + bool MergeSequences(); + + // If there are subsongs (separated by "---" or "+++" patterns) in the module, + // asks user whether to convert these into multiple sequences (given that the + // modformat supports multiple sequences). + // Returns true if sequences were modified, false otherwise. + bool ConvertSubsongsToMultipleSequences(); + static const ORDERINDEX s_nCacheSize = MAX_ORDERS; private: Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-17 13:14:48 UTC (rev 569) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-18 14:46:44 UTC (rev 570) @@ -3027,9 +3027,11 @@ } void CSoundFile::ChangeModTypeTo(const MODTYPE& newType) -//--------------------------------------------------- +//------------------------------------------------------ { const MODTYPE oldtype = m_nType; + if (oldtype == newType) + return; m_nType = newType; SetModSpecsPointer(m_pModSpecs, m_nType); SetupMODPanning(); // Setup LRRL panning scheme if needed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-04-19 19:20:24
|
Revision: 572 http://modplug.svn.sourceforge.net/modplug/?rev=572&view=rev Author: saga-games Date: 2010-04-19 19:20:17 +0000 (Mon, 19 Apr 2010) Log Message: ----------- [Mod] Added OpenMPT 1.18 release notes document for package template Modified Paths: -------------- trunk/OpenMPT/installer/install.iss Added Paths: ----------- trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/ trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/orderlist.png trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/treeview.png trunk/OpenMPT/packageTemplate/ReleaseNotesImages/general/ trunk/OpenMPT/packageTemplate/ReleaseNotesImages/general/modplug.png Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2010-04-18 20:21:47 UTC (rev 571) +++ trunk/OpenMPT/installer/install.iss 2010-04-19 19:20:17 UTC (rev 572) @@ -46,6 +46,12 @@ Source: "..\mptrack\bin\unmo3.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "packageTemplate\readme.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "..\packageTemplate\history.txt"; DestDir: "{app}"; Flags: ignoreversion + +; release notes +Source: "..\packageTemplate\ReleaseNotesImages\general\*.*"; DestDir: "{app}\ReleaseNotesImages\general\"; Flags: ignoreversion +Source: "..\packageTemplate\ReleaseNotesImages\1.18\*.*"; DestDir: "{app}\ReleaseNotesImages\1.18\"; Flags: ignoreversion +Source: "..\packageTemplate\OMPT_1.18_ReleaseNotes.html"; DestDir: "{app}"; Flags: ignoreversion + ; soundtouch license stuff Source: "..\packageTemplate\SoundTouch\*.*"; DestDir: "{app}\SoundTouch"; Flags: ignoreversion ; keymaps @@ -235,3 +241,4 @@ end; + Added: trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html (rev 0) +++ trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html 2010-04-19 19:20:17 UTC (rev 572) @@ -0,0 +1,172 @@ +<?xml version="1.0" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>OpenMPT 1.18 Release Notes</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="language" content="en" /> + <style type="text/css"> + * { font-family: sans-serif; } + body + { + color: #000; + background: #fff; + font-size:12pt; + } + + a { color: #00c; text-decoration: none; } + a:visited { color: #909; text-decoration: none; } + a:hover { text-decoration: underline; } + + div img, h1 + { + border: 1px solid #ccc; + padding: 3px; + background: #eee; + margin: 0 0 3px 3px; + } + + p { padding: 5px; } + + h1 + { + margin: 0; + font-size:24pt; + } + h1 img { vertical-align: middle; } + + h2, h3, h4 + { + border: 1px solid #ddd; + border-width: 0 0 0 3em; + margin: 15px 5px; + padding: 0px 5px; + font-size: 18pt; + } + + h3 { border-left-width: 2em; } + h4 { border-left-width: 1em; } + + li {list-style-type: none; padding:0 0 1em 0; } + li:before { content: "» "; } + + </style> + </head> + <body> + + <h1> + <img src="ReleaseNotesImages/general/modplug.png" width="114" height="110" alt="OpenMPT Logo" /> + OpenMPT 1.18 - Release Notes + </h1> + + <p> + OpenMPT has changed a lot since the last official release (version 1.17.02.54). + This document should give a rough overview about the greatest changes in OpenMPT 1.18. + </p> + + <h2>What's new?</h2> + + <h3>General</h3> + <div style="float:right;"> + <img src="ReleaseNotesImages/1.18/treeview.png" width="183" height="338" alt="Improved treeview" title="Improved treeview" /> + </div> + <ul> + <li><strong>Sequences</strong>: It is possible to have more than just one orderlist in the MPTM format now. + This way, you can work on several tracks or subtunes at once using the same set of instruments. + This is for example useful when working on game music. You can also convert your work back + to the other formats - The sequences are merged into one orderlist then. Sequences can be + managed comfortably from the treeview.</li> + <li>Support for <strong>new file formats</strong>: GDM (General Digital Music), IMF (Imago Orpheus), + J2B (Jazz Jackrabbit 2 music) and 8 channel Startrekker modules can now be imported. Scala tuning files can be used with OpenMPT's tuning editor now. + Support for other file formats was also notably improved: All PSM files (old and new Epic Megagames MASI) + load correctly now, ULT (Ultratracker) import is more accurate, XM files compressed with BoobieSequeezer or made with early versions of Skale Tracker load correctly, etc...</li> + <li>A countless number of <strong>playback behaviour fixes</strong> to maximise compatibility with ProTracker, + Scream Tracker 3, Fasttracker 2 and Impulse Tracker, including a special + "ProTracker 1.x" playback mode. Compatibility export features have been enhanced.</li> + <li>Support for <strong>ultra-low latency</strong> in ASIO mode, down to 1ms.</li> + <li><strong>Time estimation</strong> in the WAV and MP3 export dialogs; improved MP3 export (including ID3 v2.4 Tags).</li> + <li><strong>Default directories</strong> for VST plugins and presets.</li> + <li>More <strong>customisable colours</strong>. Now, you can export your favourite colour scheme to a file and share it with your friends!</li> + <li>Some <strong>new options</strong>, including the ability not to reset the channels when the module is looping and sample playback indicators in the treeview.</li> + <li><strong>Program settings</strong> are now stored in the Application Data folder by default.</li> + <li>New and <strong>updated keymaps</strong> with many new shortcuts!</li> + <li><strong>Redesigned</strong> several dialogs.</li> + </ul> + + <h3>Pattern Editor</h3> + <div style="float:right;"> + <img src="ReleaseNotesImages/1.18/orderlist.png" width="348" height="167" alt="New orderlist" title="New orderlist" /> + </div> + <ul> + <li>The upper panel is a lot more <strong>compact</strong> now; The split keyboard settings + have been moved to a separate dialog which can be called with a keyboard shortcut + or through the main menu.</li> + <li><strong>Parameter Control Notes</strong>: These new pattern events almost completely replace Zxx and \xx commands + for VST parameter automation in the MPTM format. They are not bound to a specific channel or macro anymore; + The pattern event stores all necessary information and can thus be moved around easily in the pattern. + The format for those events is: PC(s) XX YYY ZZZ. A PC "note" equals a Zxx effect, a PCs "note" behaves like \xx. + The instrument column (XX) contains the VST number (can be obtained from the VST list or through the context menu). + The volume column (YYY) stores the parameter that is going to be automatic, ranging from 0 to 999 (decimal). + The effect column (ZZZ) stores the parameter value, also ranging from 0 to 999 (decimal).</li> + <li>In the <strong>orderlist</strong>, multiple orders can now be selected at once (default multiselect shortcut: Shift). + Order selections can be quickly rendered to a wave file using the context menu.</li> + <li>New <strong>paste modes</strong>: Overflow paste (which continues the paste in the next pattern if it reaches the bottom of the current pattern), + paste flood (which keeps pasting the data again and again, until it reaches the bottom of the pattern) and + push-forward paste (which pushes the already existing pattern data downwards, like in Impulse Tracker).</li> + <li>Improved MOD editing - now it should be almost impossible to write commands in the patterns that don't belong into MOD files. :-)</li> + </ul> + + <h3>Sample Editor</h3> + <ul> + <li><strong>Sample drawing</strong>! Create new empty samples and doodle around in the sample editor to create cool chip samples, + or fix small mistakes (f.e. peaks) in already existing samples.</li> + <li><strong>Undo</strong>: Finally, you can now also undo sample modifications; there are up to 100 undo steps for each individual sample.</li> + <li><strong>Mass export</strong>: Shift-Click the "Save" button to export all samples at once.</li> + <li><strong>Duplicate sample</strong>: Shift-Click the "New" button to clone all settings and the sample itself into a new sample slot.</li> + <li><strong>DC Offset Removal</strong>: Samples can now be aligned perfectly to the zero line, to allow maximum amplification.</li> + </ul> + + <h3>Instrument Editor</h3> + <ul> + <li>The envelopes can now be edited using the <strong>keyboard</strong>; some of the default keymaps already have the necessary shortcuts assigned + - if you are using a custom keymap, you might want to add those shortcuts to it using the keyboard setup.</li> + <li>The <strong>sample map</strong> (IT / MPTM format) is now also applied to VST instruments. This way, you can easily transpose a VST instrument up or down. + Some entries have been added to the sample map's context menu, to simplify this.</li> + <li>A basic <strong>envelope zoom</strong> feature; Might still look a bit weird at extreme zoom. :-)</li> + </ul> + + <h3>VST Plugins</h3> + <ul> + <li>Pressing <strong>Shift</strong> while changing a plugin parameter in the plugin's GUI will open the + MIDI Mapping dialog. Does not work with all plugins.</li> + <li>Enhanced <strong>VST compatibility</strong>.</li> + </ul> + + <p> + For a detailed description of what has changed, check <a href="history.txt">history.txt</a>. + </p> + + <h2>Known Issues</h2> + <p> + <i>This list has mostly been copied over from the old 1.17RC2 release notes, so this not very comprehensive... :-)</i> + </p> + <ul> + <li>Lacking support for VST 2.4+</li> + <li>Some controls are vanishing randomly all the time, most notably under Windows Vista and Windows 7.</li> + <li>Previewing samples from the treeview's file browser stops the playing module.</li> + <li>Cannot preview instruments directly from the MIDI library in the treeview.</li> + <li>Excessive performance drop when dragging over the graphical parameter editor during playback.</li> + <li>The Right Alt (or Alt Gr) key is not handled well by the keyboard configuration.</li> + <li>In Windows 98, the graphical parameter editor and instrument envelope editor grid display are messed up.</li> + <li>There is no real way to find out what features of the tracker are supported by the original trackers (Impulse Tracker, Fasttracker 2, etc...) when working with those file formats...</li> + </ul> + + <h2>Contact</h2> + <p> + Helpful bug reports, new ideas and brave volunteers to test early development builds or contribute to the code are more than welcome! + You can meet us at the ModPlug Central forums: <a href="http://openmpt.com/forum/">http://openmpt.com/forum/</a>. + </p> + + </body> +</html> \ No newline at end of file Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18 ___________________________________________________________________ Added: tsvn:logminsize + 10 Added: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/orderlist.png =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/orderlist.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/treeview.png =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.18/treeview.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/general ___________________________________________________________________ Added: tsvn:logminsize + 10 Added: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/general/modplug.png =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/general/modplug.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2010-04-20 19:39:09
|
Revision: 573 http://modplug.svn.sourceforge.net/modplug/?rev=573&view=rev Author: rewbs Date: 2010-04-20 19:38:59 +0000 (Tue, 20 Apr 2010) Log Message: ----------- [New] Added combined note delay & note cut command for .mptm only (":xy" means delay until tick x and play for y ticks). [Mod] Removed old "velocity" volume command, which was experimental and unused. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/mod_specifications.h trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -1279,10 +1279,10 @@ commands[kcSetVolumeITPortaDown].isDummy = false; commands[kcSetVolumeITPortaDown].Message = "Vol command - Portamento Down"; - commands[kcSetVolumeITVelocity].UID = 1245; - commands[kcSetVolumeITVelocity].isHidden = false; - commands[kcSetVolumeITVelocity].isDummy = false; - commands[kcSetVolumeITVelocity].Message = "Vol command - Velocity"; + commands[kcSetVolumeITUnused].UID = 1245; + commands[kcSetVolumeITUnused].isHidden = true; + commands[kcSetVolumeITUnused].isDummy = false; + commands[kcSetVolumeITUnused].Message = "Vol command - Unused"; commands[kcSetVolumeITOffset].UID = 1246; commands[kcSetVolumeITOffset].isHidden = false; @@ -1529,10 +1529,10 @@ commands[kcSetFXmacroSlide].isDummy = false; commands[kcSetFXmacroSlide].Message = "FX midi macro slide"; - commands[kcSetFXvelocity].UID = 1295; - commands[kcSetFXvelocity].isHidden = false; - commands[kcSetFXvelocity].isDummy = false; - commands[kcSetFXvelocity].Message = "FX pseudo-velocity (experimental)"; + commands[kcSetFXdelaycut].UID = 1295; + commands[kcSetFXdelaycut].isHidden = false; + commands[kcSetFXdelaycut].isDummy = false; + commands[kcSetFXdelaycut].Message = "FX combined note delay and note cut"; commands[kcPatternJumpDownh1Select].UID = 1296; commands[kcPatternJumpDownh1Select].isHidden = true; Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-04-20 19:38:59 UTC (rev 573) @@ -484,7 +484,7 @@ kcSetVolumePortamento, //g kcSetVolumeITPortaUp, //f kcSetVolumeITPortaDown, //e - kcSetVolumeITVelocity, //: + kcSetVolumeITUnused, //: kcSetVolumeITOffset, //o kcSetVolumeEnd=kcSetVolumeITOffset, @@ -542,7 +542,7 @@ kcSetFXmacro, //z,z kcFixedFXend=kcSetFXmacro, kcSetFXmacroSlide, //?,\ - kcSetFXvelocity, //?,: + kcSetFXdelaycut, //?,: kcSetFXextension, //?,# kcSetFXEnd=kcSetFXextension, Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -289,12 +289,10 @@ srcy = pfnt->nAlphaNZ_Y + 14 * COLUMN_HEIGHT; break; //end rewbs.smoothVST - //rewbs.velocity case ':': srcx = pfnt->nAlphaNZ_X; srcy = pfnt->nAlphaNZ_Y + 15 * COLUMN_HEIGHT; break; - //end rewbs.velocity case ' ': srcx = pfnt->nSpaceX; srcy = pfnt->nSpaceY; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -1985,7 +1985,7 @@ #define MOD_TYPE_XMIT (MOD_TYPE_XM|MOD_TYPE_IT) #define MOD_TYPE_XMITMPT (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT) #define MOD_TYPE_ITMPT (MOD_TYPE_IT|MOD_TYPE_MPT) -#define MAX_FXINFO 69 +#define MAX_FXINFO 70 const MPTEFFECTINFO gFXInfo[MAX_FXINFO] = @@ -2060,6 +2060,7 @@ // MPT IT extensions and special effects {CMD_S3MCMDEX, 0xF0,0x90, 0, MOD_TYPE_S3MITMPT, "Sound control"}, {CMD_S3MCMDEX, 0xF0,0x70, 0, MOD_TYPE_ITMPT, "Instr. control"}, + {CMD_DELAYCUT, 0x00,0x00, 0, MOD_TYPE_MPT, "Note delay and cut"}, // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" {CMD_XPARAM, 0x00,0x00, 0, MOD_TYPE_XMITMPT, "X param"}, @@ -2840,7 +2841,7 @@ LPCSTR pszName; // ie "Set Volume" } MPTVOLCMDINFO; -#define MAX_VOLINFO 15 //rewbs.volOff & rewbs.velocity: increased from 13 +#define MAX_VOLINFO 15 const MPTVOLCMDINFO gVolCmdInfo[MAX_VOLINFO] = @@ -2858,8 +2859,8 @@ {VOLCMD_TONEPORTAMENTO, MOD_TYPE_XMITMPT, "g: Tone portamento"}, {VOLCMD_PORTAUP, MOD_TYPE_ITMPT, "f: Portamento up"}, {VOLCMD_PORTADOWN, MOD_TYPE_ITMPT, "e: Portamento down"}, - {VOLCMD_VELOCITY, MOD_TYPE_ITMPT, ":: velocity"}, //rewbs.velocity - {VOLCMD_OFFSET, MOD_TYPE_ITMPT, "o: offset"}, //rewbs.volOff + {VOLCMD_DELAYCUT, MOD_TYPE_ITMPT, ":: (currently unused)"}, + {VOLCMD_OFFSET, MOD_TYPE_ITMPT, "o: Offset"}, //rewbs.volOff }; Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-04-20 19:38:59 UTC (rev 573) @@ -439,9 +439,9 @@ STATIC_ASSERT(ARRAYELEMCOUNT(szSpecialNoteShortDesc) == ARRAYELEMCOUNT(szSpecialNoteNames)); const LPCSTR szHexChar = "0123456789ABCDEF"; -const LPCSTR gszModCommands = " 0123456789ABCDRFFTE???GHK?YXPLZ\\:#??"; //rewbs.smoothVST: added last \ (written as \\); rewbs.velocity: added last : -const LPCSTR gszS3mCommands = " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#??"; //rewbs.smoothVST: added last \ (written as \\); rewbs.velocity: added last : -const LPCSTR gszVolCommands = " vpcdabuhlrgfe:o"; //rewbs.velocity: added last : ; rewbs.volOff added last o +const LPCSTR gszModCommands = " 0123456789ABCDRFFTE???GHK?YXPLZ\\:#??"; //rewbs.smoothVST: added last \ (written as \\); +const LPCSTR gszS3mCommands = " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#??"; //rewbs.smoothVST: added last \ (written as \\); +const LPCSTR gszVolCommands = " vpcdabuhlrgfe:o"; const TCHAR gszEmpty[] = TEXT(""); // Defined in load_mid.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -3763,7 +3763,6 @@ case kcSetVolumePortamento: volcmd = VOLCMD_TONEPORTAMENTO; break; case kcSetVolumeITPortaUp: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_PORTAUP; break; case kcSetVolumeITPortaDown: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_PORTADOWN; break; - case kcSetVolumeITVelocity: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_VELOCITY; break; //rewbs.velocity case kcSetVolumeITOffset: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_OFFSET; break; //rewbs.volOff } //if ((pSndFile->m_nType & MOD_TYPE_MOD) && (volcmd > VOLCMD_PANNING)) volcmd = vol = 0; @@ -3892,18 +3891,6 @@ p->param = (p->param << 4) | v; if (p->command == m_cmdOld.command) m_cmdOld.param = p->param; - /* - if (v >= 0 && v <= 9) - { - p->param = (p->param << 4) | v; - if (p->command == m_cmdOld.command) m_cmdOld.param = p->param; - } - else if (v >= 10 && v <= 15) - { - p->param = (p->param << 4) | (v + 0x0A); - if (p->command == m_cmdOld.command) m_cmdOld.param = p->param; - } - */ // Check for MOD/XM Speed/Tempo command if ((pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) && ((p->command == CMD_SPEED) || (p->command == CMD_TEMPO))) @@ -3912,15 +3899,15 @@ } } - DWORD sel = (m_nRow << 16) | m_dwCursor; - SetCurSel(sel, sel); - sel &= ~7; - if(*p != oldcmd) - { - pModDoc->SetModified(); - InvalidateArea(sel, sel+5); - UpdateIndicator(); - } + DWORD sel = (m_nRow << 16) | m_dwCursor; + SetCurSel(sel, sel); + sel &= ~7; + if(*p != oldcmd) + { + pModDoc->SetModified(); + InvalidateArea(sel, sel+5); + UpdateIndicator(); + } } } Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2010-04-20 19:38:59 UTC (rev 573) @@ -229,14 +229,14 @@ 5:1242:0:71:1 //Vol command - Portamento: G (KeyDown) 5:1243:0:70:1 //Vol command - Portamento Up: F (KeyDown) 5:1244:0:69:1 //Vol command - Portamento Down: E (KeyDown) -5:1245:0:186:1 //Vol command - Velocity: ; (KeyDown) -5:1245:1:186:1 //Vol command - Velocity: Shift+; (KeyDown) +5:1245:0:186:1 //Vol command - (unused): ; (KeyDown) +5:1245:1:186:1 //Vol command - (unused): Shift+; (KeyDown) 5:1246:0:79:1 //Vol command - Offset: O (KeyDown) //----( Pattern Context [bottom] - FX Col (6) )------------ 6:1294:0:220:1 //FX midi macro slide: \ (KeyDown) -6:1295:1:186:1 //FX pseudo-velocity (experimental): Shift+; (KeyDown) -6:1295:0:186:1 //FX pseudo-velocity (experimental): ; (KeyDown) +6:1295:1:186:1 //FX combined note cute and note delay: Shift+; (KeyDown) +6:1295:0:186:1 //FX combined note cute and note delay: ; (KeyDown) 6:1666:0:191:1 //FX parameter extension command: / (KeyDown) //----( Pattern Context [bottom] - Param Col (7) )------------ Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -1475,9 +1475,8 @@ if(m_dwLastSavedWithVersion <= MAKE_VERSION_NUMERIC(1, 17, 02, 54) && interpretModplugmade) m[ch].volcmd = VOLCMD_VIBRATOSPEED; } else - // 213-222: Velocity //rewbs.velocity - if ((vol >= 213) && (vol <= 222)) { m[ch].volcmd = VOLCMD_VELOCITY; m[ch].vol = vol - 213; } else //rewbs.velocity - // 223-232: Offset //rewbs.VolOffset + // 213-222: Unused (was velocity) + // 223-232: Offset if ((vol >= 223) && (vol <= 232)) { m[ch].volcmd = VOLCMD_OFFSET; m[ch].vol = vol - 223; } //rewbs.volOff lastvalue[ch].volcmd = m[ch].volcmd; lastvalue[ch].vol = m[ch].vol; @@ -2205,7 +2204,6 @@ case VOLCMD_TONEPORTAMENTO: vol = 193 + ConvertVolParam(m->vol); break; case VOLCMD_PORTADOWN: vol = 105 + ConvertVolParam(m->vol); break; case VOLCMD_PORTAUP: vol = 115 + ConvertVolParam(m->vol); break; - case VOLCMD_VELOCITY: vol = 213 + ConvertVolParam(m->vol); break; //rewbs.velocity case VOLCMD_OFFSET: vol = 223 + ConvertVolParam(m->vol); break; //rewbs.volOff default: vol = 0xFF; } Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -56,7 +56,7 @@ case 'Y' - 55: command = CMD_PANBRELLO; break; //34 case 'Z' - 55: command = CMD_MIDI; break; //35 case '\\' - 56: command = CMD_SMOOTHMIDI; break; //rewbs.smoothVST: 36 - case ':' - 21: command = CMD_VELOCITY; break; //rewbs.velocity: 37 + case ':' - 21: command = CMD_DELAYCUT; break; //37 case '#' + 3: command = CMD_XPARAM; break; //rewbs.XMfixes - XParam is 38 default: command = 0; } @@ -153,11 +153,8 @@ else command = '\\' - 56; break; - case CMD_VELOCITY: //rewbs.velocity: 37 - if(bCompatibilityExport) + case CMD_DELAYCUT: command = param = 0; - else - command = ':' - 21; break; case CMD_XPARAM: //rewbs.XMfixes - XParam is 38 if(bCompatibilityExport) Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -80,7 +80,7 @@ { UINT command = m->command; UINT param = m->param; - switch (command + 0x40) + switch (command | 0x40) { case 'A': command = CMD_SPEED; break; case 'B': command = CMD_POSITIONJUMP; break; @@ -109,11 +109,9 @@ case 'Y': command = CMD_PANBRELLO; break; case 'Z': command = CMD_MIDI; break; case '\\': command = CMD_SMOOTHMIDI; break; //rewbs.smoothVST - case ':': command = CMD_VELOCITY; break; //rewbs.velocity -// -> CODE#0010 -// -> DESC="add extended parameter mechanism to pattern effects" + // Chars under 0x40 don't save properly, so map : to ] and # to [. + case ']': command = CMD_DELAYCUT; break; case '[': command = CMD_XPARAM; break; -// -! NEW_FEATURE#0010 default: command = 0; } m->command = command; @@ -172,12 +170,6 @@ else command = '\\'; break; - case CMD_VELOCITY: //rewbs.velocity - if(bCompatibilityExport) - command = param = 0; - else - command = ':'; - break; case CMD_XFINEPORTAUPDOWN: if (param & 0x0F) switch(param & 0xF0) { @@ -204,15 +196,19 @@ case 0xB0: if (param & 0x0F) { command = 'D'; param |= 0xF0; } else command=param=0; break; } break; -// -> CODE#0010 -// -> DESC="add extended parameter mechanism to pattern effects" + // Chars under 0x40 don't save properly, so map : to ] and # to [. + case CMD_DELAYCUT: + if(bCompatibilityExport) + command = param = 0; + else + command = ']'; + break; case CMD_XPARAM: if(bCompatibilityExport) command = param = 0; else command = '['; break; -// -! NEW_FEATURE#0010 default: command = param = 0; } command &= ~0x40; Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -1256,6 +1256,13 @@ if((m_dwSongFlags & SONG_FIRSTTICK) == 0) InvertLoop(&Chn[nChn]); // Process special effects (note delay, pattern delay, pattern loop) + if (cmd == CMD_DELAYCUT) + { + //:xy --> note delay until tick x, note cut at tick x+y + nStartTick = (param & 0xF0) >> 4; + int cutAtTick = nStartTick + (param & 0x0F); + NoteCut(nChn, cutAtTick); + } else if ((cmd == CMD_MODCMDEX) || (cmd == CMD_S3MCMDEX)) { if ((!param) && (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) param = pChn->nOldCmdEx; else pChn->nOldCmdEx = param; @@ -1569,12 +1576,6 @@ else PortamentoDown(pChn, vol << 2, false); break; - - case VOLCMD_VELOCITY: //rewbs.velocity TEMP algorithm (crappy :) - pChn->nVolume = vol * 28; //Max nVolume is 255; max vol is 9; 255/9=28 - pChn->dwFlags |= CHN_FASTVOLRAMP; - if (m_nTickCount == nStartTick) SampleOffset(nChn, 48-(vol << 3), bPorta); //Max vol is 9; 9 << 3 = 48 - break; case VOLCMD_OFFSET: //rewbs.volOff if (m_nTickCount == nStartTick) @@ -1701,8 +1702,6 @@ if (volcmd == VOLCMD_OFFSET) RetrigNote(nChn, pChn->nRetrigParam, vol << 3); - else if (volcmd == VOLCMD_VELOCITY) - RetrigNote(nChn, pChn->nRetrigParam, 48 - (vol << 3)); else RetrigNote(nChn, pChn->nRetrigParam); } @@ -1710,15 +1709,11 @@ { // XM Retrig if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); else param = pChn->nRetrigParam; - //rewbs.volOffset //RetrigNote(nChn, param); if (volcmd == VOLCMD_OFFSET) RetrigNote(nChn, param, vol << 3); - else if (volcmd == VOLCMD_VELOCITY) - RetrigNote(nChn, param, 48 - (vol << 3)); else RetrigNote(nChn, param); - //end rewbs.volOffset: } break; @@ -1968,11 +1963,6 @@ } break; //rewbs.smoothVST end - - //rewbs.velocity - case CMD_VELOCITY: - break; - //end rewbs.velocity // IMF Commands case CMD_NOTESLIDEUP: Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-04-20 19:38:59 UTC (rev 573) @@ -3623,10 +3623,6 @@ m->command = CMD_OFFSET; m->param = m->vol << 3; break; - case VOLCMD_VELOCITY: - m->command = CMD_VOLUME; - m->param = m->vol * 7; - break; default: break; } @@ -3700,10 +3696,6 @@ m->param = m->vol << 3; m->volcmd = CMD_NONE; break; - case VOLCMD_VELOCITY: - m->volcmd = CMD_VOLUME; - m->vol *= 7; - break; default: break; } @@ -3731,10 +3723,6 @@ m->param = m->vol << 3; m->volcmd = CMD_NONE; break; - case VOLCMD_VELOCITY: - m->volcmd = CMD_VOLUME; - m->vol *= 7; - break; default: break; } @@ -3756,7 +3744,6 @@ case VOLCMD_VIBRATODEPTH: // OpenMPT-specific commands case VOLCMD_OFFSET: - case VOLCMD_VELOCITY: m->vol = min(m->vol, 9); break; case VOLCMD_PANSLIDELEFT: @@ -3832,7 +3819,7 @@ case CMD_TREMOLO: return 40; case CMD_KEYOFF: return 32; case CMD_SETENVPOSITION: return 24; - case CMD_VELOCITY: return 16; + case CMD_DELAYCUT: return 16; case CMD_XPARAM: return 8; case CMD_NONE: default: return 0; Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-04-20 19:38:59 UTC (rev 573) @@ -89,7 +89,7 @@ true, //Has song comments MAX_ENVPOINTS, //Envelope point count " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#", // Supported Effects - " vpcdabuhlrgfe:o", // Supported Volume Column commands + " vpcdabuhlrgfe?o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) true, // Supports plugins @@ -241,8 +241,8 @@ 31, //Max Speed true, //Has song comments 12, //Envelope point count - " 0123456789ABCDRFFTE???GHK?YXPLZ\\:#", // Supported Effects - " vpcdabuhlrgfe:o", // Supported Volume Column commands + " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#", // Supported Effects + " vpcdabuhlrgfe?o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) true, // Supports plugins @@ -316,7 +316,7 @@ 255, //Max Speed false, //No song comments 0, //No instrument envelopes - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#", // Supported Effects " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern false, // Doesn't have restart position (order) @@ -390,8 +390,8 @@ 255, //Max Speed true, //Has song comments 25, //Envelope point count - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#", // Supported Effects - " vpcdab?h??gfe:o", // Supported Volume Column commands + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#", // Supported Effects + " vpcdab?h??gfe?o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has restart position (order) true, // Supports plugins Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2010-04-19 19:20:17 UTC (rev 572) +++ trunk/OpenMPT/soundlib/modcommand.h 2010-04-20 19:38:59 UTC (rev 573) @@ -96,7 +96,7 @@ #define VOLCMD_TONEPORTAMENTO 11 #define VOLCMD_PORTAUP 12 #define VOLCMD_PORTADOWN 13 -#define VOLCMD_VELOCITY 14 //rewbs.velocity +#define VOLCMD_DELAYCUT 14 //currently unused #define VOLCMD_OFFSET 15 //rewbs.volOff #define MAX_VOLCMDS 16 @@ -135,7 +135,7 @@ #define CMD_SETENVPOSITION 30 #define CMD_MIDI 31 #define CMD_SMOOTHMIDI 32 //rewbs.smoothVST -#define CMD_VELOCITY 33 //rewbs.velocity +#define CMD_DELAYCUT 33 #define CMD_XPARAM 34 // -> CODE#0010 -> DESC="add extended parameter mechanism to pattern effects" -! NEW_FEATURE#0010 #define CMD_NOTESLIDEUP 35 // IMF Gxy #define CMD_NOTESLIDEDOWN 36 // IMF Hxy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |