32#include "vstgui/vstgui.h"
33#include "vstgui/uidescription/uiviewswitchcontainer.h"
34#include "vstgui/vstgui_uidescription.h"
35#include "vstgui/lib/crect.h"
38#include "vstgui/uidescription/cstream.h"
41#include "vstgui/lib/vstguiinit.h"
43#if VSTGUI_LIVE_EDITING
44#include "vstgui/uidescription/editing/uieditcontroller.h"
45#include "vstgui/uidescription/editing/uieditmenucontroller.h"
49#import <CoreFoundation/CoreFoundation.h>
50#import <AudioUnit/AudioUnit.h>
51#import <AudioToolbox/AudioToolbox.h>
55#include "AAX_IEffectParameters.h"
71const uint32_t kHostChoice = 3;
109 CControl* ctrl = *it;
138 control->setDefaultValue(normalizedValue);
149 CControl* ctrl = *it;
167 CControl* ctrl = *it;
168 if(ctrl && ctrl->isEditing())
252 CControl* guiCtrl = *it;
253 if(guiCtrl && control != guiCtrl)
256 CTextLabel* label =
dynamic_cast<CTextLabel*
>(guiCtrl);
257 COptionMenu* oMenu =
dynamic_cast<COptionMenu*
>(guiCtrl);
259 CVuMeter* meter =
dynamic_cast<CVuMeter*
>(guiCtrl);
277 oMenu->removeAllEntry();
290 xyPad->calculateXY(xyPad->getValue(), x, y);
293 int32_t tagX = xyPad->getTagX();
294 int32_t tagY = xyPad->getTagY();
301 if(tagX >= 0 && tagY >= 0 && !guiCtrl->isEditing())
302 xyPad->
setValue(xyPad->calculateValue(x, y));
304 else if(!guiCtrl->isEditing())
329 if(!ctrl)
return false;
331 bool stickyVisible = ctrl->isVisible();
337 CView* parent = ctrl->getParentView();
340 stickyVisible = parent->isVisible();
344 parent = parent->getParentView();
346 return stickyVisible;
356 CPoint mousePoint = where;
360 CControl* ctrl = *it;
363 CPoint point = ctrl->frameToLocal(mousePoint);
364 CRect rect = ctrl->getViewSize();
365 if(rect.pointInside(point))
367 int tag = ctrl->getTag();
385 CPoint mousePoint = where;
389 CControl* ctrl = *it;
392 CPoint point = ctrl->frameToLocal(mousePoint);
393 CRect rect = ctrl->getViewSize();
394 if(rect.pointInside(point))
435 public IViewAddedRemovedObserver,
436 public OldMouseObserverAdapter ,
437 public VSTGUIEditorInterface,
439 public ICommandMenuItemTarget,
451 bool open(UTF8StringPtr _viewName,
453 const std::vector<PluginParameter*>* pluginParameterPtr,
454 const PlatformType& platformType = PlatformType::kDefaultNative,
456 void* data =
nullptr);
465 void getSize(
float& width,
float& height);
494 void save(
bool saveAs =
false);
502 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
505 pluginParameters.clear();
517 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
562 CMouseEventResult
sendAAXMouseDown(
int controlID,
const CButtonState& buttons);
565 CMouseEventResult
sendAAXMouseMoved(
int controlID,
const CButtonState& buttons,
const CPoint& where);
568 CMouseEventResult
sendAUMouseDown(CControl* control,
const CButtonState& buttons);
571 CMouseEventResult
sendAUMouseMoved(CControl* control,
const CButtonState& buttons,
const CPoint& where) {
return kMouseEventNotImplemented; }
618 void updateGUIControlAAX(
int tag,
float actualPluginValue,
float normalizedValue = 0.f,
bool useNormalized =
false);
629 void dispatchAUControlChange(
int tag,
float actualPluginValue,
int message = -1,
bool fromEventListener =
false);
660 CMessageResult
notify(CBaseObject* sender, IdStringPtr message)
override;
663 virtual void valueChanged(VSTGUI::CControl* pControl)
override;
685 CView*
createUserCustomView(std::string viewname,
const CRect rect, IControlListener* listener, int32_t tag);
709 CMouseEventResult
onMouseDown(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
712 CMouseEventResult
onMouseMoved(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
737 inline static bool parseSize (
const std::string& str, CPoint& point)
739 size_t sep = str.find (
',', 0);
740 if (sep != std::string::npos)
742 point.x = strtol (str.c_str (), 0, 10);
743 point.y = strtol (str.c_str () + sep+1, 0, 10);
759 return std::find (writeableControls.begin (), writeableControls.end (), control) != writeableControls.end ();
778 writeableControls.push_back(control);
792 for(std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
794 CControl* ctrl = *it;
798 writeableControls.erase(it);
810 for (ControlUpdateReceiverMap::const_iterator it = controlUpdateReceivers.begin(), end = controlUpdateReceivers.end(); it != end; ++it)
814 controlUpdateReceivers.clear();
822 for (std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
824 CControl* ctrl = *it;
827 writeableControls.clear();
861 typedef std::map<int32_t, ControlUpdateReceiver*> ControlUpdateReceiverMap;
862 ControlUpdateReceiverMap controlUpdateReceivers;
863 std::vector<CControl*> writeableControls;
864 std::vector<PluginParameter*> pluginParameters;
867 AAX_IViewContainer* aaxViewContainer =
nullptr;
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1462
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner.
Definition: pluginstructures.h:1540
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer.
Definition: pluginstructures.h:1521
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer.
Definition: pluginstructures.h:1497
The PluginParameter object stores all of the data needed for any type of plugin parameter....
Definition: pluginparameter.h:52
double getControlValue()
the main function to access the underlying atomic double value
Definition: pluginparameter.h:167
double getControlValueWithNormalizedValue(double normalizedValue, bool applyTaper=true)
get the new control value as if it were set with a normalized value
Definition: pluginparameter.h:309
uint32_t getControlID()
get ID value
Definition: pluginparameter.h:81
double getGUIMin()
Definition: pluginparameter.h:349
void setControlValue(double actualParamValue, bool ignoreSmoothing=false)
the main function to set the underlying atomic double value
Definition: pluginparameter.h:175
double getControlValueNormalized(bool applyTaper=true)
get control value as normalied value
Definition: pluginparameter.h:279
double getDefaultValueNormalized()
get default value as normalied value
Definition: pluginparameter.h:253
size_t getStringCount()
get the number of individual strings in a string-list control
Definition: pluginparameter.h:227
bool getIsWritable()
query writable control (meter)
Definition: pluginparameter.h:152
double getNormalizedControlValueWithActualValue(double actualValue)
get the new normalized control value as if it were set with an actual value
Definition: pluginparameter.h:346
double getDefaultValue()
get default value
Definition: pluginparameter.h:99
std::string getStringByIndex(uint32_t index)
get string-list string by index
Definition: pluginparameter.cpp:281
std::string getControlValueAsString()
the main function to access the underlying atomic double value as a string
Definition: pluginparameter.cpp:227
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:540
virtual void setValue(float val) override
Definition: customcontrols.cpp:842
The ControlUpdateReceiver object is the connection mechanism between PluginParameter objects and thei...
Definition: plugingui.h:90
std::vector< CControl * > guiControls
list of controls that share the control tag with this one
Definition: plugingui.h:403
bool controlInRxGroupIsEditing()
Definition: plugingui.h:163
ControlUpdateReceiver(CControl *control, PluginParameter *pluginParameterPtr, bool _isControlListener)
Definition: plugingui.h:93
CControl * getControl_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:383
bool hasControl(CControl *control)
Definition: plugingui.h:118
~ControlUpdateReceiver()
Definition: plugingui.h:105
int getControlID_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:354
PluginParameter refGuiControl
single parameter with this control tag
Definition: plugingui.h:402
bool hasRefGuiControl
internal flag
Definition: plugingui.h:404
const PluginParameter getGuiControl()
Definition: plugingui.h:316
void updateControlsWithActualValue(float actualValue, CControl *control=nullptr)
Definition: plugingui.h:240
int32_t getControlID()
Definition: plugingui.h:321
bool isControlListener
internal flag
Definition: plugingui.h:405
void updateControlsWithControl(CControl *control)
Definition: plugingui.h:203
float getNormalizedValueWithActualValue(float actualValue)
Definition: plugingui.h:195
void initControl(CControl *control)
Definition: plugingui.h:230
float getActualValueWithNormalizedValue(float normalizedValue)
Definition: plugingui.h:178
void addControl(CControl *control)
Definition: plugingui.h:126
void updateControlsWithNormalizedValue(float normalizedValue, CControl *control=nullptr)
Definition: plugingui.h:212
void removeControl(CControl *control)
Definition: plugingui.h:145
bool controlAndContainerVisible(CControl *ctrl)
Definition: plugingui.h:327
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX,...
Definition: plugingui.h:441
void setAAXViewContainer(AAX_IViewContainer *_aaxViewContainer)
AAX ONLY: plugin shell GUI object sets this after creation.
Definition: plugingui.h:612
CRect nonEditRect
non-edit area for GUI designer
Definition: plugingui.h:537
void checkRemoveWriteableControl(CControl *control)
check to see if we already store this meter control and remove it if we do
Definition: plugingui.h:788
virtual void controlEndEdit(VSTGUI::CControl *pControl) override
end of control/auomation notification
Definition: plugingui.cpp:1648
double guiDesignerWidth
GUI Designer's frame size.
Definition: plugingui.h:543
virtual void controlTagDidChange(VSTGUI::CControl *pControl) override
called when a control is being created on the GUI (step 2)
Definition: plugingui.cpp:1704
CVSTGUITimer * timer
timer object (this is platform dependent)
Definition: plugingui.h:533
void dispatchAUControlChange(int tag, float actualPluginValue, int message=-1, bool fromEventListener=false)
set the GUI control from the AU event generator; this is part of the thread-safe event system....
Definition: plugingui.cpp:1343
void setAUEventFromGUIControl(CControl *control, int tag, float normalizedValue)
set the AU event from the GUI congrol; this is part of the thread-safe event system....
Definition: plugingui.cpp:1358
bool hasWriteableControl(CControl *control)
check to see if we already store this meter control
Definition: plugingui.h:757
AudioUnit m_AU
AU ONLY: the AU plugin reference.
Definition: plugingui.h:624
CMouseEventResult sendAUMouseMoved(CControl *control, const CButtonState &buttons, const CPoint &where)
Definition: plugingui.h:571
bool hasICustomView(CView *view)
simple helper function to test view for ICustomView
Definition: plugingui.h:837
CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse move event
Definition: plugingui.cpp:2633
std::string xmlFile
the XML file name
Definition: plugingui.h:529
void onMouseExited(CView *view, CFrame *frame) override
Definition: plugingui.h:706
void updateGUIControlVST(int tag, float normalizedValue)
set the GUI control from the VST parameter
Definition: plugingui.cpp:1398
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 create...
Definition: plugingui.cpp:1798
void setVSTParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the VST parameter from the GUI control
Definition: plugingui.cpp:1385
void setPluginParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
safely set a plugin shell parameter with a GUI control
Definition: plugingui.h:584
void deleteControlUpdateReceivers()
delete all reciever objects
Definition: plugingui.h:808
static bool parseSize(const std::string &str, CPoint &point)
simple helper function to get size from string
Definition: plugingui.h:737
float guiHeight
embedded GUI size
Definition: plugingui.h:546
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)
Definition: plugingui.cpp:1680
bool showGUIEditor
show the GUI designer
Definition: plugingui.h:540
float guiWidth
embedded GUI size
Definition: plugingui.h:545
void preCreateGUI()
one-time pre-create init, currently used for AU only
Definition: plugingui.cpp:666
virtual void idle()
perform idling operation; called directly from timer thread
Definition: plugingui.cpp:630
int getControlID_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1140
void writeToPresetFile()
writes the current state of all GUI controls into a text file so that yuu can simply cut and paste th...
Definition: plugingui.cpp:498
virtual ~PluginGUI()
PluginGUI destructor.
Definition: plugingui.cpp:168
AUEventListenerRef AUEventListener
AU ONLY: the event listener token.
Definition: plugingui.h:625
void save(bool saveAs=false)
save GUI state in XML file
Definition: plugingui.cpp:1005
std::string viewName
name
Definition: plugingui.h:528
static void exitVSTGUILib()
Definition: plugingui.cpp:2666
virtual void setGUIWindowFrame(IGUIWindowFrame *frame) override
set the interface pointer for resizing from the GUI
Definition: plugingui.h:726
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 wa...
Definition: plugingui.cpp:1848
void getSize(float &width, float &height)
returns the size into the pass-by-reference variables
Definition: plugingui.cpp:422
void checkAddWriteableControl(PluginParameter *piParam, CControl *control)
check to see if we already store this meter control and add it if we don't
Definition: plugingui.h:768
CPoint minSize
the min size of the GUI window
Definition: plugingui.h:535
void deleteGUIControlList()
Definition: plugingui.h:500
void setRAFXParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the RAFX2 parameter from the GUI control
Definition: plugingui.cpp:1418
IController * createSubController(UTF8StringPtr name, const IUIDescription *description) override
for advanced users: you can create and even register sub-controllers here
Definition: plugingui.cpp:2454
IGUIWindowFrame * guiWindowFrame
interface to allow plugin shell to resize our window
Definition: plugingui.h:548
CMouseEventResult sendAUMouseDown(CControl *control, const CButtonState &buttons)
mouse down handler for AU automation
Definition: plugingui.cpp:1265
CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse down event
Definition: plugingui.cpp:2569
IGUIPluginConnector * guiPluginConnector
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs
Definition: plugingui.h:526
void updateGUIControlAAX(int tag, float actualPluginValue, float normalizedValue=0.f, bool useNormalized=false)
set the GUI control from the plugin shell GUI object (thread-safe)
Definition: plugingui.cpp:1316
bool open(UTF8StringPtr _viewName, void *parent, const std::vector< PluginParameter * > *pluginParameterPtr, const PlatformType &platformType=PlatformType::kDefaultNative, IGUIPluginConnector *_guiPluginConnector=nullptr, void *data=nullptr)
creates the GUI control objects, creates outer frame, inserts contents into window
Definition: plugingui.cpp:204
void onViewRemoved(CFrame *frame, CView *view) override
called before GUI control is removed from the view
Definition: plugingui.cpp:2508
static void initVSTGUILib(void *hInstance)
VSTGUI4 Library Initializer for AAX/Windows only.
Definition: plugingui.cpp:2660
std::string getGUIDesignerSize()
get size string
Definition: plugingui.cpp:1115
virtual int32_t getKnobMode() const override
returns mode
Definition: plugingui.cpp:1096
bool createNewView
show the normal GUI
Definition: plugingui.h:541
CControl * getControl_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1165
bool createGUI(bool bShowGUIEditor)
creates either the GUI or the GUI Designer
Definition: plugingui.cpp:868
void setAU(AudioUnit inAU)
Definition: plugingui.h:634
CFrame * guiEditorFrame
pointer to our frame
Definition: plugingui.h:549
virtual int32_t controlModifierClicked(VSTGUI::CControl *pControl, VSTGUI::CButtonState button) override
return 1 if you want the control to not handle it, otherwise 0
Definition: plugingui.h:666
PluginParameter * getGuiControlWithTag(int tag)
find the local PluginParameter that is connected to the same control ID
Definition: plugingui.h:515
double zoomFactor
scaling factor for built-in scaling
Definition: plugingui.h:532
virtual void valueChanged(VSTGUI::CControl *pControl) override
THE function that all controls pour their control changes into. The result of this function is to pus...
Definition: plugingui.cpp:1476
ControlUpdateReceiver * getControlUpdateReceiver(int32_t tag) const
find the receiver for a given tag; there can be only one receiver for any tag
Definition: plugingui.cpp:2485
UIDescription * description
the description version of the XML file
Definition: plugingui.h:527
virtual void controlBeginEdit(VSTGUI::CControl *pControl) override
start of control/auomation notification
Definition: plugingui.cpp:1617
CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState &buttons)
mouse down handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1196
void updateGUIControlRAFX(int tag, float normalizedValue)
set the GUI control from the RAFX2 parameter
Definition: plugingui.cpp:1431
void onViewAdded(CFrame *frame, CView *view) override
Definition: plugingui.h:697
void syncGUIControl(uint32_t controlID)
safely sets the GUI control value based on the plugin parameter value
Definition: plugingui.cpp:364
void scaleGUISize(uint32_t controlValue)
scales the GUI; this is the handler for the special scaling GUI control
Definition: plugingui.cpp:435
double guiDesignerHeight
GUI Designer's frame size.
Definition: plugingui.h:544
void clearGUIPluginConnector()
Definition: plugingui.h:474
CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState &buttons, const CPoint &where)
mouse moved handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1230
void forgetWriteableControls()
forget all writeable (neter) controls
Definition: plugingui.h:820
void setAAXParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the plugin shelll parameter from GUI control using thread-safe mechanism
Definition: plugingui.cpp:1298
CPoint maxSize
the max size of the GUI window
Definition: plugingui.h:536
virtual bool validateCommandMenuItem(CCommandMenuItem *item) override
validates menu item selections to prevent crashing
Definition: plugingui.cpp:733
bool hasICustomView(IController *subController)
simple helper function to test sub-controller for ICustomView
Definition: plugingui.h:852
virtual bool onCommandMenuItemSelected(CCommandMenuItem *item) override
message handler for GUI Designer menu
Definition: plugingui.cpp:780
uint32_t knobAction
knob mode
Definition: plugingui.h:550
uint32_t numUIControls
control counter
Definition: plugingui.h:531
void onMouseEntered(CView *view, CFrame *frame) override
Definition: plugingui.h:703
void close()
prepares the GUI control objects for destruction, cleans up
Definition: plugingui.cpp:322
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
incoming VSTGUI4 message handler
Definition: plugingui.cpp:1449
interface file for ASPiK custom control objects (knobs, buttons, meters, etc...)
bool isReservedTag(int tag)
check to see if a tag is reserved: ASPiK defines several reserved control ID values.
Definition: guiconstants.h:49
base class interface file for ASPiK pluginparameter object