32 namespace Debug {
class ParamDisplay; }
35 using namespace Params;
65 inline bool existsVst(ParamID iParamID)
const {
return fVstParameters && fVstParameters->exists(iParamID); }
70 inline bool existsJmb(ParamID iParamID)
const {
return fJmbParams.find(iParamID) != fJmbParams.cend()
72 fPluginParameters.getJmbParamDef(iParamID) !=
nullptr; }
78 std::shared_ptr<IGUIParameter> findParam(ParamID iParamID)
const;
85 if(existsVst(iParamID))
86 return std::make_shared<GUIRawVstParameter>(iParamID,
88 fPluginParameters.getRawVstParamDef(iParamID));
96 return fPluginParameters.getRawVstParamDef(iParamID);
101 std::shared_ptr<GUIVstParameter<T>> getGUIVstParameter(ParamID iParamID)
const;
106 return iParamDef ? getGUIVstParameter<T>(iParamDef->fParamID) :
nullptr;
117 auto ptr = findParam(iParamID);
119 return ptr->connect(iChangeListener);
132 auto ptr = findParam(iParamID);
134 return ptr->connect(iChangeCallback);
156 template<
typename TView>
158 return fParamAwareViews.makeParamAware(iView,
this);
163 template<
typename TView>
164 [[deprecated(
"Since 4.0.0 - Use makeParamAware instead")]]
166 return makeParamAware<TView>(iView,
this);
172 std::shared_ptr<IGUIJmbParameter> getJmbParameter(ParamID iParamID)
const;
178 virtual tresult readRTState(IBStreamer &iStreamer);
184 virtual tresult readGUIState(IBStreamer &iStreamer);
190 virtual tresult writeGUIState(IBStreamer &oStreamer)
const;
196 std::unique_ptr<GUIParamCxMgr> createParamCxMgr();
207 tresult broadcast(
JmbParam<T> const &iParamDef, T
const &iMessage);
227 bool showDialog(std::string iTemplateName)
override;
231 bool dismissDialog()
override;
256 std::map<ParamID, std::shared_ptr<IGUIJmbParameter>> fJmbParams{};
259 std::vector<ParamID> fAllRegistrationOrder{};
266 void addJmbParam(std::shared_ptr<IGUIJmbParameter> iParameter);
269 IPtr<IMessage> allocateMessage()
override;
272 tresult sendMessage(IPtr<IMessage> iMessage)
override;
274 virtual tresult readDeprecatedGUIState(uint16 iDeprecatedVersion,
275 IBStreamer &iStreamer,
287 template<
typename TPluginParameters>
291 static_assert(std::is_convertible<TPluginParameters*, Parameters*>::value,
"TPluginParameters must be a subclass of Parameters");
299 fParams{iPluginParameters}
312 auto guiParam = iParamDef->newGUIParam();
313 addJmbParam(guiParam);
323 if(!iParamDef->fShared)
325 DLOG_F(WARNING,
"broadcast ignored: parameter [%d] is not marked shared", iParamDef->fParamID);
329 tresult res = kResultOk;
331 auto message = allocateMessage();
341 if(iParamDef->writeToMessage(iMessage, m) == kResultOk)
342 res |= sendMessage(message);
358 std::shared_ptr<GUIRawVstParameter> param = getRawVstParameter(iParamID);
362 DLOG_F(WARNING,
"vst param [%d] not found", iParamID);
366 auto res = param->asVstParameter<T>();
372 DLOG_F(WARNING,
"vst param [%d] is not of the requested type", iParamID);
394 auto ptr = std::dynamic_pointer_cast<
JmbParamDef<T>>(IParamDef::shared_from_this());
395 return VstUtils::make_sfo<GUI::Params::GUIJmbParameter<T>>(ptr);
virtual tresult handleGUIStateUpgrade(int16 iDeprecatedVersion, int16 iVersion) const
When Jamba detects that a previously saved GUI state matches a deprecated version (as registered with...
Definition: GUIState.h:223
bool existsJmb(ParamID iParamID) const
Definition: GUIState.h:70
This is the class which maintains all the registered parameters.
Definition: Parameters.h:37
std::vector< ParamID > const & getAllRegistrationOrder() const
Definition: GUIState.h:210
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter(VstParam< T > iParamDef) const
Definition: GUIState.h:105
Definition: GUIState.h:41
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:44
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition: Parameters.h:55
Maintains the order used to save/restore the RT and GUI state.
Definition: NormalizedState.h:43
bool existsVst(ParamID iParamID) const
Definition: GUIState.h:65
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter(ParamID iParamID) const
Definition: GUIState.h:356
Parameters const & getPluginParameters() const
Definition: GUIState.h:54
Used to communicate the state between the UI and the RT and read/write to stream.
Definition: NormalizedState.h:37
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:157
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: GUIJmbParameter.h:495
void setMessageID(MessageID messageID)
Definition: Messaging.h:54
std::shared_ptr< GUIRawVstParameter > getRawVstParameter(ParamID iParamID) const
Definition: GUIState.h:83
ParamAwareView< TView > * registerConnectionFor(TView *iView)
Definition: GUIState.h:165
tresult broadcast(JmbParam< T > const &iParamDef, T const &iMessage)
Broadcast a message without requiring the need to instantiate a GUIJmbParam.
Definition: GUIState.h:321
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:86
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:288
Parameters const & fPluginParameters
Definition: GUIState.h:238
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:294
std::shared_ptr< VstParamDef< T > > VstParam
Definition: ParamDef.h:507
tresult handleMessage(Message const &iMessage)
Handle an incoming message => will forward to JmbParam marked shared by rtOwner.
Definition: GUIState.h:201
std::unique_ptr< FObjectCx > connect(ParamID iParamID, Parameters::ChangeCallback iChangeCallback) const
Connects the paramID to the callback.
Definition: GUIState.h:130
Maintains the connections established between parameters and its listeners/callbacks.
Definition: GUIParamCxMgr.h:31
GUIPluginState(PluginParameters const &iPluginParameters)
Definition: GUIState.h:297
std::unique_ptr< FObjectCx > connect(ParamID iParamID, Parameters::IChangeListener *iChangeListener) const
Connects the paramID to the listener.
Definition: GUIState.h:115
PluginParameters const & fParams
Definition: GUIState.h:303
std::shared_ptr< VstParameters > VstParametersSPtr
Definition: VstParameters.h:95
Base class for all non vst parameters (need to provide serialization/deserialization)
Definition: ParamDef.h:316
std::shared_ptr< JmbParamDef< T > > JmbParam
Definition: ParamDef.h:514
Defines the interface to show or dismiss a modal/dialog window which is a window that captures all ev...
Definition: IDialogHandler.h:45
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
std::shared_ptr< RawVstParamDef > getRawVstParamDef(ParamID iParamID) const
Definition: GUIState.h:94
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:310