From: <sag...@us...> - 2012-01-03 17:08:11
|
Revision: 1155 http://modplug.svn.sourceforge.net/modplug/?rev=1155&view=rev Author: saga-games Date: 2012-01-03 17:08:04 +0000 (Tue, 03 Jan 2012) Log Message: ----------- [Mod] VST: Knob mode is set to linear for plugins that support it. [Fix] IT Loader: Instruments in IT files with no samples are now loaded correctly. [Fix] MPTM: Last character in sample / instrument names was lost. [Fix] Bidi loop reset fix is now also applied to XM modules. [Ref] Smaller changes. Modified Paths: -------------- trunk/OpenMPT/mptrack/VSTEditor.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/PluginMixBuffer.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/VSTEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/VSTEditor.cpp 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/mptrack/VSTEditor.cpp 2012-01-03 17:08:04 UTC (rev 1155) @@ -64,6 +64,9 @@ m_pVstPlugin->Dispatch(effEditTop, 0,0, NULL, 0); m_pVstPlugin->Dispatch(effEditIdle, 0,0, NULL, 0); + + // Set knob mode to linear (2) instead of circular (0) for those plugins that support it (e.g. Steinberg VB-1) + m_pVstPlugin->Dispatch(effSetEditKnobMode, 0, 2, nullptr, 0.0f); } ShowWindow(SW_SHOW); Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2012-01-03 17:08:04 UTC (rev 1155) @@ -1740,7 +1740,7 @@ } else { nSample = pSndFile->GetNextFreeSample(nInstr); - if (nSample >= MAX_SAMPLES) break; + if (nSample == SAMPLEINDEX_INVALID) break; if (nSample > pSndFile->GetNumSamples()) pSndFile->m_nSamples = nSample; nSmp = nSample; nLoadedSmp++; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2012-01-03 17:08:04 UTC (rev 1155) @@ -368,10 +368,10 @@ if (pis->mpr<=128) pIns->nMidiProgram = pis->mpr; pIns->nMidiChannel = pis->mch; - if (pIns->nMidiChannel > 16) //rewbs.instroVSTi + if (pIns->nMidiChannel >= 128) //rewbs.instroVSTi { //(handle old format where midichan // and mixplug are 1 value) - pIns->nMixPlug = pIns->nMidiChannel-128; + pIns->nMixPlug = pIns->nMidiChannel - 128; pIns->nMidiChannel = 0; } if (pis->mbank<=128) @@ -952,7 +952,7 @@ if (m_nInstruments >= MAX_INSTRUMENTS) m_nInstruments = MAX_INSTRUMENTS-1; for (UINT nins=0; nins<m_nInstruments; nins++) { - if ((inspos[nins] > 0) && (inspos[nins] < dwMemLength - (pifh->cmwt < 0x200 ? sizeof(ITOLDINSTRUMENT) : sizeof(ITINSTRUMENT)))) + if ((inspos[nins] > 0) && (inspos[nins] <= dwMemLength - (pifh->cmwt < 0x200 ? sizeof(ITOLDINSTRUMENT) : sizeof(ITINSTRUMENT)))) { try { Modified: trunk/OpenMPT/soundlib/PluginMixBuffer.h =================================================================== --- trunk/OpenMPT/soundlib/PluginMixBuffer.h 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/PluginMixBuffer.h 2012-01-03 17:08:04 UTC (rev 1155) @@ -31,8 +31,8 @@ static const size_t additionalBuffer = ((sizeof(intptr_t) * 8) / sizeof(buffer_t)); // Return pointer to an aligned buffer - buffer_t *GetBuffer(size_t index) - //------------------------------- + buffer_t *GetBuffer(size_t index) const + //------------------------------------- { ASSERT(index < inputs + outputs); return reinterpret_cast<buffer_t *>((reinterpret_cast<intptr_t>(&mixBuffer[MIXBUFFERSIZE * index]) + bufferAlignmentInBytes) & ~bufferAlignmentInBytes); @@ -44,9 +44,17 @@ bool Initialize(size_t inputs, size_t outputs) //-------------------------------------------- { + // Short cut - we do not need to recreate the buffers. + if(this->inputs == inputs && this->outputs == outputs) + { + return true; + } + Free(); + this->inputs = inputs; this->outputs = outputs; + try { // Create inputs + outputs buffers with additional alignment. @@ -109,6 +117,9 @@ mixBuffer = nullptr; inputsArray = nullptr; outputsArray = nullptr; + + inputs = outputs = 0; + Initialize(2, 0); } @@ -119,14 +130,13 @@ } // Return pointer to a given input or output buffer - buffer_t *GetInputBuffer(size_t index) { return GetBuffer(index); } - buffer_t *GetOutputBuffer(size_t index) { return GetBuffer(inputs + index); } + buffer_t *GetInputBuffer(size_t index) const { return GetBuffer(index); } + buffer_t *GetOutputBuffer(size_t index) const { return GetBuffer(inputs + index); } // Return pointer array to all input or output buffers - buffer_t **GetInputBufferArray() { return inputsArray; } - buffer_t **GetOutputBufferArray() { return outputsArray; } + buffer_t **GetInputBufferArray() const { return inputsArray; } + buffer_t **GetOutputBufferArray() const { return outputsArray; } }; #endif // PLUGINMIXBUFFER_H - Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-03 17:08:04 UTC (rev 1155) @@ -749,7 +749,7 @@ //IT compatibility tentative fix: Don't change bidi loop direction when //no sample nor instrument is changed. - if(IsCompatibleMode(TRK_IMPULSETRACKER) && pSmp == pChn->pModSample && !bInstrumentChanged) + if(IsCompatibleMode(TRK_ALLTRACKERS) && pSmp == pChn->pModSample && !bInstrumentChanged) pChn->dwFlags = (pChn->dwFlags & (CHN_CHANNELFLAGS | CHN_PINGPONGFLAG)) | (pSmp->uFlags & CHN_SAMPLEFLAGS); else pChn->dwFlags = (pChn->dwFlags & CHN_CHANNELFLAGS) | (pSmp->uFlags & CHN_SAMPLEFLAGS); @@ -819,10 +819,10 @@ // Fix sample position on instrument change. This is needed for PT1x MOD and IT "on the fly" sample change. if(pChn->nPos >= pChn->nLength) { - if((m_nType & MOD_TYPE_IT)) + if((GetType() & MOD_TYPE_IT)) { pChn->nPos = pChn->nPosLo = 0; - } else if((m_nType & MOD_TYPE_MOD)) // TODO does not always seem to work, especially with short chip samples? + } else if((GetType() & MOD_TYPE_MOD)) // TODO does not always seem to work, especially with short chip samples? { pChn->nPos = pChn->nLoopStart; pChn->nPosLo = 0; @@ -853,7 +853,7 @@ if (note > NOTE_MAX) { // Key Off (+ Invalid Note for XM - TODO is this correct?) - if (note == NOTE_KEYOFF || !(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) + if (note == NOTE_KEYOFF || !(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) { KeyOff(nChn); } @@ -991,11 +991,11 @@ else bPorta = false; - if ((!bPorta) || (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) + if ((!bPorta) || (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) || ((pChn->dwFlags & CHN_NOTEFADE) && (!pChn->nFadeOutVol)) || ((m_dwSongFlags & SONG_ITCOMPATGXX) && (pChn->rowCommand.instr))) { - if ((m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (pChn->dwFlags & CHN_NOTEFADE) && (!pChn->nFadeOutVol)) + if ((GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (pChn->dwFlags & CHN_NOTEFADE) && (!pChn->nFadeOutVol)) { ResetChannelEnvelopes(pChn); // IT Compatibility: Autovibrato reset @@ -1009,7 +1009,7 @@ } if ((!bPorta) || (!(m_dwSongFlags & SONG_ITCOMPATGXX)) || (pChn->rowCommand.instr)) { - if ((!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) || (pChn->rowCommand.instr)) + if ((!(GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) || (pChn->rowCommand.instr)) { pChn->dwFlags &= ~CHN_NOTEFADE; pChn->nFadeOutVol = 65536; @@ -1043,7 +1043,7 @@ if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->VolEnv.nEnvPosition = 0; if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->PanEnv.nEnvPosition = 0; if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) pChn->PitchEnv.nEnvPosition = 0; - if (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) + if (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) { // Volume Swing if (pIns->nVolSwing) @@ -3909,7 +3909,7 @@ if (pChn->pModInstrument) { const MODINSTRUMENT *pIns = pChn->pModInstrument; - if (((pIns->VolEnv.dwFlags & ENV_LOOP) || (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) && (pIns->nFadeOut)) + if (((pIns->VolEnv.dwFlags & ENV_LOOP) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) && (pIns->nFadeOut)) { pChn->dwFlags |= CHN_NOTEFADE; } @@ -3935,7 +3935,7 @@ #ifndef MODPLUG_TRACKER #ifndef FASTSOUNDLIB // Big Hack!!! - if ((!param) || (param >= 0x80) || ((m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM|MOD_TYPE_MT2)) && (param >= 0x1E))) + if ((!param) || (param >= 0x80) || ((GetType() & (MOD_TYPE_MOD|MOD_TYPE_XM|MOD_TYPE_MT2)) && (param >= 0x1E))) { if ((!m_nRepeatCount) && (IsSongFinished(m_nCurrentPattern, m_nRow+1))) { @@ -3944,9 +3944,8 @@ } #endif // FASTSOUNDLIB #endif // MODPLUG_TRACKER - //if ((m_nType & MOD_TYPE_S3M) && (param > 0x80)) param -= 0x80; // Allow high speed values here for VBlank MODs. (Maybe it would be better to have a "VBlank MOD" flag somewhere? Is it worth the effort?) - if ((param) && (param <= GetModSpecifications().speedMax || (m_nType & MOD_TYPE_MOD))) m_nMusicSpeed = param; + if ((param) && (param <= GetModSpecifications().speedMax || (GetType() & MOD_TYPE_MOD))) m_nMusicSpeed = param; } @@ -3956,12 +3955,8 @@ const CModSpecifications& specs = GetModSpecifications(); if(setAsNonModcommand) { - if(param < specs.tempoMin) m_nMusicTempo = specs.tempoMin; - else - { - if(param > specs.tempoMax) m_nMusicTempo = specs.tempoMax; - else m_nMusicTempo = param; - } + // Set tempo from UI - ignore slide commands and such. + m_nMusicTempo = CLAMP(param, specs.tempoMin, specs.tempoMax); } else { @@ -4439,21 +4434,22 @@ void CSoundFile::InitializeVisitedRows(bool bReset, VisitedRowsType *pRowVector) //------------------------------------------------------------------------------ { + const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed(); if(pRowVector == nullptr) { pRowVector = &m_VisitedRows; } - pRowVector->resize(Order.GetLengthTailTrimmed()); + pRowVector->resize(nMaxOrd); - for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++) + for(ORDERINDEX nOrd = 0; nOrd < nMaxOrd; nOrd++) { - VisitedRowsBaseType *pRow = &(pRowVector->at(nOrd)); + VisitedRowsBaseType &row = pRowVector->at(nOrd); // If we want to reset the vectors completely, we overwrite existing items with false. if(bReset) { - pRow->assign(pRow->size(), false); + row.assign(row.size(), false); } - pRow->resize(GetVisitedRowsVectorSize(Order[nOrd]), false); + row.resize(GetVisitedRowsVectorSize(Order[nOrd]), false); } } @@ -4482,7 +4478,7 @@ InitializeVisitedRows(false, pRowVector); } - pRowVector->at(nOrd)[nRow] = bVisited; + pRowVector->at(nOrd).at(nRow) = bVisited; } @@ -4514,7 +4510,7 @@ return false; } - if(pRowVector->at(nOrd)[nRow]) + if(pRowVector->at(nOrd).at(nRow)) { // we visited this row already - this module must be looping. return true; @@ -4522,7 +4518,7 @@ if(bAutoSet) { - pRowVector->at(nOrd)[nRow] = true; + pRowVector->at(nOrd).at(nRow) = true; } return false; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-01-03 17:08:04 UTC (rev 1155) @@ -2441,17 +2441,16 @@ if ((!nSample) || (nSample > GetNumSamples())) return false; if (GetNumInstruments()) { - for (UINT i = 1; i <= GetNumInstruments(); i++) if (Instruments[i]) + for (INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) { - MODINSTRUMENT *pIns = Instruments[i]; - for (UINT j = 0; j < CountOf(pIns->Keyboard); j++) + if(IsSampleReferencedByInstrument(nSample, i)) { - if (pIns->Keyboard[j] == nSample) return true; + return true; } } } else { - for (UINT i=0; i<Patterns.Size(); i++) if (Patterns[i]) + for (PATTERNINDEX i = 0; i < Patterns.Size(); i++) if (Patterns[i]) { const MODCOMMAND *m = Patterns[i]; for (UINT j=m_nChannels*Patterns[i].GetNumRows(); j; m++, j--) Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2012-01-03 15:58:51 UTC (rev 1154) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2012-01-03 17:08:04 UTC (rev 1155) @@ -88,9 +88,9 @@ 1, // Min pattern rows 1024, // Max pattern rows 25, // Max mod name length - 26, // Max sample name length + 25, // Max sample name length 12, // Max sample filename length - 26, // Max instrument name length + 25, // Max instrument name length 12, // Max instrument filename length 3999, // SamplesMax 255, // instrumentMax This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |