From: <sag...@us...> - 2015-06-09 17:44:42
|
Revision: 5284 http://sourceforge.net/p/modplug/code/5284 Author: saga-games Date: 2015-06-09 17:44:35 +0000 (Tue, 09 Jun 2015) Log Message: ----------- [New] Tremor (Ixx) is now also supported for instrument plugins (http://forum.openmpt.org/index.php?topic=2736.0). [Fix] The plugin selection dialog was not placed correctly on multi-monitor setups or after moving a windowed OpenMPT instance. [Mod] OpenMPT: Version is now 1.25.00.12 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2015-06-09 09:23:11 UTC (rev 5283) +++ trunk/OpenMPT/common/versionNumber.h 2015-06-09 17:44:35 UTC (rev 5284) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 25 #define VER_MINOR 00 -#define VER_MINORMINOR 11 +#define VER_MINORMINOR 12 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-06-09 09:23:11 UTC (rev 5283) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-06-09 17:44:35 UTC (rev 5284) @@ -94,7 +94,7 @@ if (m_pPlugin) { CString targetSlot; - targetSlot.Format(_T("&Put in FX%02d"), m_nPlugSlot + 1); + targetSlot.Format(_T("&Put in FX%02u"), m_nPlugSlot + 1); SetDlgItemText(IDOK, targetSlot); ::EnableWindow(::GetDlgItem(m_hWnd, IDOK), TRUE); } else @@ -104,10 +104,13 @@ const int dpiX = Util::GetDPIx(m_hWnd); const int dpiY = Util::GetDPIy(m_hWnd); - MoveWindow(MulDiv(TrackerSettings::Instance().gnPlugWindowX, dpiX, 96), - MulDiv(TrackerSettings::Instance().gnPlugWindowY, dpiY, 96), - MulDiv(TrackerSettings::Instance().gnPlugWindowWidth, dpiX, 96), - MulDiv(TrackerSettings::Instance().gnPlugWindowHeight, dpiY, 96)); + CRect rect + ( + CPoint(MulDiv(TrackerSettings::Instance().gnPlugWindowX, dpiX, 96), MulDiv(TrackerSettings::Instance().gnPlugWindowY, dpiY, 96)), + CSize(MulDiv(TrackerSettings::Instance().gnPlugWindowWidth, dpiX, 96), MulDiv(TrackerSettings::Instance().gnPlugWindowHeight, dpiY, 96)) + ); + ::MapWindowPoints(GetParent()->m_hWnd, HWND_DESKTOP, (CPoint *)&rect, 2); + MoveWindow(rect); UpdatePluginsList(); OnSelChanged(NULL, NULL); @@ -220,6 +223,7 @@ { CRect rect; GetWindowRect(&rect); + ::MapWindowPoints(HWND_DESKTOP, GetParent()->m_hWnd, (CPoint *)&rect, 2); const int dpiX = Util::GetDPIx(m_hWnd); const int dpiY = Util::GetDPIy(m_hWnd); TrackerSettings::Instance().gnPlugWindowX = MulDiv(rect.left, 96, dpiX); Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2015-06-09 09:23:11 UTC (rev 5283) +++ trunk/OpenMPT/soundlib/Sndfile.h 2015-06-09 17:44:35 UTC (rev 5284) @@ -405,7 +405,7 @@ CHANNELINDEX m_nChannels; SAMPLEINDEX m_nSamples; INSTRUMENTINDEX m_nInstruments; - UINT m_nDefaultSpeed, m_nDefaultGlobalVolume; + uint32 m_nDefaultSpeed, m_nDefaultGlobalVolume; TEMPO m_nDefaultTempo; FlagSet<SongFlags> m_SongFlags; CHANNELINDEX m_nMixChannels; @@ -421,11 +421,11 @@ ORDERINDEX m_lockOrderStart, m_lockOrderEnd; #endif // MODPLUG_TRACKER - UINT m_nSamplePreAmp, m_nVSTiVolume; + uint32 m_nSamplePreAmp, m_nVSTiVolume; bool IsGlobalVolumeUnset() const { return IsFirstTick(); } #ifndef MODPLUG_TRACKER - UINT m_nFreqFactor; // Pitch shift factor (65536 = no pitch shifting). Only used in libopenmpt (openmpt::ext::interactive::set_pitch_factor) - UINT m_nTempoFactor; // Tempo factor (65536 = no tempo adjustment). Only used in libopenmpt (openmpt::ext::interactive::set_tempo_factor) + uint32 m_nFreqFactor; // Pitch shift factor (65536 = no pitch shifting). Only used in libopenmpt (openmpt::ext::interactive::set_pitch_factor) + uint32 m_nTempoFactor; // Tempo factor (65536 = no tempo adjustment). Only used in libopenmpt (openmpt::ext::interactive::set_tempo_factor) #endif // Min Period = highest possible frequency, Max Period = lowest possible frequency for current format @@ -800,7 +800,7 @@ void ProcessVolumeSwing(ModChannel *pChn, int &vol) const; void ProcessPanningSwing(ModChannel *pChn) const; void ProcessTremolo(ModChannel *pChn, int &vol) const; - void ProcessTremor(ModChannel *pChn, int &vol) const; + void ProcessTremor(CHANNELINDEX nChn, int &vol); bool IsEnvelopeProcessed(const ModChannel *pChn, EnvelopeType env) const; void ProcessVolumeEnvelope(ModChannel *pChn, int &vol) const; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2015-06-09 09:23:11 UTC (rev 5283) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2015-06-09 17:44:35 UTC (rev 5284) @@ -766,71 +766,73 @@ } -void CSoundFile::ProcessTremor(ModChannel *pChn, int &vol) const -//-------------------------------------------------------------- +void CSoundFile::ProcessTremor(CHANNELINDEX nChn, int &vol) +//--------------------------------------------------------- { + ModChannel &chn = m_PlayState.Chn[nChn]; + if(IsCompatibleMode(TRK_FASTTRACKER2)) { // FT2 Compatibility: Weird XM tremor. // Test case: Tremor.xm - if(pChn->nTremorCount & 0x80) + if(chn.nTremorCount & 0x80) { - if(!m_SongFlags[SONG_FIRSTTICK] && pChn->nCommand == CMD_TREMOR) + if(!m_SongFlags[SONG_FIRSTTICK] && chn.nCommand == CMD_TREMOR) { - pChn->nTremorCount &= ~0x20; - if(pChn->nTremorCount == 0x80) + chn.nTremorCount &= ~0x20; + if(chn.nTremorCount == 0x80) { // Reached end of off-time - pChn->nTremorCount = (pChn->nTremorParam >> 4) | 0xC0; - } else if(pChn->nTremorCount == 0xC0) + chn.nTremorCount = (chn.nTremorParam >> 4) | 0xC0; + } else if(chn.nTremorCount == 0xC0) { // Reached end of on-time - pChn->nTremorCount = (pChn->nTremorParam & 0x0F) | 0x80; + chn.nTremorCount = (chn.nTremorParam & 0x0F) | 0x80; } else { - pChn->nTremorCount--; + chn.nTremorCount--; } - pChn->dwFlags.set(CHN_FASTVOLRAMP); + chn.dwFlags.set(CHN_FASTVOLRAMP); } - if((pChn->nTremorCount & 0xE0) == 0x80) + if((chn.nTremorCount & 0xE0) == 0x80) { vol = 0; } } - } else if(pChn->nCommand == CMD_TREMOR) + } else if(chn.nCommand == CMD_TREMOR) { // IT compatibility 12. / 13.: Tremor if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - if((pChn->nTremorCount & 0x80) && pChn->nLength) + if((chn.nTremorCount & 0x80) && chn.nLength) { - if (pChn->nTremorCount == 0x80) - pChn->nTremorCount = (pChn->nTremorParam >> 4) | 0xC0; - else if (pChn->nTremorCount == 0xC0) - pChn->nTremorCount = (pChn->nTremorParam & 0x0F) | 0x80; + if (chn.nTremorCount == 0x80) + chn.nTremorCount = (chn.nTremorParam >> 4) | 0xC0; + else if (chn.nTremorCount == 0xC0) + chn.nTremorCount = (chn.nTremorParam & 0x0F) | 0x80; else - pChn->nTremorCount--; + chn.nTremorCount--; } - if((pChn->nTremorCount & 0xC0) == 0x80) + if((chn.nTremorCount & 0xC0) == 0x80) vol = 0; } else { - uint8 ontime = pChn->nTremorParam >> 4; - uint8 n = ontime + (pChn->nTremorParam & 0x0F); // Total tremor cycle time (On + Off) + uint8 ontime = chn.nTremorParam >> 4; + uint8 n = ontime + (chn.nTremorParam & 0x0F); // Total tremor cycle time (On + Off) if ((!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) || m_SongFlags[SONG_ITOLDEFFECTS]) { n += 2; ontime++; } - uint8 tremcount = pChn->nTremorCount; + uint8 tremcount = chn.nTremorCount; if(!(GetType() & MOD_TYPE_XM)) { if (tremcount >= n) tremcount = 0; if (tremcount >= ontime) vol = 0; - pChn->nTremorCount = tremcount + 1; + chn.nTremorCount = tremcount + 1; } else { if(m_SongFlags[SONG_FIRSTTICK]) @@ -842,13 +844,34 @@ } } else { - pChn->nTremorCount = tremcount + 1; + chn.nTremorCount = tremcount + 1; } if (tremcount % n >= ontime) vol = 0; } } - pChn->dwFlags.set(CHN_FASTVOLRAMP); + chn.dwFlags.set(CHN_FASTVOLRAMP); } + +#ifndef NO_VST + // Plugin tremor + if(chn.nCommand == CMD_TREMOR && chn.pModInstrument && chn.pModInstrument->nMixPlug + && !chn.pModInstrument->dwFlags[INS_MUTE] + && !chn.dwFlags[CHN_MUTE | CHN_SYNCMUTE] + && ModCommand::IsNote(chn.nLastNote)) + { + const ModInstrument *pIns = chn.pModInstrument; + IMixPlugin *pPlugin = m_MixPlugins[pIns->nMixPlug - 1].pMixPlugin; + if(pPlugin) + { + uint8 midiChn = GetBestMidiChannel(nChn); + bool isPlaying = pPlugin->isPlaying(chn.nLastNote, midiChn, nChn); + if(vol == 0 && isPlaying) + pPlugin->MidiCommand(midiChn, pIns->nMidiProgram, pIns->wMidiBank, chn.nLastNote + NOTE_MAX_SPECIAL, 0, nChn); + else if(vol != 0 && !isPlaying) + pPlugin->MidiCommand(midiChn, pIns->nMidiProgram, pIns->wMidiBank, chn.nLastNote, static_cast<uint16>(chn.nVolume), nChn); + } + } +#endif // NO_VST } @@ -1862,7 +1885,7 @@ ProcessVolumeSwing(pChn, IsCompatibleMode(TRK_IMPULSETRACKER) ? insVol : vol); ProcessPanningSwing(pChn); ProcessTremolo(pChn, vol); - ProcessTremor(pChn, vol); + ProcessTremor(nChn, vol); // Clip volume and multiply (extend to 14 bits) Limit(vol, 0, 256); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |