31 namespace Debug {
class ParamDisplay; }
34 using namespace Params;
62 inline bool existsVst(ParamID iParamID)
const {
return fVstParameters && fVstParameters->exists(iParamID); }
67 inline bool existsJmb(ParamID iParamID)
const {
return fJmbParams.find(iParamID) != fJmbParams.cend()
69 fPluginParameters.getJmbParamDef(iParamID) !=
nullptr; }
75 std::shared_ptr<IGUIParameter> findParam(ParamID iParamID)
const;
82 if(existsVst(iParamID))
83 return std::make_shared<GUIRawVstParameter>(iParamID,
85 fPluginParameters.getRawVstParamDef(iParamID));
93 return fPluginParameters.getRawVstParamDef(iParamID);
98 std::shared_ptr<GUIVstParameter<T>> getGUIVstParameter(ParamID iParamID)
const;
103 return iParamDef ? getGUIVstParameter<T>(iParamDef->fParamID) :
nullptr;
114 auto ptr = findParam(iParamID);
116 return ptr->connect(iChangeListener);
129 auto ptr = findParam(iParamID);
131 return ptr->connect(iChangeCallback);
153 template<
typename TView>
155 return fParamAwareViews.makeParamAware(iView,
this);
160 template<
typename TView>
161 [[deprecated(
"Since 4.0.0 - Use makeParamAware instead")]]
163 return makeParamAware<TView>(iView,
this);
169 std::shared_ptr<IGUIJmbParameter> getJmbParameter(ParamID iParamID)
const;
175 virtual tresult readRTState(IBStreamer &iStreamer);
181 virtual tresult readGUIState(IBStreamer &iStreamer);
187 virtual tresult writeGUIState(IBStreamer &oStreamer)
const;
193 std::unique_ptr<GUIParamCxMgr> createParamCxMgr();
204 tresult broadcast(
JmbParam<T> const &iParamDef, T
const &iMessage);
229 std::map<ParamID, std::shared_ptr<IGUIJmbParameter>> fJmbParams{};
232 std::vector<ParamID> fAllRegistrationOrder{};
239 void addJmbParam(std::shared_ptr<IGUIJmbParameter> iParameter);
242 IPtr<IMessage> allocateMessage()
override;
245 tresult sendMessage(IPtr<IMessage> iMessage)
override;
253 template<
typename TPluginParameters>
262 fParams{iPluginParameters}
275 auto guiParam = iParamDef->newGUIParam();
276 addJmbParam(guiParam);
286 if(!iParamDef->fShared)
288 DLOG_F(WARNING,
"broadcast ignored: parameter [%d] is not marked shared", iParamDef->fParamID);
292 tresult res = kResultOk;
294 auto message = allocateMessage();
304 if(iParamDef->writeToMessage(iMessage, m) == kResultOk)
305 res |= sendMessage(message);
321 std::shared_ptr<GUIRawVstParameter> param = getRawVstParameter(iParamID);
325 DLOG_F(WARNING,
"vst param [%d] not found", iParamID);
329 auto res = param->asVstParameter<T>();
335 DLOG_F(WARNING,
"vst param [%d] is not of the requested type", iParamID);
357 auto ptr = std::dynamic_pointer_cast<
JmbParamDef<T>>(IParamDef::shared_from_this());
358 return VstUtils::make_sfo<GUI::Params::GUIJmbParameter<T>>(ptr);
bool existsJmb(ParamID iParamID) const
Definition: GUIState.h:67
This is the class which maintains all the registered parameters.
Definition: Parameters.h:37
std::vector< ParamID > const & getAllRegistrationOrder() const
Definition: GUIState.h:207
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter(VstParam< T > iParamDef) const
Definition: GUIState.h:102
Definition: GUIState.h:40
Abstraction for allocating and sending a message.
Definition: MessageProducer.h:33
This helper class is used to display the parameters (vst/jmb) WARNING: this class is allocating memor...
Definition: ParamDisplay.h:33
Simple wrapper class with better api.
Definition: Messaging.h:42
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition: Parameters.h:55
bool existsVst(ParamID iParamID) const
Definition: GUIState.h:62
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter(ParamID iParamID) const
Definition: GUIState.h:319
Parameters const & getPluginParameters() const
Definition: GUIState.h:51
Used to communicate the state between the UI and the RT and read/write to stream.
Definition: NormalizedState.h:38
ParamAwareView< TView > * makeParamAware(TView *iView)
Allow for registering an arbitrary callback on an arbitrary view without having to inherit from the v...
Definition: GUIState.h:154
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: GUIJmbParameter.h:488
void setMessageID(MessageID messageID)
Definition: Messaging.h:52
std::shared_ptr< GUIRawVstParameter > getRawVstParameter(ParamID iParamID) const
Definition: GUIState.h:80
ParamAwareView< TView > * registerConnectionFor(TView *iView)
Definition: GUIState.h:162
tresult broadcast(JmbParam< T > const &iParamDef, T const &iMessage)
Broadcast a message without requiring the need to instantiate a GUIJmbParam.
Definition: GUIState.h:284
This class manages the views that have been made "param aware".
Definition: ParamAwareViews.h:86
This is the templated version providing serializer methods, very similar to the GUIVstParameter conce...
Definition: GUIJmbParameter.h:85
Simple implementation of IMessageHandler which will delegate the message handling based on MessageID.
Definition: MessageHandler.h:39
Simple templated extension to expose the plugin parameters as its real type.
Definition: GUIState.h:254
Parameters const & fPluginParameters
Definition: GUIState.h:214
This subclass allows for registering callbacks to any kind of view without having to inherit from it.
Definition: ParamAware.h:561
TPluginParameters PluginParameters
Definition: GUIState.h:257
std::shared_ptr< VstParamDef< T > > VstParam
Definition: ParamDef.h:443
tresult handleMessage(Message const &iMessage)
Handle an incoming message => will forward to JmbParam marked shared by rtOwner.
Definition: GUIState.h:198
std::unique_ptr< FObjectCx > connect(ParamID iParamID, Parameters::ChangeCallback iChangeCallback) const
Connects the paramID to the callback.
Definition: GUIState.h:127
Maintains the connections established between parameters and its listeners/callbacks.
Definition: GUIParamCxMgr.h:31
GUIPluginState(PluginParameters const &iPluginParameters)
Definition: GUIState.h:260
std::unique_ptr< FObjectCx > connect(ParamID iParamID, Parameters::IChangeListener *iChangeListener) const
Connects the paramID to the listener.
Definition: GUIState.h:112
PluginParameters const & fParams
Definition: GUIState.h:266
std::shared_ptr< VstParameters > VstParametersSPtr
Definition: VstParameters.h:95
Base class for all non vst parameters (need to provide serialization/deserialization)
Definition: ParamDef.h:273
std::shared_ptr< JmbParamDef< T > > JmbParam
Definition: ParamDef.h:450
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
std::shared_ptr< RawVstParamDef > getRawVstParamDef(ParamID iParamID) const
Definition: GUIState.h:91
GUIJmbParam< T > add(JmbParam< T > iParamDef)
This method is called for each parameter managed by the GUIState that is not a regular VST parameter.
Definition: GUIState.h:273