18 #ifndef __PONGASOFT_VST_GUI_PARAM_CX_MGR_H__ 19 #define __PONGASOFT_VST_GUI_PARAM_CX_MGR_H__ 22 #include <unordered_map> 82 return __registerVstParam<T>(iParamID, iChangeListener);
117 bool iInvokeCallback)
132 bool iInvokeCallback);
144 DCHECK_F(iChangeListener !=
nullptr);
157 bool iInvokeCallback)
159 DCHECK_F((
bool) iChangeCallback);
172 bool iInvokeCallback)
174 DCHECK_F((
bool) iChangeCallback);
175 auto callback = [&iParamDef, cb2 = std::move(iChangeCallback)] () { cb2(iParamDef); };
189 return __registerJmbParam<T>(iParamID, iChangeListener);
200 bool iInvokeCallback)
224 template<
typename Listener>
228 template<
typename Listener>
232 template<
typename T,
typename Listener>
236 template<
typename T,
typename Listener>
240 template<
typename T,
typename Listener>
244 template<
typename TParam>
247 if(iInvokeCallback && iParam.exists() && iCallback)
249 return std::forward<TParam>(iParam);
257 std::unordered_map<ParamID, std::unique_ptr<FObjectCx>>
fParamCxs;
263 template<
typename Listener>
270 DLOG_F(WARNING,
"vst param [%d] not found", iParamID);
276 fParamCxs[iParamID] = param->connect(iListener);
289 template<
typename Listener>
306 template<
typename T,
typename Listener>
312 return GUIVstParam<T>{std::make_unique<GUIVstParameter<T>>(std::move(param), iParamDef)};
320 template<
typename T,
typename Listener>
329 fParamCxs[iParamID] = param->connect(iListener);
341 template<
typename T,
typename Listener>
348 DLOG_F(WARNING,
"jmb param [%d] not found", iParamID);
356 fParamCxs[iParamID] = std::move(res->connect(iListener));
362 DLOG_F(WARNING,
"jmb param [%d] is not of the requested type", iParamID);
375 bool iInvokeCallback)
377 auto paramID = iParamDef->fParamID;
389 auto ptr = std::make_shared<GUIVstParam<T>>(std::move(param));
391 auto callback = [ptr, cb1 = std::move(iChangeCallback)] () {
395 fParamCxs[paramID] = ptr->connect(callback);
413 #endif //__PONGASOFT_VST_GUI_PARAM_CX_MGR_H__ std::shared_ptr< VstParamDef< T > > VstParam
Definition: ParamDef.h:358
Definition: GUIState.h:39
Definition: GUIRawVstParameter.h:211
GUIRawVstParam __registerRawVstParam(ParamID iParamID, Listener iListener)
Definition: GUIParamCxMgr.h:290
GUIState * fGUIState
Definition: GUIParamCxMgr.h:254
IGUIJmbParameter * getJmbParameter(ParamID iParamID) const
Definition: GUIState.cpp:188
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener)
Definition: GUIJmbParameter.h:293
GUIRawVstParam registerRawVstCallback(ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:65
GUIVstParam< T > registerVstParam(ParamID iParamID, Parameters::IChangeListener *iChangeListener=nullptr)
Definition: GUIParamCxMgr.h:79
std::unique_ptr< GUIRawVstParameter > __registerRawVstParameter(ParamID iParamID, Listener iListener)
Definition: GUIParamCxMgr.h:264
bool existsJmb(ParamID iParamID) const
Definition: GUIState.h:66
GUIJmbParam< T > registerJmbParam(ParamID iParamID, Parameters::IChangeListener *iChangeListener=nullptr)
Definition: GUIParamCxMgr.h:186
GUIJmbParam< T > registerJmbCallback(GUIJmbParam< T > &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:155
Definition: GUIVstParameter.h:233
std::unique_ptr< GUIRawVstParameter > getRawVstParameter(ParamID iParamID) const
Definition: GUIState.h:71
std::unordered_map< ParamID, std::unique_ptr< FObjectCx > > fParamCxs
Definition: GUIParamCxMgr.h:257
TParam && maybeInvokeCallback(TParam &&iParam, Parameters::ChangeCallback &iCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:245
GUIState * getGUIState() const
Definition: GUIParamCxMgr.h:208
std::unique_ptr< GUIVstParameter< T > > getGUIVstParameter(ParamID iParamID) const
Definition: GUIState.h:311
void unregisterAll()
Definition: GUIParamCxMgr.cpp:47
GUIRawVstParam registerRawVstParam(ParamID iParamID, Parameters::IChangeListener *iChangeListener=nullptr)
Definition: GUIParamCxMgr.h:56
Definition: GUIJmbParameter.h:230
bool existsJmb(ParamID iParamID) const
Definition: GUIParamCxMgr.h:40
void invokeAll()
Definition: GUIParamCxMgr.cpp:28
Definition: GUIJmbParameter.h:86
GUIVstParam< T > __registerVstParam(ParamID iParamID, Listener iListener)
Definition: GUIParamCxMgr.h:321
ParamID getParamID() const
Definition: GUIJmbParameter.h:241
std::function< void()> ChangeCallback
Definition: Parameters.h:57
bool existsVst(ParamID iParamID) const
Definition: GUIState.h:61
GUIJmbParam< T > registerJmbParam(GUIJmbParam< T > &iParamDef, Parameters::IChangeListener *iChangeListener)
Definition: GUIParamCxMgr.h:142
bool existsVst(ParamID iParamID) const
Definition: GUIParamCxMgr.h:35
Definition: GUIParamCxMgr.h:29
GUIVstParam< T > registerVstCallback(VstParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:115
GUIVstParam< T > registerVstCallback(ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:90
bool unregisterParam(ParamID iParamID)
Definition: GUIParamCxMgr.cpp:39
std::function< void(Param &)> ChangeCallback1
Definition: Parameters.h:63
void registerJmbCallback(GUIJmbParam< T > &iParamDef, Parameters::ChangeCallback1< GUIJmbParam< T >> iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:170
GUIVstParam< T > registerVstParam(VstParam< T > const &iParamDef, Parameters::IChangeListener *iChangeListener=nullptr)
Definition: GUIParamCxMgr.h:104
GUIParamCxMgr(GUIState *iGUIState)
Definition: GUIParamCxMgr.h:217
GUIJmbParam< T > registerJmbCallback(ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
Definition: GUIParamCxMgr.h:198
Definition: Parameters.h:45
GUIJmbParam< T > __registerJmbParam(ParamID iParamID, Listener iListener)
Definition: GUIParamCxMgr.h:342