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" 71 const 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 IMouseObserver,
437 public IKeyboardHook,
438 public VSTGUIEditorInterface,
440 public ICommandMenuItemTarget,
452 bool open(UTF8StringPtr _viewName,
454 const std::vector<PluginParameter*>* pluginParameterPtr,
455 const PlatformType& platformType = PlatformType::kDefaultNative,
457 void* data =
nullptr);
466 void getSize(
float& width,
float& height);
488 void save(
bool saveAs =
false);
496 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
499 pluginParameters.clear();
511 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
556 CMouseEventResult
sendAAXMouseDown(
int controlID,
const CButtonState& buttons);
559 CMouseEventResult
sendAAXMouseMoved(
int controlID,
const CButtonState& buttons,
const CPoint& where);
562 CMouseEventResult
sendAUMouseDown(CControl* control,
const CButtonState& buttons);
565 CMouseEventResult
sendAUMouseMoved(CControl* control,
const CButtonState& buttons,
const CPoint& where) {
return kMouseEventNotImplemented; }
612 void updateGUIControlAAX(
int tag,
float actualPluginValue,
float normalizedValue = 0.f,
bool useNormalized =
false);
623 void dispatchAUControlChange(
int tag,
float actualPluginValue,
int message = -1,
bool fromEventListener =
false);
654 CMessageResult
notify(CBaseObject* sender, IdStringPtr message)
override;
657 virtual void valueChanged(VSTGUI::CControl* pControl)
override;
679 CView*
createUserCustomView(std::string viewname,
const CRect rect, IControlListener* listener, int32_t tag);
703 CMouseEventResult
onMouseDown(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
706 CMouseEventResult
onMouseMoved(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
709 int32_t
onKeyDown(
const VstKeyCode& code, CFrame* frame)
override {
return -1; }
712 int32_t
onKeyUp(
const VstKeyCode& code, CFrame* frame)
override {
return -1; }
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;
double getControlValue()
the main function to access the underlying atomic double value
Definition: pluginparameter.h:167
AudioUnit m_AU
AU ONLY: the AU plugin reference.
Definition: plugingui.h:618
CVSTGUITimer * timer
timer object (this is platform dependent)
Definition: plugingui.h:527
IGUIPluginConnector * guiPluginConnector
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs ...
Definition: plugingui.h:520
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
bool hasICustomView(IController *subController)
simple helper function to test sub-controller for ICustomView
Definition: plugingui.h:852
IGUIWindowFrame * guiWindowFrame
interface to allow plugin shell to resize our window
Definition: plugingui.h:542
CControl * getControl_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:383
virtual void setValue(float val) override
Definition: customcontrols.cpp:831
const PluginParameter getGuiControl()
Definition: plugingui.h:316
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX...
Definition: plugingui.h:434
bool createGUI(bool bShowGUIEditor)
creates either the GUI or the GUI Designer
Definition: plugingui.cpp:879
void updateControlsWithControl(CControl *control)
Definition: plugingui.h:203
~ControlUpdateReceiver()
Definition: plugingui.h:105
void setAU(AudioUnit inAU)
Definition: plugingui.h:628
uint32_t numUIControls
control counter
Definition: plugingui.h:525
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:1354
void save(bool saveAs=false)
save GUI state in XML file
Definition: plugingui.cpp:1016
float getActualValueWithNormalizedValue(float normalizedValue)
Definition: plugingui.h:178
virtual void controlEndEdit(VSTGUI::CControl *pControl) override
end of control/auomation notification
Definition: plugingui.cpp:1659
void setRAFXParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the RAFX2 parameter from the GUI control
Definition: plugingui.cpp:1429
void setAAXViewContainer(AAX_IViewContainer *_aaxViewContainer)
AAX ONLY: plugin shell GUI object sets this after creation.
Definition: plugingui.h:606
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. This is called to safely set the GUI control value on the plugin shell's parameter list.
Definition: plugingui.cpp:1369
void getSize(float &width, float &height)
returns the size into the pass-by-reference variables
Definition: plugingui.cpp:433
PluginGUI(UTF8StringPtr _xmlFile)
PluginGUI constructor; note that this maintains both Mac and Windows contexts, the bundle ref for Mac...
Definition: plugingui.cpp:125
void removeControl(CControl *control)
Definition: plugingui.h:145
bool getIsWritable()
query writable control (meter)
Definition: pluginparameter.h:152
void clearGUIPluginConnector()
Definition: plugingui.h:475
void syncGUIControl(uint32_t controlID)
safely sets the GUI control value based on the plugin parameter value
Definition: plugingui.cpp:375
virtual bool onCommandMenuItemSelected(CCommandMenuItem *item) override
message handler for GUI Designer menu
Definition: plugingui.cpp:791
double getControlValueNormalized(bool applyTaper=true)
get control value as normalied value
Definition: pluginparameter.h:279
uint32_t getControlID()
get ID value
Definition: pluginparameter.h:81
std::string getGUIDesignerSize()
get size string
Definition: plugingui.cpp:1126
std::string getControlValueAsString()
the main function to access the underlying atomic double value as a string
Definition: pluginparameter.cpp:227
void scaleGUISize(uint32_t controlValue)
scales the GUI; this is the handler for the special scaling GUI control
Definition: plugingui.cpp:446
double getGUIMin()
Definition: pluginparameter.h:349
void deleteGUIControlList()
Definition: plugingui.h:494
bool showGUIEditor
show the GUI designer
Definition: plugingui.h:534
double guiDesignerWidth
GUI Designer's frame size.
Definition: plugingui.h:537
void onViewRemoved(CFrame *frame, CView *view) override
called before GUI control is removed from the view
Definition: plugingui.cpp:2519
double zoomFactor
scaling factor for built-in scaling
Definition: plugingui.h:526
CMouseEventResult sendAUMouseDown(CControl *control, const CButtonState &buttons)
mouse down handler for AU automation
Definition: plugingui.cpp:1276
void addControl(CControl *control)
Definition: plugingui.h:126
bool hasWriteableControl(CControl *control)
check to see if we already store this meter control
Definition: plugingui.h:757
bool controlAndContainerVisible(CControl *ctrl)
Definition: plugingui.h:327
void preCreateGUI()
one-time pre-create init, currently used for AU only
Definition: plugingui.cpp:677
CRect nonEditRect
non-edit area for GUI designer
Definition: plugingui.h:531
void updateControlsWithNormalizedValue(float normalizedValue, CControl *control=nullptr)
Definition: plugingui.h:212
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:1327
int getControlID_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1151
bool controlInRxGroupIsEditing()
Definition: plugingui.h:163
std::string getStringByIndex(uint32_t index)
get string-list string by index
Definition: pluginparameter.cpp:281
float getNormalizedValueWithActualValue(float actualValue)
Definition: plugingui.h:195
double getDefaultValue()
get default value
Definition: pluginparameter.h:99
CFrame * guiEditorFrame
pointer to our frame
Definition: plugingui.h:543
CMouseEventResult sendAUMouseMoved(CControl *control, const CButtonState &buttons, const CPoint &where)
Definition: plugingui.h:565
float guiWidth
embedded GUI size
Definition: plugingui.h:539
void close()
prepares the GUI control objects for destruction, cleans up
Definition: plugingui.cpp:333
int32_t onKeyDown(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:709
CPoint minSize
the min size of the GUI window
Definition: plugingui.h:529
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner...
Definition: pluginstructures.h:1539
float guiHeight
embedded GUI size
Definition: plugingui.h:540
void setVSTParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the VST parameter from the GUI control
Definition: plugingui.cpp:1396
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
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1461
bool hasRefGuiControl
internal flag
Definition: plugingui.h:404
virtual void controlTagDidChange(VSTGUI::CControl *pControl) override
called when a control is being created on the GUI (step 2)
Definition: plugingui.cpp:1715
bool isReservedTag(int tag)
check to see if a tag is reserved: ASPiK defines several reserved control ID values.
Definition: guiconstants.h:49
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:215
Definition: customcontrols.cpp:20
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:509
std::string viewName
name
Definition: plugingui.h:522
size_t getStringCount()
get the number of individual strings in a string-list control
Definition: pluginparameter.h:227
void setControlValue(double actualParamValue, bool ignoreSmoothing=false)
the main function to set the underlying atomic double value
Definition: pluginparameter.h:175
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:1809
int getControlID_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:354
uint32_t knobAction
knob mode
Definition: plugingui.h:544
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
incoming VSTGUI4 message handler
Definition: plugingui.cpp:1460
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:1487
double getDefaultValueNormalized()
get default value as normalied value
Definition: pluginparameter.h:253
void onMouseEntered(CView *view, CFrame *frame) override
Definition: plugingui.h:697
virtual void controlBeginEdit(VSTGUI::CControl *pControl) override
start of control/auomation notification
Definition: plugingui.cpp:1628
void onMouseExited(CView *view, CFrame *frame) override
Definition: plugingui.h:700
ControlUpdateReceiver(CControl *control, PluginParameter *pluginParameterPtr, bool _isControlListener)
Definition: plugingui.h:93
CControl * getControl_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1176
void updateGUIControlRAFX(int tag, float normalizedValue)
set the GUI control from the RAFX2 parameter
Definition: plugingui.cpp:1442
The ControlUpdateReceiver object is the connection mechanism between PluginParameter objects and thei...
Definition: plugingui.h:89
base class interface file for ASPiK pluginparameter object
bool hasICustomView(CView *view)
simple helper function to test view for ICustomView
Definition: plugingui.h:837
int32_t onKeyUp(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:712
bool hasControl(CControl *control)
Definition: plugingui.h:118
virtual bool validateCommandMenuItem(CCommandMenuItem *item) override
validates menu item selections to prevent crashing
Definition: plugingui.cpp:744
CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState &buttons, const CPoint &where)
mouse moved handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1241
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:2496
virtual ~PluginGUI()
PluginGUI destructor.
Definition: plugingui.cpp:180
std::vector< CControl * > guiControls
list of controls that share the control tag with this one
Definition: plugingui.h:403
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:1309
The PluginParameter object stores all of the data needed for any type of plugin parameter. It is a large object, but it is not complex as it really just stores LOTS of information about plugin parameters.
Definition: pluginparameter.h:51
virtual void setGUIWindowFrame(IGUIWindowFrame *frame) override
set the interface pointer for resizing from the GUI
Definition: plugingui.h:726
interface file for ASPiK custom control objects (knobs, buttons, meters, etc...)
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer...
Definition: pluginstructures.h:1520
void initControl(CControl *control)
Definition: plugingui.h:230
bool createNewView
show the normal GUI
Definition: plugingui.h:535
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer...
Definition: pluginstructures.h:1496
CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse down event
Definition: plugingui.cpp:2580
virtual int32_t getKnobMode() const override
returns mode
Definition: plugingui.cpp:1107
double guiDesignerHeight
GUI Designer's frame size.
Definition: plugingui.h:538
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:539
void onViewAdded(CFrame *frame, CView *view) override
Definition: plugingui.h:691
static bool parseSize(const std::string &str, CPoint &point)
simple helper function to get size from string
Definition: plugingui.h:737
PluginParameter * getGuiControlWithTag(int tag)
find the local PluginParameter that is connected to the same control ID
Definition: plugingui.h:509
double getNormalizedControlValueWithActualValue(double actualValue)
get the new normalized control value as if it were set with an actual value
Definition: pluginparameter.h:346
UIDescription * description
the description version of the XML file
Definition: plugingui.h:521
void deleteControlUpdateReceivers()
delete all reciever objects
Definition: plugingui.h:808
CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse move event
Definition: plugingui.cpp:2644
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:1859
void checkRemoveWriteableControl(CControl *control)
check to see if we already store this meter control and remove it if we do
Definition: plugingui.h:788
PluginParameter refGuiControl
single parameter with this control tag
Definition: plugingui.h:402
void setPluginParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
safely set a plugin shell parameter with a GUI control
Definition: plugingui.h:578
CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState &buttons)
mouse down handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1207
IController * createSubController(UTF8StringPtr name, const IUIDescription *description) override
for advanced users: you can create and even register sub-controllers here
Definition: plugingui.cpp:2465
bool isControlListener
internal flag
Definition: plugingui.h:405
void forgetWriteableControls()
forget all writeable (neter) controls
Definition: plugingui.h:820
int32_t getControlID()
Definition: plugingui.h:321
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:1691
virtual void idle()
perform idling operation; called directly from timer thread
Definition: plugingui.cpp:641
CPoint maxSize
the max size of the GUI window
Definition: plugingui.h:530
std::string xmlFile
the XML file name
Definition: plugingui.h:523
void updateControlsWithActualValue(float actualValue, CControl *control=nullptr)
Definition: plugingui.h:240
AUEventListenerRef AUEventListener
AU ONLY: the event listener token.
Definition: plugingui.h:619
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:660
void updateGUIControlVST(int tag, float normalizedValue)
set the GUI control from the VST parameter
Definition: plugingui.cpp:1409