From: <sag...@us...> - 2011-10-20 21:20:31
|
Revision: 1110 http://modplug.svn.sourceforge.net/modplug/?rev=1110&view=rev Author: saga-games Date: 2011-10-20 21:20:23 +0000 (Thu, 20 Oct 2011) Log Message: ----------- [Ref] Rewrote plugin parameter name retrieval to return CStrings. [Fix] VST: When automating parameters from a plugin GUI, it is first checked whether the parameter can be automated. This fixes usage of the Shift key (open MIDI Mapping dialog) in f.e. Ugo Motion and at the same time makes the Shift key work again in Synth1. [Mod] VST: Parameter indices are always displayed in decimal instead of hex and in a more consistent manner throughout the whole interface. Modified Paths: -------------- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/dlg_misc.cpp Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -266,11 +266,7 @@ if(updateParamNames) { // Update param name - CString s; - CHAR sname[64]; - m_pVstPlugin->GetParamName(param, sname, sizeof(sname)); - s.Format("%02X: %s", paramOffset + i, sname); - controls[i]->SetParamName(s); + controls[i]->SetParamName(m_pVstPlugin->GetFormattedParamName(param)); } UpdateParamDisplay(param); @@ -482,6 +478,7 @@ SetParam(param, controls[param - paramOffset]->GetParamValueFromEdit()); } + // Called when a change occurs to the parameter slider // If the change is triggered by the user, we'll need to notify the plugin and update // the other GUI controls @@ -507,7 +504,7 @@ void CDefaultVstEditor::SetParam(PlugParamIndex param, int value) //--------------------------------------------------------------- { - if(m_pVstPlugin == nullptr) + if(m_pVstPlugin == nullptr || param >= m_pVstPlugin->GetNumParameters()) { return; } @@ -533,24 +530,15 @@ return; } - // Get the param value fromt the plug and massage it into the formats we need + // Get the actual parameter value from the plugin const int val = static_cast<int>(m_pVstPlugin->GetParameter(param) * static_cast<float>(PARAM_RESOLUTION) + 0.5f); - CString paramDisplay, paramUnits; - m_pVstPlugin->GetParamDisplay(param, paramDisplay.GetBuffer(64)); - m_pVstPlugin->GetParamLabel(param, paramUnits.GetBuffer(64)); - paramDisplay.ReleaseBuffer(); - paramUnits.ReleaseBuffer(); - paramDisplay.Trim(); - paramUnits.Trim(); - paramDisplay += " " + paramUnits; - // Update the GUI controls // Set lock to indicate that the changes to the GUI are internal - no need to notify the plug and re-update GUI. m_nControlLock++; - controls[param - paramOffset]->SetParamValue(val, paramDisplay); + controls[param - paramOffset]->SetParamValue(val, m_pVstPlugin->GetFormattedParamValue(param)); // Unset lock - done with internal GUI updates. m_nControlLock--; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -2679,12 +2679,9 @@ void AddPluginParameternamesToCombobox(CComboBox& CBox, CVstPlugin& plug) //----------------------------------------------------------------------- { - char s[72], sname[64]; const PlugParamIndex nParams = plug.GetNumParameters(); for (PlugParamIndex i = 0; i < nParams; i++) { - plug.GetParamName(i, sname, sizeof(sname)); - wsprintf(s, "%02d: %s", i, sname); - CBox.SetItemData(CBox.AddString(s), i); + CBox.SetItemData(CBox.AddString(plug.GetFormattedParamName(i)), i); } } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -3259,17 +3259,16 @@ case sfx_plug: { const int param = MacroToPlugParam(value); - char paramName[128] = { '\0' }; + CString paramName; if(plugin < MAX_MIXPLUGINS) { CVstPlugin *pPlug = (CVstPlugin*)m_SndFile.m_MixPlugins[plugin].pMixPlugin; if(pPlug) { - pPlug->GetParamName(param, paramName, sizeof(paramName)); - StringFixer::SetNullTerminator(paramName); + paramName = pPlug->GetParamName(param); } - if (paramName[0] == '\0') + if (paramName.IsEmpty()) { return _T("N/A"); } @@ -3842,8 +3841,8 @@ if (macroType==sfx_plug && MacroToPlugParam(macroText)==paramToUse) { CString message; - message.Format("Param %d can already be controlled with macro %X", paramToUse, checkMacro); - Reporting::Information(message, "Macro exists for this param"); + message.Format("Parameter %02d can already be controlled with macro %X.", paramToUse, checkMacro); + Reporting::Information(message, "Macro exists for this parameter"); return; } } @@ -3859,14 +3858,14 @@ } else { CString message; - message.Format("Param %d beyond controllable range.", paramToUse); - Reporting::Information(message, "Macro not assigned for this param"); + message.Format("Parameter %02d beyond controllable range. Use Parameter Control Events to automate this parameter.", paramToUse); + Reporting::Information(message, "Macro not assigned for this parameter"); return; } CString message; - message.Format("Param %d can now be controlled with macro %X", paramToUse, macroToSet); - Reporting::Information(message, "Macro assigned for this param"); + message.Format("Parameter %02d can now be controlled with macro %X.", paramToUse, macroToSet); + Reporting::Information(message, "Macro assigned for this parameter"); return; } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -472,10 +472,7 @@ if(nParams) { - char sname[64]; - pVstPlugin->GetParamName(m_nCurrentParam, sname, sizeof(sname)); - wsprintf(s, "%02X: %s", m_nCurrentParam, sname); - m_CbnParam.SetItemData(m_CbnParam.AddString(s), m_nCurrentParam); + m_CbnParam.SetItemData(m_CbnParam.AddString(pVstPlugin->GetFormattedParamName(m_nCurrentParam)), m_nCurrentParam); } m_CbnParam.SetCurSel(0); @@ -970,10 +967,7 @@ if ((cursel >= 0) && (cursel < nParams)) m_nCurrentParam = cursel; if (m_nCurrentParam < nParams) { - CHAR sunits[64], sdisplay[64]; - pVstPlugin->GetParamLabel(m_nCurrentParam, sunits); - pVstPlugin->GetParamDisplay(m_nCurrentParam, sdisplay); - wsprintf(s, "Value: %s %s", sdisplay, sunits); + wsprintf(s, "Value: %s", pVstPlugin->GetFormattedParamValue(m_nCurrentParam)); SetDlgItemText(IDC_TEXT5, s); float fValue = pVstPlugin->GetParameter(m_nCurrentParam); int nValue = (int)(fValue * 100.0f + 0.5f); @@ -1535,9 +1529,7 @@ for(PlugParamIndex i = 0; i < nParams; i++) { - pVstPlugin->GetParamName(i, sname, sizeof(sname)); - wsprintf(s, "%02X: %s", i, sname); - m_CbnParam.SetItemData(m_CbnParam.AddString(s), i); + m_CbnParam.SetItemData(m_CbnParam.AddString(pVstPlugin->GetFormattedParamName(i)), i); } if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -5502,14 +5502,11 @@ HMENU paramChangeMenu = ::CreatePopupMenu(); AppendMenu(hMenu, MF_POPUP, (UINT)paramChangeMenu, "Change Plugin Parameter\t"); - char sname[64]; uint16 nThisParam = mSelStart->GetValueVolCol(); UINT nParams = plug->GetNumParameters(); for (UINT i = 0; i < nParams; i++) { - plug->GetParamName(i, sname, sizeof(sname)); - wsprintf(s, "%02d: %s", i, sname); - AppendMenu(paramChangeMenu, MF_STRING | (i == nThisParam) ? MF_CHECKED : 0, ID_CHANGE_PCNOTE_PARAM + i, s); + AppendMenu(paramChangeMenu, MF_STRING | (i == nThisParam) ? MF_CHECKED : 0, ID_CHANGE_PCNOTE_PARAM + i, plug->GetFormattedParamName(i)); } } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -688,8 +688,12 @@ case audioMasterAutomate: if (effect && effect->resvd1) { - CVstPlugin *pVstPlugin = ((CVstPlugin*)effect->resvd1); - pVstPlugin->AutomateParameter(index); + CVstPlugin *pVstPlugin = reinterpret_cast<CVstPlugin *>(effect->resvd1); + if(pVstPlugin->Dispatch(effCanBeAutomated, index, nullptr, nullptr, 0.0f) != 0) + { + // This parameter can be automated. Ugo Motion constantly sends automation callback events for parameters that cannot be automated... + pVstPlugin->AutomateParameter((PlugParamIndex)index); + } } return 0; // Called when plugin asks for VST version supported by host @@ -731,7 +735,7 @@ // <value> should contain a mask indicating which fields are required case audioMasterGetTime: { - CVstPlugin* pVstPlugin = (CVstPlugin*)effect->resvd1; + CVstPlugin* pVstPlugin = reinterpret_cast<CVstPlugin *>(effect->resvd1); MemsetZero(timeInfo); timeInfo.sampleRate = CMainFrame::GetMainFrame()->GetSampleRate(); @@ -802,7 +806,7 @@ //Screw it! Let's just return the tempo at this point in time (might be a bit wrong). if (effect->resvd1) { - CSoundFile *pSndFile = ((CVstPlugin*)effect->resvd1)->GetSoundFile(); + CSoundFile *pSndFile = reinterpret_cast<CVstPlugin *>(effect->resvd1)->GetSoundFile(); if (pSndFile) { return (VstInt32)(pSndFile->GetCurrentBPM() * 10000); @@ -825,7 +829,7 @@ case audioMasterNeedIdle: if (effect && effect->resvd1) { - CVstPlugin* pVstPlugin = (CVstPlugin*)effect->resvd1; + CVstPlugin* pVstPlugin = reinterpret_cast<CVstPlugin *>(effect->resvd1); pVstPlugin->m_bNeedIdle=true; } @@ -834,18 +838,18 @@ case audioMasterSizeWindow: if (effect->resvd1) { - CVstPlugin *pVstPlugin = ((CVstPlugin*)effect->resvd1); + CVstPlugin *pVstPlugin = reinterpret_cast<CVstPlugin *>(effect->resvd1); CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); if (pVstEditor) { - CRect rcWnd, rcClient; - pVstEditor->GetWindowRect(rcWnd); - pVstEditor->GetClientRect(rcClient); + CRect rcWnd, rcClient; + pVstEditor->GetWindowRect(rcWnd); + pVstEditor->GetClientRect(rcClient); - rcWnd.right = rcWnd.left + (rcWnd.right-rcWnd.left) - (rcClient.right-rcClient.left) + index; - rcWnd.bottom = rcWnd.top + (rcWnd.bottom-rcWnd.top) - (rcClient.bottom-rcClient.top) + value; + rcWnd.right = rcWnd.left + (rcWnd.Width()) - (rcClient.Width()) + index; + rcWnd.bottom = rcWnd.top + (rcWnd.Height()) - (rcClient.Height()) + value; - pVstEditor->SetWindowPos(NULL, rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), SWP_NOMOVE | SWP_NOZORDER); + pVstEditor->SetWindowPos(NULL, rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), SWP_NOMOVE | SWP_NOZORDER); } } Log("VST plugin to host: Size Window\n"); @@ -976,7 +980,7 @@ case audioMasterUpdateDisplay: if (effect && effect->resvd1) { -// CVstPlugin *pVstPlugin = ((CVstPlugin*)effect->resvd1); +// CVstPlugin *pVstPlugin = reinterpret_cast<CVstPlugin *>(effect->resvd1); // pVstPlugin->GetModDoc()->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); //No Need. /* CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); @@ -1334,7 +1338,7 @@ Dispatch(effOpen, 0, 0, NULL, 0); // VST 2.0 plugins return 2 here, VST 2.4 plugins return 2400... Great! - m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2) ? true : false; + m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2); if (m_bIsVst2) { // Set VST speaker in/out setup to Stereo. Required for some plugins (possibly all VST 2.4+ plugins?) @@ -1834,41 +1838,50 @@ } -void CVstPlugin::GetParamName(UINT nIndex, LPSTR pszName, UINT cbSize) -//-------------------------------------------------------------------- +// Helper function for retreiving parameter name / label / display +CString CVstPlugin::GetParamPropertyString(VstInt32 param, VstInt32 opcode) +//------------------------------------------------------------------------- { - if ((!pszName) || (!cbSize)) return; - pszName[0] = 0; - if ((m_pEffect) && (m_pEffect->numParams > 0) && (nIndex < (UINT)m_pEffect->numParams)) + CHAR s[max(kVstMaxParamStrLen, 64)]; // Increased to 64 bytes since 32 bytes doesn't seem to suffice for all plugs. Kind of ridiculous if you consider that kVstMaxParamStrLen = 8... + s[0] = '\0'; + + if(m_pEffect != nullptr && m_pEffect->numParams > 0 && param < m_pEffect->numParams) { - CHAR s[64]; // Increased to 64 bytes since 32 bytes doesn't seem to suffice for all plugs. Kind of ridiculous if you consider that kVstMaxParamStrLen = 8... - s[0] = 0; - Dispatch(effGetParamName, nIndex, 0, s, 0); - s[min(CountOf(s) - 1, cbSize - 1)] = 0; - lstrcpyn(pszName, s, min(cbSize, sizeof(s))); + Dispatch(opcode, param, 0, s, 0); + StringFixer::SetNullTerminator(s); } + return CString(s); } -void CVstPlugin::GetParamLabel(UINT nIndex, LPSTR pszLabel) -//--------------------------------------------------------- +CString CVstPlugin::GetFormattedParamName(PlugParamIndex param) +//------------------------------------------------------------- { - pszLabel[0] = 0; - if ((m_pEffect) && (m_pEffect->numParams > 0) && (nIndex < (UINT)m_pEffect->numParams)) + const CString paramName = GetParamName(param); + CString name; + if(paramName.IsEmpty()) { - Dispatch(effGetParamLabel, nIndex, 0, pszLabel, 0); + name.Format("Parameter %02d", param); + } else + { + name.Format("%02d: %s", param, paramName); } + return name; } -void CVstPlugin::GetParamDisplay(UINT nIndex, LPSTR pszDisplay) -//------------------------------------------------------------- +// Get a parameter's current value, represented by the plugin. +CString CVstPlugin::GetFormattedParamValue(PlugParamIndex param) +//-------------------------------------------------------------- { - pszDisplay[0] = 0; - if ((m_pEffect) && (m_pEffect->numParams > 0) && (nIndex < (UINT)m_pEffect->numParams)) - { - Dispatch(effGetParamDisplay, nIndex, 0, pszDisplay, 0); - } + + CString paramDisplay = GetParamDisplay(param); + CString paramUnits = GetParamLabel(param); + paramDisplay.Trim(); + paramUnits.Trim(); + paramDisplay += " " + paramUnits; + + return paramDisplay; } @@ -2671,6 +2684,12 @@ return; } + if (m_bRecordAutomation) + { + // Record parameter change + pModDoc->RecordParamChange(GetSlot(), param); + } + CAbstractVstEditor *pVstEditor = GetEditor(); if(pVstEditor && pVstEditor->m_hWnd) @@ -2680,33 +2699,24 @@ { CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } - } - // TODO: Could be used to update general tab in real time, but causes flickers in treeview - // Better idea: add an update hint just for plugin params? - //pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); + // TODO: Could be used to update general tab in real time, but causes flickers in treeview + // Better idea: add an update hint just for plugin params? + //pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); - if (m_bRecordAutomation) - { - // Record param change - pModDoc->RecordParamChange(GetSlot(), param); - } + if (CMainFrame::GetInputHandler()->ShiftPressed()) + { + // Shift pressed -> Open MIDI mapping dialog + CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once. - if (CMainFrame::GetInputHandler()->ShiftPressed() && pVstEditor && (pVstEditor->m_hWnd == ::GetForegroundWindow() || ::IsChild(pVstEditor->m_hWnd, ::GetForegroundWindow()))) - { - // Shift pressed -> Open MIDI mapping dialog - CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once. + const HWND oldMIDIRecondWnd = CMainFrame::GetMainFrame()->GetMidiRecordWnd(); + CMIDIMappingDialog dlg(pVstEditor, *pModDoc->GetSoundFile()); + dlg.m_Setting.SetParamIndex(param); + dlg.m_Setting.SetPlugIndex(GetSlot() + 1); + dlg.DoModal(); + CMainFrame::GetMainFrame()->SetMidiRecordWnd(oldMIDIRecondWnd); + } - const HWND oldMIDIRecondWnd = CMainFrame::GetMainFrame()->GetMidiRecordWnd(); - CMIDIMappingDialog dlg(pVstEditor, *pModDoc->GetSoundFile()); - dlg.m_Setting.SetParamIndex(param); - dlg.m_Setting.SetPlugIndex(GetSlot() + 1); - dlg.DoModal(); - CMainFrame::GetMainFrame()->SetMidiRecordWnd(oldMIDIRecondWnd); - } - - if(pVstEditor) - { // Learn macro int macroToLearn = pVstEditor->GetLearnMacro(); if (macroToLearn > -1) @@ -2715,7 +2725,6 @@ pVstEditor->SetLearnMacro(-1); } } - } @@ -3016,7 +3025,7 @@ bool CVstPlugin::isInstrument() // ericus 18/02/2005 //----------------------------- { - if(m_pEffect) return ((m_pEffect->flags & effFlagsIsSynth) || (!m_pEffect->numInputs)) ? true : false; // rewbs.dryRatio + if(m_pEffect) return ((m_pEffect->flags & effFlagsIsSynth) || (!m_pEffect->numInputs)); // rewbs.dryRatio return false; } @@ -3024,7 +3033,7 @@ //------------------------------------- { CString s = "receiveVstMidiEvent"; - return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0)) ? true : false; + return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0) != 0); } void CVstPlugin::GetOutputPlugList(CArray<CVstPlugin*, CVstPlugin*> &list) @@ -3040,7 +3049,7 @@ UINT nOutput = m_pMixStruct->Info.dwOutputRouting & 0x7f; if (m_pSndFile && (nOutput > m_nSlot) && (nOutput < MAX_MIXPLUGINS)) { - pOutputPlug = (CVstPlugin*) m_pSndFile->m_MixPlugins[nOutput].pMixPlugin; + pOutputPlug = reinterpret_cast<CVstPlugin *>(m_pSndFile->m_MixPlugins[nOutput].pMixPlugin); } } list.Add(pOutputPlug); @@ -3059,7 +3068,7 @@ for (int nPlug=0; nPlug<MAX_MIXPLUGINS; nPlug++) { - pCandidatePlug = (CVstPlugin*) m_pSndFile->m_MixPlugins[nPlug].pMixPlugin; + pCandidatePlug = reinterpret_cast<CVstPlugin *>(m_pSndFile->m_MixPlugins[nPlug].pMixPlugin); if (pCandidatePlug) { pCandidatePlug->GetOutputPlugList(candidatePlugOutputs); @@ -4050,10 +4059,7 @@ { if(pMixPlugin) { - char s[64]; - ((CVstPlugin*)(pMixPlugin))->GetParamName(index, s, sizeof(s)); - s[sizeof(s)-1] = 0; - return CString(s); + return reinterpret_cast<CVstPlugin *>(pMixPlugin)->GetParamName(index); } else return CString(); Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-10-20 21:20:23 UTC (rev 1110) @@ -134,18 +134,15 @@ void GetEditorPos(int &x, int &y) const { x = m_nEditorX; y = m_nEditorY; } void SetCurrentProgram(UINT nIndex); -//rewbs.VSTCompliance: Eric's non standard preset stuff: -// -> CODE#0002 -// -> DESC="VST plugins presets" - //VOID GetProgramName(UINT nIndex, LPSTR pszName, UINT cbSize); - //BOOL SavePreset(LPCSTR lpszFileName); - //BOOL LoadPreset(LPCSTR lpszFileName); -// -! NEW_FEATURE#0002 PlugParamValue GetParameter(PlugParamIndex nIndex); void SetParameter(PlugParamIndex nIndex, PlugParamValue fValue); - void GetParamName(UINT nIndex, LPSTR pszName, UINT cbSize); - void GetParamLabel(UINT nIndex, LPSTR pszLabel); - void GetParamDisplay(UINT nIndex, LPSTR pszDisplay); + + CString GetFormattedParamName(PlugParamIndex param); + CString GetFormattedParamValue(PlugParamIndex param); + CString GetParamName(PlugParamIndex param) { return GetParamPropertyString(param, effGetParamName); }; + CString GetParamLabel(PlugParamIndex param) { return GetParamPropertyString(param, effGetParamLabel); }; + CString GetParamDisplay(PlugParamIndex param) { return GetParamPropertyString(param, effGetParamDisplay); }; + VstIntPtr Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); void ToggleEditor(); void GetPluginType(LPSTR pszType); @@ -205,20 +202,27 @@ private: short getMIDI14bitValueFromShort(short value); void MidiPitchBend(UINT nMidiCh, short pitchBendPos); + + // Helper function for retreiving parameter name / label / display + CString GetParamPropertyString(VstInt32 param, VstInt32 opcode); + #else // case: NO_VST public: PlugParamIndex GetNumParameters() {return 0;} - void GetParamName(UINT, LPSTR, UINT) {} void ToggleEditor() {} BOOL HasEditor() {return FALSE;} UINT GetNumCommands() {return 0;} void GetPluginType(LPSTR) {} PlugParamIndex GetNumPrograms() {return 0;} - bool GetProgramNameIndexed(long, long, char*) {return false;} - CString GetFormattedProgramName(VstInt32 index, bool allowFallback = false) { return ""; }; - void SetParameter(PlugParamIndex nIndex, PlugParamValue fValue) {} - void GetParamLabel(UINT, LPSTR) {} - void GetParamDisplay(UINT, LPSTR) {} + bool GetProgramNameIndexed(long, long, char*) { return false; } + CString GetFormattedProgramName(VstInt32, bool = false) { return ""; }; + void SetParameter(PlugParamIndex, PlugParamValue) {} + + CString GetFormattedParamName(PlugParamIndex) { return ""; }; + CString GetParamName(PlugParamIndex) { return ""; }; + CString GetParamLabel(PlugParamIndex) { return ""; }; + CString GetParamDisplay(PlugParamIndex) { return ""; }; + PlugParamValue GetParameter(PlugParamIndex nIndex) {return 0;} bool LoadProgram(CString) {return false;} bool SaveProgram(CString) {return false;} Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-20 00:11:31 UTC (rev 1109) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-20 21:20:23 UTC (rev 1110) @@ -1073,11 +1073,10 @@ if (!m_pSndFile) return; - CString message, plugName, paramName, line; + CString message, plugName, line; int sfx = id-ID_PLUGSELECT; int param = m_pModDoc->MacroToPlugParam(m_MidiCfg.szMidiSFXExt[sfx]); CVstPlugin *pVstPlugin; - char s[256]; message.Format("These are the parameters that can be controlled by macro SF%X:\n\n",sfx); for (UINT plug=0; plug<MAX_MIXPLUGINS; plug++) @@ -1086,11 +1085,9 @@ if (plugName != "") { pVstPlugin=(CVstPlugin*) m_pSndFile->m_MixPlugins[plug].pMixPlugin; - if (pVstPlugin && pVstPlugin->GetNumParameters()>param) + if (pVstPlugin && param <= pVstPlugin->GetNumParameters()) { - pVstPlugin->GetParamName(param, s, 256); - paramName = s; - line.Format("FX%d: %s\t Param %d (%x): %s\n", plug + 1, plugName, param, param+80, paramName); + line.Format("FX%d: %s\t %s\n", plug + 1, plugName, pVstPlugin->GetFormattedParamName(param)); message += line; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |