iPlug2 - C++ Audio Plug-in Framework
|
An editor delegate base class that uses IGraphics for the UI. More...
#include <IGraphicsEditorDelegate.h>
Public Member Functions | |
IGEditorDelegate (int nParams) | |
IGEditorDelegate (const IGEditorDelegate &)=delete | |
IGEditorDelegate & | operator= (const IGEditorDelegate &)=delete |
void * | OpenWindow (void *pHandle) final |
If you are not using IGraphics, you can implement this method to attach to the native parent view e.g. More... | |
void | CloseWindow () final |
If you are not using IGraphics you can if you need to free resources etc when the window closes. More... | |
void | SetScreenScale (float scale) final |
Can be used by a host API to inform the editor of screen scale changes. More... | |
void | OnParentWindowResize (int width, int height) override |
Called by app wrappers when the OS window scaling buttons/resizers are used. More... | |
bool | OnKeyDown (const IKeyPress &key) override |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API, rather than the view. More... | |
bool | OnKeyUp (const IKeyPress &key) override |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API rather than the view. More... | |
bool | SerializeEditorState (IByteChunk &chunk) const override |
Serializes the editor state (such as scale) into a binary chunk. More... | |
int | UnserializeEditorState (const IByteChunk &chunk, int startPos) override |
Unserializes editor state (such as scale). More... | |
void | SendControlValueFromDelegate (int ctrlTag, double normalizedValue) override |
SendControlValueFromDelegate (Abbreviation: SCVFD) WARNING: should not be called on the realtime audio thread. More... | |
void | SendControlMsgFromDelegate (int ctrlTag, int msgTag, int dataSize=0, const void *pData=nullptr) override |
SendControlMsgFromDelegate (Abbreviation: SCMFD) WARNING: should not be called on the realtime audio thread. More... | |
void | SendMidiMsgFromDelegate (const IMidiMsg &msg) override |
SendMidiMsgFromDelegate (Abbreviation: SMMFD) WARNING: should not be called on the realtime audio thread. More... | |
void | SendParameterValueFromDelegate (int paramIdx, double value, bool normalized) override |
SendParameterValueFromDelegate (Abbreviation: SPVFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual IGraphics * | CreateGraphics () |
Called to create the IGraphics instance for this editor. More... | |
virtual void | LayoutUI (IGraphics *pGraphics) |
Called to layout controls when the GUI is initially opened and again if the UI size changes. More... | |
IGraphics * | GetUI () |
Get a pointer to the IGraphics context. More... | |
const IGraphics * | GetUI () const |
Get a const pointer to the IGraphics context. More... | |
bool | SerializeEditorSize (IByteChunk &data) const |
Serializes the size and scale of the IGraphics. More... | |
int | UnserializeEditorSize (const IByteChunk &chunk, int startPos) |
Unserializes the size and scale of the IGraphics. More... | |
![]() | |
IEditorDelegate (int nParams) | |
IEditorDelegate (const IEditorDelegate &)=delete | |
IEditorDelegate & | operator= (const IEditorDelegate &)=delete |
IParam * | AddParam () |
Adds an IParam to the parameters ptr list Note: This is only used in special circumstances, since most plug-in formats don't support dynamic parameters. More... | |
void | RemoveParam (int idx) |
Remove an IParam at a particular index Note: This is only used in special circumstances, since most plug-in formats don't support dynamic parameters. More... | |
IParam * | GetParam (int paramIdx) |
Get a pointer to one of the delegate's IParam objects. More... | |
const IParam * | GetParam (int paramIdx) const |
Get a const pointer to one of the delegate's IParam objects (for const methods) More... | |
int | NParams () const |
virtual void * | OpenWindow (void *pParent) |
If you are not using IGraphics, you can implement this method to attach to the native parent view e.g. More... | |
virtual void | CloseWindow () |
If you are not using IGraphics you can if you need to free resources etc when the window closes. More... | |
virtual void | OnParentWindowResize (int width, int height) |
Called by app wrappers when the OS window scaling buttons/resizers are used. More... | |
virtual void | OnUIOpen () |
Override this method to do something before the UI is opened. More... | |
virtual void | OnUIClose () |
Override this method to do something before the UI is closed. More... | |
virtual void | OnParamChange (int paramIdx, EParamSource source, int sampleOffset=-1) |
Override this method to do something to your DSP when a parameter changes. More... | |
virtual void | OnParamChange (int paramIdx) |
Another version of the OnParamChange method without an EParamSource, for backwards compatibility / simplicity. More... | |
virtual void | OnParamChangeUI (int paramIdx, EParamSource source=kUnknown) |
Override this method to do something when a parameter changes on the main/UI thread Like OnParamChange, OnParamChangeUI will be called when a parameter changes. More... | |
virtual void | OnParamReset (EParamSource source) |
Called when parameters have changed to inform the plugin of the changes Override only if you need to handle notifications and updates in a specialist manner (e.g. More... | |
virtual void | OnMidiMsgUI (const IMidiMsg &msg) |
Handle incoming MIDI messages sent to the user interface. More... | |
virtual void | OnSysexMsgUI (const ISysEx &msg) |
Handle incoming SysEx messages sent to the user interface. More... | |
virtual bool | OnMessage (int msgTag, int ctrlTag, int dataSize, const void *pData) |
This could be implemented in either DSP or EDITOR to receive a message from the other one. More... | |
virtual void | OnRestoreState () |
This is called by API classes after restoring state and by IPluginBase::RestorePreset(). More... | |
virtual bool | OnKeyDown (const IKeyPress &key) |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API, rather than the view. More... | |
virtual bool | OnKeyUp (const IKeyPress &key) |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API rather than the view. More... | |
void | SendCurrentParamValuesFromDelegate () |
Loops through all parameters, calling SendParameterValueFromDelegate() with the current value of the parameter This is important when modifying groups of parameters, restoring state and opening the UI, in order to update it with the latest values. More... | |
virtual void | SendControlValueFromDelegate (int ctrlTag, double normalizedValue) |
SendControlValueFromDelegate (Abbreviation: SCVFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | SendControlMsgFromDelegate (int ctrlTag, int msgTag, int dataSize=0, const void *pData=nullptr) |
SendControlMsgFromDelegate (Abbreviation: SCMFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | SendArbitraryMsgFromDelegate (int msgTag, int dataSize=0, const void *pData=nullptr) |
SendArbitraryMsgFromDelegate (Abbreviation: SAMFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | SendMidiMsgFromDelegate (const IMidiMsg &msg) |
SendMidiMsgFromDelegate (Abbreviation: SMMFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | SendSysexMsgFromDelegate (const ISysEx &msg) |
SendSysexMsgFromDelegate (Abbreviation: SSMFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | SendParameterValueFromDelegate (int paramIdx, double value, bool normalized) |
SendParameterValueFromDelegate (Abbreviation: SPVFD) WARNING: should not be called on the realtime audio thread. More... | |
virtual void | DirtyParametersFromUI () |
When modifying a range of parameters in the editor, it can be necessary to broadcast that fact via the host, for instance in a distributed plug-in. More... | |
virtual void | BeginInformHostOfParamChangeFromUI (int paramIdx)=0 |
Called by the UI at the beginning of a parameter change gesture, in order to notify the host (via a call in the API class) that the parameter is going to be modified The host may be trying to automate the parameter as well, so it needs to relinquish control when the user is modifying something in the user interface. More... | |
virtual void | SendParameterValueFromUI (int paramIdx, double normalizedValue) |
SPVFUI Called by the UI during a parameter change gesture, in order to notify the host of the new value (via a call in the API class) If you override this method you should call the base class implementation to make sure OnParamChangeUI gets triggered. More... | |
virtual void | EndInformHostOfParamChangeFromUI (int paramIdx)=0 |
Called by the user interface at the end of a parameter change gesture, in order to notify the host (via a call in the API class) that the parameter is no longer being modified The host may be trying to automate the parameter as well, so it needs to relinquish control when the user is modifying something in the user interface. More... | |
virtual bool | EditorResizeFromUI (int viewWidth, int viewHeight, bool needsPlatformResize) |
If the editor changes UI dimensions, e.g. More... | |
virtual void | SendMidiMsgFromUI (const IMidiMsg &msg) |
SendMidiMsgFromUI (Abbreviation: SMMFUI) This method should be used when sending a MIDI message from the UI. More... | |
virtual void | SendSysexMsgFromUI (const ISysEx &msg) |
SendMidiMsgFromUI (Abbreviation: SSMFUI) If a plug-in can send Sysex data as a result of actions in the user interface, this method can be used. More... | |
virtual void | SendArbitraryMsgFromUI (int msgTag, int ctrlTag=kNoTag, int dataSize=0, const void *pData=nullptr) |
SendArbitraryMsgFromUI (Abbreviation: SAMFUI) More... | |
virtual void | DeferMidiMsg (const IMidiMsg &msg) |
This method is needed, for remote editors to avoid a feedback loop. More... | |
virtual void | DeferSysexMsg (const ISysEx &msg) |
This method is needed, for remote editors to avoid a feedback loop. More... | |
void | SetEditorSize (int width, int height) |
void | SetSizeConstraints (int widthLo, int widthHi, int heightLo, int heightHi) |
int | GetEditorWidth () const |
int | GetEditorHeight () const |
int | GetMinWidth () const |
int | GetMaxWidth () const |
int | GetMinHeight () const |
int | GetMaxHeight () const |
virtual bool | ConstrainEditorResize (int &w, int &h) const |
Constrain the incoming editor width and height values based on the minimum and maximum. More... | |
virtual bool | SerializeEditorState (IByteChunk &chunk) const |
Serializes the editor state (such as scale) into a binary chunk. More... | |
virtual int | UnserializeEditorState (const IByteChunk &chunk, int startPos) |
Unserializes editor state (such as scale). More... | |
virtual void | SetScreenScale (float scale) |
Can be used by a host API to inform the editor of screen scale changes. More... | |
Protected Attributes | |
std::function< IGraphics *()> | mMakeGraphicsFunc = nullptr |
std::function< void(IGraphics *pGraphics)> | mLayoutFunc = nullptr |
Friends | |
class | IGraphics |
An editor delegate base class that uses IGraphics for the UI.
Definition at line 30 of file IGraphicsEditorDelegate.h.
IGEditorDelegate::IGEditorDelegate | ( | int | nParams | ) |
Definition at line 18 of file IGraphicsEditorDelegate.cpp.
IGEditorDelegate::~IGEditorDelegate | ( | ) |
Definition at line 23 of file IGraphicsEditorDelegate.cpp.
|
finalvirtual |
If you are not using IGraphics you can if you need to free resources etc when the window closes.
Call base implementation.
Reimplemented from IEditorDelegate.
Definition at line 42 of file IGraphicsEditorDelegate.cpp.
References IEditorDelegate::CloseWindow().
|
inlinevirtual |
Called to create the IGraphics instance for this editor.
Default impl calls mMakeGraphicsFunc
Definition at line 61 of file IGraphicsEditorDelegate.h.
Referenced by OpenWindow().
|
inline |
Get a pointer to the IGraphics context.
Definition at line 77 of file IGraphicsEditorDelegate.h.
Referenced by OnKeyDown(), OnKeyUp(), OnParentWindowResize(), OpenWindow(), IControl::SetDelegate(), SetScreenScale(), and UnserializeEditorSize().
|
inline |
Get a const pointer to the IGraphics context.
Definition at line 80 of file IGraphicsEditorDelegate.h.
|
inlinevirtual |
Called to layout controls when the GUI is initially opened and again if the UI size changes.
On subsequent calls you can check for the existence of controls and behave accordingly. Default impl calls mLayoutFunc
Definition at line 70 of file IGraphicsEditorDelegate.h.
Referenced by IGraphics::Resize().
|
overridevirtual |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API, rather than the view.
key | Information about the key that was pressed |
true
if the key was handled by the plug-in Reimplemented from IEditorDelegate.
Definition at line 203 of file IGraphicsEditorDelegate.cpp.
References IGraphics::GetMouseLocation(), GetUI(), and IGraphics::OnKeyDown().
|
overridevirtual |
KeyDown handler, in order to get keystrokes from certain hosts/plugin formats that send key press messages through the plug-in API rather than the view.
key | Information about the key that was released |
true
if the key was handled by the plug-in Reimplemented from IEditorDelegate.
Definition at line 217 of file IGraphicsEditorDelegate.cpp.
References IGraphics::GetMouseLocation(), GetUI(), and IGraphics::OnKeyUp().
|
overridevirtual |
Called by app wrappers when the OS window scaling buttons/resizers are used.
Reimplemented from IEditorDelegate.
Definition at line 62 of file IGraphicsEditorDelegate.cpp.
References GetUI().
|
finalvirtual |
If you are not using IGraphics, you can implement this method to attach to the native parent view e.g.
NSView, UIView, HWND. Defer calling OnUIOpen() if necessary.
Reimplemented from IEditorDelegate.
Definition at line 27 of file IGraphicsEditorDelegate.cpp.
References CreateGraphics(), GetUI(), and IGraphics::Resize().
|
overridevirtual |
SendControlMsgFromDelegate (Abbreviation: SCMFD) WARNING: should not be called on the realtime audio thread.
This method can be used to send opaque data from a class implementing IEditorDelegate to a specific control in the user interface. The message can be handled in the destination control via IControl::OnMsgFromDelegate
ctrlTag | A unique tag to identify the control that is the destination of the message |
msgTag | A unique tag to identify the message |
dataSize | The size in bytes of the data payload pointed to by pData. Note: if this is nonzero, pData must be valid. |
pData | Ptr to the opaque data payload for the message |
Reimplemented from IEditorDelegate.
Definition at line 92 of file IGraphicsEditorDelegate.cpp.
References IControl::OnMsgFromDelegate().
|
overridevirtual |
SendControlValueFromDelegate (Abbreviation: SCVFD) WARNING: should not be called on the realtime audio thread.
In IGraphics plug-ins, this method is used to update controls in the user interface from a class implementing IEditorDelegate, when the control is not linked to a parameter. A typical use case would be a meter control. In OnIdle() your plug-in would call this method to update the IControl's value.
ctrlTag | A tag for the control |
normalizedValue | The normalised value to set the control to. This will modify IControl::mValue; |
Reimplemented from IEditorDelegate.
Definition at line 77 of file IGraphicsEditorDelegate.cpp.
References IControl::SetValueFromDelegate().
|
overridevirtual |
SendMidiMsgFromDelegate (Abbreviation: SMMFD) WARNING: should not be called on the realtime audio thread.
This method can be used to send regular MIDI data from the class implementing IEditorDelegate to the user interface The message can be handled at the destination via IEditorDelegate::OnMidiMsgUI()
msg | an IMidiMsg Containing the MIDI message to send to the user interface. |
Reimplemented from IEditorDelegate.
Definition at line 135 of file IGraphicsEditorDelegate.cpp.
References IControl::GetWantsMidi(), IControl::OnMidi(), and IEditorDelegate::SendMidiMsgFromDelegate().
|
overridevirtual |
SendParameterValueFromDelegate (Abbreviation: SPVFD) WARNING: should not be called on the realtime audio thread.
This method is called by the class implementing the delegate interface (not the plug-in API class) in order to update the user interface with the new parameter values, typically after automation. The similarly named IPlugAPIBase::SendParameterValueFromAPI() should take care of queueing and deferring, if there is no main thread notification from the API If you override this method you should call the base class implementation to make sure OnParamChangeUI gets triggered In IGraphics plug-ins, this will update any IControls that have their mParamIdx set > -1
paramIdx | The index of the parameter to be updated |
value | The new value of the parameter |
normalized | true if value is normalised |
Reimplemented from IEditorDelegate.
Definition at line 107 of file IGraphicsEditorDelegate.cpp.
References IEditorDelegate::GetParam(), IControl::GetParamIdx(), IControl::NVals(), IEditorDelegate::SendParameterValueFromDelegate(), IControl::SetValueFromDelegate(), and IParam::ToNormalized().
bool IGEditorDelegate::SerializeEditorSize | ( | IByteChunk & | data | ) | const |
Serializes the size and scale of the IGraphics.
chunk | The output chunk to serialize to. Will append data if the chunk has already been started. |
true
if the serialization was successful Definition at line 153 of file IGraphicsEditorDelegate.cpp.
References IByteChunk::Put().
Referenced by SerializeEditorState().
|
overridevirtual |
Serializes the editor state (such as scale) into a binary chunk.
chunk | The output chunk to serialize to. Will append data if the chunk has already been started. |
true
if the serialization was successful Reimplemented from IEditorDelegate.
Definition at line 193 of file IGraphicsEditorDelegate.cpp.
References SerializeEditorSize().
|
finalvirtual |
Can be used by a host API to inform the editor of screen scale changes.
scale | The new screen scale |
Reimplemented from IEditorDelegate.
Definition at line 71 of file IGraphicsEditorDelegate.cpp.
References GetUI().
int IGEditorDelegate::UnserializeEditorSize | ( | const IByteChunk & | chunk, |
int | startPos | ||
) |
Unserializes the size and scale of the IGraphics.
chunk | The incoming chunk where data is stored to unserialize |
startPos | The start position in the chunk where editor size data is stored |
Definition at line 168 of file IGraphicsEditorDelegate.cpp.
References IByteChunk::Get(), GetUI(), and IGraphics::Resize().
Referenced by UnserializeEditorState().
|
overridevirtual |
Unserializes editor state (such as scale).
chunk | The incoming chunk where editor data is stored to unserialize |
startPos | The start position in the chunk where parameter values are stored |
Reimplemented from IEditorDelegate.
Definition at line 198 of file IGraphicsEditorDelegate.cpp.
References UnserializeEditorSize().
|
friend |
Definition at line 32 of file IGraphicsEditorDelegate.h.
|
protected |
Definition at line 95 of file IGraphicsEditorDelegate.h.
|
protected |
Definition at line 94 of file IGraphicsEditorDelegate.h.