ASPiK SDK
|
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX, AU, VST3 and RAFX2 plugins. Note the multiple inheritance inolved with this very complex object. The IGUIView interface is the only non-VSTGUI4 base class. It allows for GUI resizing and manipulation, if and only if the host DAW allows and provides the mechanism for it. More...
#include <plugingui.h>
Public Member Functions | |
PluginGUI (UTF8StringPtr _xmlFile) | |
PluginGUI constructor; note that this maintains both Mac and Windows contexts, the bundle ref for Mac and the external void* for Windows. More... | |
virtual | ~PluginGUI () |
PluginGUI destructor. More... | |
bool | open (UTF8StringPtr _viewName, void *parent, const std::vector< PluginParameter *> *pluginParameterPtr, const PlatformType &platformType=kDefaultNative, IGUIPluginConnector *_guiPluginConnector=nullptr, void *data=nullptr) |
creates the GUI control objects, creates outer frame, inserts contents into window More... | |
void | close () |
prepares the GUI control objects for destruction, cleans up More... | |
void | syncGUIControl (uint32_t controlID) |
safely sets the GUI control value based on the plugin parameter value More... | |
void | getSize (float &width, float &height) |
returns the size into the pass-by-reference variables More... | |
void | scaleGUISize (uint32_t controlValue) |
scales the GUI; this is the handler for the special scaling GUI control More... | |
void | writeToPresetFile () |
writes the current state of all GUI controls into a text file so that yuu can simply cut and paste the C++ code into the core object file. More... | |
CMessageResult | notify (CBaseObject *sender, IdStringPtr message) override |
incoming VSTGUI4 message handler More... | |
virtual void | valueChanged (VSTGUI::CControl *pControl) override |
THE function that all controls pour their control changes into. The result of this function is to push the GUI control change safely into the plugin shell owner. More... | |
virtual int32_t | controlModifierClicked (VSTGUI::CControl *pControl, VSTGUI::CButtonState button) override |
return 1 if you want the control to not handle it, otherwise 0 More... | |
virtual void | controlBeginEdit (VSTGUI::CControl *pControl) override |
start of control/auomation notification More... | |
virtual void | controlEndEdit (VSTGUI::CControl *pControl) override |
end of control/auomation notification More... | |
virtual void | controlTagWillChange (VSTGUI::CControl *pControl) override |
called when a control is being removed from the GUI, or when it is being created (step 1) More... | |
virtual void | controlTagDidChange (VSTGUI::CControl *pControl) override |
called when a control is being created on the GUI (step 2) More... | |
CView * | createUserCustomView (std::string viewname, const CRect rect, IControlListener *listener, int32_t tag) |
add your custom views here; this is where you can create and register the views outside of the createView( ) method below. More... | |
CView * | createView (const UIAttributes &attributes, const IUIDescription *description) override |
this is called for every view obeject in the XML file that will be visible to check and see if you want to supply your own object, that you create with the new operator; that object takes the place of the stock GUI object, allowing you to customize the view behavior. This is called the "Custom View" paradigm and along with the sub-controller make VSTGUI4 extremely powerful. More... | |
IController * | createSubController (UTF8StringPtr name, const IUIDescription *description) override |
for advanced users: you can create and even register sub-controllers here More... | |
ControlUpdateReceiver * | getControlUpdateReceiver (int32_t tag) const |
find the receiver for a given tag; there can be only one receiver for any tag More... | |
void | onViewAdded (CFrame *frame, CView *view) override |
void | onViewRemoved (CFrame *frame, CView *view) override |
called before GUI control is removed from the view More... | |
void | onMouseEntered (CView *view, CFrame *frame) override |
void | onMouseExited (CView *view, CFrame *frame) override |
CMouseEventResult | onMouseDown (CFrame *frame, const CPoint &where, const CButtonState &buttons) override |
message handler for mouse down event More... | |
CMouseEventResult | onMouseMoved (CFrame *frame, const CPoint &where, const CButtonState &buttons) override |
message handler for mouse move event More... | |
int32_t | onKeyDown (const VstKeyCode &code, CFrame *frame) override |
int32_t | onKeyUp (const VstKeyCode &code, CFrame *frame) override |
virtual bool | validateCommandMenuItem (CCommandMenuItem *item) |
validates menu item selections to prevent crashing More... | |
virtual bool | onCommandMenuItemSelected (CCommandMenuItem *item) |
message handler for GUI Designer menu More... | |
virtual void | setGUIWindowFrame (IGUIWindowFrame *frame) override |
set the interface pointer for resizing from the GUI More... | |
bool | hasWriteableControl (CControl *control) |
check to see if we already store this meter control More... | |
void | checkAddWriteableControl (PluginParameter *piParam, CControl *control) |
check to see if we already store this meter control and add it if we don't More... | |
void | checkRemoveWriteableControl (CControl *control) |
check to see if we already store this meter control and remove it if we do More... | |
void | deleteControlUpdateReceivers () |
delete all reciever objects | |
void | forgetWriteableControls () |
forget all writeable (neter) controls | |
bool | hasICustomView (CView *view) |
simple helper function to test view for ICustomView More... | |
bool | hasICustomView (IController *subController) |
simple helper function to test sub-controller for ICustomView More... | |
Static Public Member Functions | |
static bool | parseSize (const std::string &str, CPoint &point) |
simple helper function to get size from string More... | |
Protected Member Functions | |
virtual void | idle () |
perform idling operation; called directly from timer thread More... | |
void | preCreateGUI () |
one-time pre-create init, currently used for AU only More... | |
bool | createGUI (bool bShowGUIEditor) |
creates either the GUI or the GUI Designer More... | |
void | save (bool saveAs=false) |
save GUI state in XML file More... | |
virtual int32_t | getKnobMode () const override |
returns mode More... | |
void | deleteGUIControlList () |
PluginParameter * | getGuiControlWithTag (int tag) |
find the local PluginParameter that is connected to the same control ID More... | |
std::string | getGUIDesignerSize () |
get size string More... | |
int | getControlID_WithMouseCoords (const CPoint &where) |
control finder, for AAX only, part of Pro Tools automation keyboard shortcut More... | |
CControl * | getControl_WithMouseCoords (const CPoint &where) |
control finder, for AAX only, part of Pro Tools automation keyboard shortcut More... | |
CMouseEventResult | sendAAXMouseDown (int controlID, const CButtonState &buttons) |
mouse down handler for Pro Tools keyboard shortcuts More... | |
CMouseEventResult | sendAAXMouseMoved (int controlID, const CButtonState &buttons, const CPoint &where) |
mouse moved handler for Pro Tools keyboard shortcuts More... | |
CMouseEventResult | sendAUMouseDown (CControl *control, const CButtonState &buttons) |
mouse down handler for AU automation More... | |
CMouseEventResult | sendAUMouseMoved (CControl *control, const CButtonState &buttons, const CPoint &where) |
void | setPluginParameterFromGUIControl (CControl *control, int tag, float actualValue, float normalizedValue) |
safely set a plugin shell parameter with a GUI control More... | |
Protected Attributes | |
IGUIPluginConnector * | guiPluginConnector = nullptr |
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs | |
UIDescription * | description = nullptr |
the description version of the XML file | |
std::string | viewName |
name | |
std::string | xmlFile |
the XML file name | |
uint32_t | numUIControls = 0 |
control counter | |
double | zoomFactor = 1.0 |
scaling factor for built-in scaling | |
CVSTGUITimer * | timer |
timer object (this is platform dependent) | |
CPoint | minSize |
the min size of the GUI window | |
CPoint | maxSize |
the max size of the GUI window | |
CRect | nonEditRect |
non-edit area for GUI designer | |
bool | showGUIEditor = false |
show the GUI designer | |
bool | createNewView = true |
show the normal GUI | |
double | guiDesignerWidth |
GUI Designer's frame size. | |
double | guiDesignerHeight |
GUI Designer's frame size. | |
float | guiWidth |
embedded GUI size | |
float | guiHeight |
embedded GUI size | |
IGUIWindowFrame * | guiWindowFrame = nullptr |
interface to allow plugin shell to resize our window | |
CFrame * | guiEditorFrame = nullptr |
pointer to our frame | |
uint32_t | knobAction = kLinearMode |
knob mode | |
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX, AU, VST3 and RAFX2 plugins. Note the multiple inheritance inolved with this very complex object. The IGUIView interface is the only non-VSTGUI4 base class. It allows for GUI resizing and manipulation, if and only if the host DAW allows and provides the mechanism for it.
Features:
PluginGUI::PluginGUI | ( | UTF8StringPtr | _xmlFile | ) |
PluginGUI constructor; note that this maintains both Mac and Windows contexts, the bundle ref for Mac and the external void* for Windows.
construction with XML file
Operation:
|
virtual |
|
inline |
check to see if we already store this meter control and add it if we don't
control | the control object |
piParam | the parameter object associated with the control |
|
inline |
check to see if we already store this meter control and remove it if we do
control | the control object |
void PluginGUI::close | ( | ) |
prepares the GUI control objects for destruction, cleans up
destroy the GUI guts before frame is destoyed
Operation:
|
overridevirtual |
start of control/auomation notification
the user has started to change the GUI control
NOTE:
pControl | control that has started the edit |
|
overridevirtual |
end of control/auomation notification
the user has finished changing the GUI control
NOTE:
pControl | control that has started the edit |
|
inlineoverridevirtual |
return 1 if you want the control to not handle it, otherwise 0
unused override
|
overridevirtual |
called when a control is being created on the GUI (step 2)
the GUI control's tag did change (end of creation)
NOTE:
pControl | control whose tag has changed |
|
overridevirtual |
called when a control is being removed from the GUI, or when it is being created (step 1)
the GUI control's tag will change (start of creation)
NOTE:
pControl | control whose tag will change |
|
protected |
creates either the GUI or the GUI Designer
create the GUI, or the GUI Designer if user is launching it
Operation:
bShowGUIEditor | create the drag-and-drop GUI designer |
|
override |
for advanced users: you can create and even register sub-controllers here
create a custom sub-controller
Operation:
name | sub-controller name string as defined in the XML file |
description | UIDescription of object |
CView * PluginGUI::createUserCustomView | ( | std::string | viewname, |
const CRect | rect, | ||
IControlListener * | listener, | ||
int32_t | tag | ||
) |
add your custom views here; this is where you can create and register the views outside of the createView( ) method below.
first chance is for you to create and register a custom view
Operation:
viewname | customm view name string (as defined in XML file) |
rect | size of control |
listener | parent listener |
tag | the control ID value |
|
override |
this is called for every view obeject in the XML file that will be visible to check and see if you want to supply your own object, that you create with the new operator; that object takes the place of the stock GUI object, allowing you to customize the view behavior. This is called the "Custom View" paradigm and along with the sub-controller make VSTGUI4 extremely powerful.
create a custom view
Operation:
viewname | customm view name string (as defined in XML file) |
rect | size of control |
listener | parent listener |
tag | the control ID value |
|
inlineprotected |
destroy the parameter list
|
protected |
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
get the control pointer value using current mouse location
where | mouse coordinates |
|
protected |
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
get the control ID value using current mouse location
where | mouse coordinates |
ControlUpdateReceiver * PluginGUI::getControlUpdateReceiver | ( | int32_t | tag | ) | const |
find the receiver for a given tag; there can be only one receiver for any tag
tag | the control ID value |
|
inlineprotected |
find the local PluginParameter that is connected to the same control ID
tag | the control ID |
|
protected |
get size string
get size as string
|
overrideprotectedvirtual |
returns mode
get the current knob behavior (important - users are very aware of this)
Modes:
void PluginGUI::getSize | ( | float & | width, |
float & | height | ||
) |
returns the size into the pass-by-reference variables
get current GUI size
width | return value of width |
height | return value of height |
|
inline |
simple helper function to test view for ICustomView
view | the view to test |
|
inline |
simple helper function to test sub-controller for ICustomView
view | the view to test |
|
inline |
check to see if we already store this meter control
control | the control object |
|
protectedvirtual |
perform idling operation; called directly from timer thread
the udpate and repaint function
Operation:
|
override |
incoming VSTGUI4 message handler
VSTGUI4 message notification
sender | pointer to sending object |
message | message as a string |
|
virtual |
message handler for GUI Designer menu
ICommandMenuItemTarget called when the item was selected
Operation:
item | the menu item to decode |
|
inlineoverride |
IKeyboardHook key down handler, not used
|
inlineoverride |
IKeyboardHook key up handler, not used
|
override |
message handler for mouse down event
IMouseObserver mouse moved handler
Operation:
frame | owning frame |
where | current location of mouse coordinates |
buttons | button state |
|
inlineoverride |
IMouseObserver override not used
|
inlineoverride |
IMouseObserver override not used
|
override |
message handler for mouse move event
IMouseObserver mouse moved handler
Operation:
frame | owning frame |
where | current location of mouse coordinates |
buttons | button state |
|
inlineoverride |
IViewAddedRemovedObserver view added: unused
|
override |
called before GUI control is removed from the view
IViewAddedRemovedObserver view removed
Operation:
frame | owner frame |
view | pointer to view being removed |
bool PluginGUI::open | ( | UTF8StringPtr | _viewName, |
void * | parent, | ||
const std::vector< PluginParameter *> * | pluginParameterPtr, | ||
const PlatformType & | platformType = kDefaultNative , |
||
IGUIPluginConnector * | _guiPluginConnector = nullptr , |
||
void * | data = nullptr |
||
) |
creates the GUI control objects, creates outer frame, inserts contents into window
create the GUI inside of a host-supplied window frame
Operation:
_viewName | name for window title |
parent | the window pointer: for Windows it is HWND and for MacOS it is NSView* |
pluginParameterPtr | a list of the plugin parameters; this object makes a COPY of that information and does NOT hold a pointer to it |
platformType | the window type (Windows or MacOS) |
_guiPluginConnector | an interface pointer on the plugin shell that creates, maintains, and destroys this object |
data | optional OS-specific data (for AU it is the AU reference, etc...) |
|
inlinestatic |
simple helper function to get size from string
str | the string |
point | the CPoint version of the string data |
|
protected |
one-time pre-create init, currently used for AU only
do any API specific stuff that is required prior to the GUI creation
Operation:
|
protected |
save GUI state in XML file
save the current state in XML
Operation:
saveAs | show the save-as dialog box |
void PluginGUI::scaleGUISize | ( | uint32_t | controlValue | ) |
scales the GUI; this is the handler for the special scaling GUI control
scale the GUI
controlValue | the scaling value from the secret control |
|
protected |
mouse down handler for Pro Tools keyboard shortcuts
Pro Tools: mouse down
Operation:
controlID | ID tag for control that will receive mouse down message |
buttons | button state flags |
|
protected |
mouse moved handler for Pro Tools keyboard shortcuts
Pro Tools: mouse moved
Operation:
controlID | ID tag for control that will receive mouse move message |
buttons | button state flags |
where | the mouse coordinates |
|
protected |
mouse down handler for AU automation
AU: mouse down
Operation:
control | control that receives message |
buttons | button state flags |
|
inlineprotected |
AU: mouse moved (not used)
|
inlineoverridevirtual |
|
inlineprotected |
safely set a plugin shell parameter with a GUI control
NOTE:
control | pointer to the control that generated the notification |
tag | the control ID |
actualValue | the actual (aka plain) parameter value |
normalizedValue | the normalied version of the parameter value |
void PluginGUI::syncGUIControl | ( | uint32_t | controlID | ) |
safely sets the GUI control value based on the plugin parameter value
sync GUI control to current plugin value, thread-safe
Notes:
controlID | the ID value of the control to sync |
|
virtual |
validates menu item selections to prevent crashing
ICommandMenuItemTarget called before the item is shown to validate its state
Operation:
item | the menu item to test |
|
overridevirtual |
THE function that all controls pour their control changes into. The result of this function is to push the GUI control change safely into the plugin shell owner.
IControlListener:: required override
Operation:
pControl | control that issues change notification |
void PluginGUI::writeToPresetFile | ( | ) |
writes the current state of all GUI controls into a text file so that yuu can simply cut and paste the C++ code into the core object file.
for preset saving helper which writes preset code for you