32 #include "vstgui/vstgui.h" 33 #include "vstgui/uidescription/uiviewswitchcontainer.h" 34 #include "vstgui/vstgui_uidescription.h" 35 #include "vstgui/lib/crect.h" 37 #if VSTGUI_LIVE_EDITING 38 #include "vstgui/uidescription/editing/uieditcontroller.h" 39 #include "vstgui/uidescription/editing/uieditmenucontroller.h" 43 #import <CoreFoundation/CoreFoundation.h> 44 #import <AudioUnit/AudioUnit.h> 45 #import <AudioToolbox/AudioToolbox.h> 49 #include "AAX_IEffectParameters.h" 65 const uint32_t kHostChoice = 3;
103 CControl* ctrl = *it;
132 control->setDefaultValue(normalizedValue);
143 CControl* ctrl = *it;
161 CControl* ctrl = *it;
162 if(ctrl && ctrl->isEditing())
228 CControl* guiCtrl = *it;
229 if(guiCtrl && control != guiCtrl)
232 CTextLabel* label =
dynamic_cast<CTextLabel*
>(guiCtrl);
233 COptionMenu* oMenu =
dynamic_cast<COptionMenu*
>(guiCtrl);
235 CVuMeter* meter =
dynamic_cast<CVuMeter*
>(guiCtrl);
253 oMenu->removeAllEntry();
266 xyPad->calculateXY(xyPad->getValue(), x, y);
269 int32_t tagX = xyPad->getTagX();
270 int32_t tagY = xyPad->getTagY();
277 if(tagX >= 0 && tagY >= 0 && !guiCtrl->isEditing())
278 xyPad->
setValue(xyPad->calculateValue(x, y));
280 else if(!guiCtrl->isEditing())
305 if(!ctrl)
return false;
307 bool stickyVisible = ctrl->isVisible();
313 CView* parent = ctrl->getParentView();
316 stickyVisible = parent->isVisible();
320 parent = parent->getParentView();
322 return stickyVisible;
332 CPoint mousePoint = where;
336 CControl* ctrl = *it;
339 CPoint point = ctrl->frameToLocal(mousePoint);
340 CRect rect = ctrl->getViewSize();
341 if(rect.pointInside(point))
343 int tag = ctrl->getTag();
361 CPoint mousePoint = where;
365 CControl* ctrl = *it;
368 CPoint point = ctrl->frameToLocal(mousePoint);
369 CRect rect = ctrl->getViewSize();
370 if(rect.pointInside(point))
411 public IViewAddedRemovedObserver,
412 public IMouseObserver,
413 public IKeyboardHook,
414 public VSTGUIEditorInterface,
427 bool open(UTF8StringPtr _viewName,
429 const std::vector<PluginParameter*>* pluginParameterPtr,
430 const PlatformType& platformType = kDefaultNative,
432 void* data =
nullptr);
441 void getSize(
float& width,
float& height);
460 void save(
bool saveAs =
false);
468 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
471 pluginParameters.clear();
483 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
528 CMouseEventResult
sendAAXMouseDown(
int controlID,
const CButtonState& buttons);
531 CMouseEventResult
sendAAXMouseMoved(
int controlID,
const CButtonState& buttons,
const CPoint& where);
534 CMouseEventResult
sendAUMouseDown(CControl* control,
const CButtonState& buttons);
537 CMouseEventResult
sendAUMouseMoved(CControl* control,
const CButtonState& buttons,
const CPoint& where) {
return kMouseEventNotImplemented; }
553 setAUEventFromGUIControl(control, tag, actualValue);
557 setAAXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
561 setVSTParameterFromGUIControl(control, tag, actualValue, normalizedValue);
565 setRAFXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
578 void setAAXViewContainer(AAX_IViewContainer* _aaxViewContainer){ aaxViewContainer = _aaxViewContainer;}
581 void setAAXParameterFromGUIControl(CControl* control,
int tag,
float actualValue,
float normalizedValue);
584 void updateGUIControlAAX(
int tag,
float actualPluginValue,
float normalizedValue = 0.f,
bool useNormalized =
false);
591 AUEventListenerRef AUEventListener;
595 void dispatchAUControlChange(
int tag,
float actualPluginValue,
int message = -1,
bool fromEventListener =
false);
600 void setAU(AudioUnit inAU){m_AU = inAU;}
604 void setAUEventFromGUIControl(CControl* control,
int tag,
float normalizedValue);
609 void setVSTParameterFromGUIControl(CControl* control,
int tag,
float actualValue,
float normalizedValue);
612 void updateGUIControlVST(
int tag,
float normalizedValue);
617 void setRAFXParameterFromGUIControl(CControl* control,
int tag,
float actualValue,
float normalizedValue);
620 void updateGUIControlRAFX(
int tag,
float normalizedValue);
626 CMessageResult
notify(CBaseObject* sender, IdStringPtr message)
override;
629 virtual void valueChanged(VSTGUI::CControl* pControl)
override;
651 CView*
createUserCustomView(std::string viewname,
const CRect rect, IControlListener* listener, int32_t tag);
675 CMouseEventResult
onMouseDown(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
678 CMouseEventResult
onMouseMoved(CFrame* frame,
const CPoint& where,
const CButtonState& buttons)
override;
681 int32_t
onKeyDown(
const VstKeyCode& code, CFrame* frame)
override {
return -1; }
684 int32_t
onKeyUp(
const VstKeyCode& code, CFrame* frame)
override {
return -1; }
703 inline static bool parseSize (
const std::string& str, CPoint& point)
705 size_t sep = str.find (
',', 0);
706 if (sep != std::string::npos)
708 point.x = strtol (str.c_str (), 0, 10);
709 point.y = strtol (str.c_str () + sep+1, 0, 10);
725 return std::find (writeableControls.begin (), writeableControls.end (), control) != writeableControls.end ();
744 writeableControls.push_back(control);
758 for(std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
760 CControl* ctrl = *it;
764 writeableControls.erase(it);
776 for (ControlUpdateReceiverMap::const_iterator it = controlUpdateReceivers.begin(), end = controlUpdateReceivers.end(); it != end; ++it)
780 controlUpdateReceivers.clear();
788 for (std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
790 CControl* ctrl = *it;
793 writeableControls.clear();
827 typedef std::map<int32_t, ControlUpdateReceiver*> ControlUpdateReceiverMap;
828 ControlUpdateReceiverMap controlUpdateReceivers;
829 std::vector<CControl*> writeableControls;
830 std::vector<PluginParameter*> pluginParameters;
833 AAX_IViewContainer* aaxViewContainer =
nullptr;
double getControlValue()
the main function to access the underlying atomic double value
Definition: pluginparameter.h:167
CVSTGUITimer * timer
timer object (this is platform dependent)
Definition: plugingui.h:499
IGUIPluginConnector * guiPluginConnector
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs ...
Definition: plugingui.h:492
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:734
bool hasICustomView(IController *subController)
simple helper function to test sub-controller for ICustomView
Definition: plugingui.h:818
IGUIWindowFrame * guiWindowFrame
interface to allow plugin shell to resize our window
Definition: plugingui.h:514
CControl * getControl_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:359
virtual void setValue(float val) override
Definition: customcontrols.cpp:1189
const PluginParameter getGuiControl()
Definition: plugingui.h:292
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX...
Definition: plugingui.h:410
bool createGUI(bool bShowGUIEditor)
creates either the GUI or the GUI Designer
Definition: plugingui.cpp:752
void updateControlsWithControl(CControl *control)
Definition: plugingui.h:189
~ControlUpdateReceiver()
Definition: plugingui.h:99
uint32_t numUIControls
control counter
Definition: plugingui.h:497
void save(bool saveAs=false)
save GUI state in XML file
Definition: plugingui.cpp:884
float getActualValueWithNormalizedValue(float normalizedValue)
Definition: plugingui.h:172
virtual void controlEndEdit(VSTGUI::CControl *pControl) override
end of control/auomation notification
Definition: plugingui.cpp:1607
void getSize(float &width, float &height)
returns the size into the pass-by-reference variables
Definition: plugingui.cpp:438
PluginGUI(UTF8StringPtr _xmlFile)
PluginGUI constructor; note that this maintains both Mac and Windows contexts, the bundle ref for Mac...
Definition: plugingui.cpp:136
double getControlValueNormalized()
get control value as normalied value
Definition: pluginparameter.h:279
void removeControl(CControl *control)
Definition: plugingui.h:139
bool getIsWritable()
query writable control (meter)
Definition: pluginparameter.h:152
void syncGUIControl(uint32_t controlID)
safely sets the GUI control value based on the plugin parameter value
Definition: plugingui.cpp:380
uint32_t getControlID()
get ID value
Definition: pluginparameter.h:81
std::string getGUIDesignerSize()
get size string
Definition: plugingui.cpp:991
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:451
double getGUIMin()
Definition: pluginparameter.h:345
void deleteGUIControlList()
Definition: plugingui.h:466
bool showGUIEditor
show the GUI designer
Definition: plugingui.h:506
double guiDesignerWidth
GUI Designer's frame size.
Definition: plugingui.h:509
void onViewRemoved(CFrame *frame, CView *view) override
called before GUI control is removed from the view
Definition: plugingui.cpp:2455
double zoomFactor
scaling factor for built-in scaling
Definition: plugingui.h:498
CMouseEventResult sendAUMouseDown(CControl *control, const CButtonState &buttons)
mouse down handler for AU automation
Definition: plugingui.cpp:1141
void addControl(CControl *control)
Definition: plugingui.h:120
bool hasWriteableControl(CControl *control)
check to see if we already store this meter control
Definition: plugingui.h:723
bool controlAndContainerVisible(CControl *ctrl)
Definition: plugingui.h:303
void preCreateGUI()
one-time pre-create init, currently used for AU only
Definition: plugingui.cpp:682
CRect nonEditRect
non-edit area for GUI designer
Definition: plugingui.h:503
void updateControlsWithNormalizedValue(float normalizedValue, CControl *control=nullptr)
Definition: plugingui.h:198
int getControlID_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1016
bool controlInRxGroupIsEditing()
Definition: plugingui.h:157
std::string getStringByIndex(uint32_t index)
get string-list string by index
Definition: pluginparameter.cpp:281
float getNormalizedValueWithActualValue(float actualValue)
Definition: plugingui.h:181
CFrame * guiEditorFrame
pointer to our frame
Definition: plugingui.h:515
CMouseEventResult sendAUMouseMoved(CControl *control, const CButtonState &buttons, const CPoint &where)
Definition: plugingui.h:537
float guiWidth
embedded GUI size
Definition: plugingui.h:511
void close()
prepares the GUI control objects for destruction, cleans up
Definition: plugingui.cpp:338
int32_t onKeyDown(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:681
CPoint minSize
the min size of the GUI window
Definition: plugingui.h:501
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner...
Definition: pluginstructures.h:1219
float guiHeight
embedded GUI size
Definition: plugingui.h:512
double getControlValueWithNormalizedValue(double normalizedValue, bool applyTaper=true)
get the new control value as if it were set with a normalized value
Definition: pluginparameter.h:305
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1141
bool hasRefGuiControl
internal flag
Definition: plugingui.h:380
virtual void controlTagDidChange(VSTGUI::CControl *pControl) override
called when a control is being created on the GUI (step 2)
Definition: plugingui.cpp:1663
bool isReservedTag(int tag)
check to see if a tag is reserved: ASPiK defines several reserved control ID values.
Definition: guiconstants.h:49
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:514
std::string viewName
name
Definition: plugingui.h:494
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:1757
int getControlID_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:330
uint32_t knobAction
knob mode
Definition: plugingui.h:516
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
incoming VSTGUI4 message handler
Definition: plugingui.cpp:1325
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:1454
double getDefaultValueNormalized()
get default value as normalied value
Definition: pluginparameter.h:253
void onMouseEntered(CView *view, CFrame *frame) override
Definition: plugingui.h:669
virtual void controlBeginEdit(VSTGUI::CControl *pControl) override
start of control/auomation notification
Definition: plugingui.cpp:1576
void onMouseExited(CView *view, CFrame *frame) override
Definition: plugingui.h:672
ControlUpdateReceiver(CControl *control, PluginParameter *pluginParameterPtr, bool _isControlListener)
Definition: plugingui.h:87
CControl * getControl_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1041
The ControlUpdateReceiver object is the connection mechanism between PluginParameter objects and thei...
Definition: plugingui.h:83
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 ...
Definition: plugingui.cpp:221
base class interface file for ASPiK pluginparameter object
bool hasICustomView(CView *view)
simple helper function to test view for ICustomView
Definition: plugingui.h:803
int32_t onKeyUp(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:684
bool hasControl(CControl *control)
Definition: plugingui.h:112
CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState &buttons, const CPoint &where)
mouse moved handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1106
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:2432
virtual ~PluginGUI()
PluginGUI destructor.
Definition: plugingui.cpp:189
std::vector< CControl * > guiControls
list of controls that share the control tag with this one
Definition: plugingui.h:379
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:692
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:1200
void initControl(CControl *control)
Definition: plugingui.h:206
bool createNewView
show the normal GUI
Definition: plugingui.h:507
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer...
Definition: pluginstructures.h:1176
CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse down event
Definition: plugingui.cpp:2516
virtual int32_t getKnobMode() const override
returns mode
Definition: plugingui.cpp:972
double guiDesignerHeight
GUI Designer's frame size.
Definition: plugingui.h:510
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:545
void onViewAdded(CFrame *frame, CView *view) override
Definition: plugingui.h:663
static bool parseSize(const std::string &str, CPoint &point)
simple helper function to get size from string
Definition: plugingui.h:703
PluginParameter * getGuiControlWithTag(int tag)
find the local PluginParameter that is connected to the same control ID
Definition: plugingui.h:481
double getNormalizedControlValueWithActualValue(double actualValue)
get the new normalized control value as if it were set with an actual value
Definition: pluginparameter.h:342
UIDescription * description
the description version of the XML file
Definition: plugingui.h:493
void deleteControlUpdateReceivers()
delete all reciever objects
Definition: plugingui.h:774
CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse move event
Definition: plugingui.cpp:2577
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:1795
void checkRemoveWriteableControl(CControl *control)
check to see if we already store this meter control and remove it if we do
Definition: plugingui.h:754
PluginParameter refGuiControl
single parameter with this control tag
Definition: plugingui.h:378
void setPluginParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
safely set a plugin shell parameter with a GUI control
Definition: plugingui.h:550
CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState &buttons)
mouse down handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1072
IController * createSubController(UTF8StringPtr name, const IUIDescription *description) override
for advanced users: you can create and even register sub-controllers here
Definition: plugingui.cpp:2401
bool isControlListener
internal flag
Definition: plugingui.h:381
void forgetWriteableControls()
forget all writeable (neter) controls
Definition: plugingui.h:786
int32_t getControlID()
Definition: plugingui.h:297
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:1639
virtual void idle()
perform idling operation; called directly from timer thread
Definition: plugingui.cpp:646
CPoint maxSize
the max size of the GUI window
Definition: plugingui.h:502
std::string xmlFile
the XML file name
Definition: plugingui.h:495
void updateControlsWithActualValue(float actualValue, CControl *control=nullptr)
Definition: plugingui.h:216
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:632