ASPiK SDK
plugingui.h
Go to the documentation of this file.
1  // -----------------------------------------------------------------------------
2 // ASPiK Plugin Kernel File: plugingui.h
3 //
12 // -----------------------------------------------------------------------------
13 #pragma once
14 #ifndef __PluginGUI__
15 #define __PluginGUI__
16 
17 #define DOXYDOC 1
18 
19 #ifdef DOXYDOC
20 
21 #define AUPLUGIN 1
22 #define AAXPLUGIN 1
23 #define VSTPLUGIN 1
24 #define RAFXPLUGIN 1
25 
26 #endif
27 
28 // --- custom VSTGUI4 derived classes
29 #include "customcontrols.h"
30 
31 // --- VSTGUI
32 #include "vstgui/vstgui.h"
33 #include "vstgui/uidescription/uiviewswitchcontainer.h"
34 #include "vstgui/vstgui_uidescription.h"
35 #include "vstgui/lib/crect.h"
36 
37 // --- 4.9
38 #include "vstgui/uidescription/cstream.h"
39 
40 // --- 4.10 new way to initialize the library
41 #include "vstgui/lib/vstguiinit.h"
42 
43 #if VSTGUI_LIVE_EDITING
44 #include "vstgui/uidescription/editing/uieditcontroller.h"
45 #include "vstgui/uidescription/editing/uieditmenucontroller.h"
46 #endif
47 
48 #ifdef AUPLUGIN
49 #import <CoreFoundation/CoreFoundation.h>
50 #import <AudioUnit/AudioUnit.h>
51 #import <AudioToolbox/AudioToolbox.h>
52 #endif
53 
54 #ifdef AAXPLUGIN
55 #include "AAX_IEffectParameters.h"
56 #include "AAXtoVSTGUIButtonState.h"
57 #endif
58 
59 // --- plugin stuff
60 #include "pluginparameter.h"
61 
62 // --- std::
63 #include <sstream>
64 #include <algorithm>
65 #include <functional>
66 #include <cctype>
67 #include <locale>
68 #include <map>
69 
70 // --- const for host choice knob mode
71 const uint32_t kHostChoice = 3;
72 
73 namespace VSTGUI {
74 
90 {
91 public:
93  ControlUpdateReceiver(CControl* control, PluginParameter* pluginParameterPtr, bool _isControlListener)
94  {
95  hasRefGuiControl = pluginParameterPtr ? true : false;
96 
98  refGuiControl = *pluginParameterPtr;
99 
100  addControl(control);
101  isControlListener = _isControlListener;
102  }
103 
106  {
107  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
108  {
109  CControl* ctrl = *it;
110  ctrl->forget();
111  }
112  }
113 
118  bool hasControl(CControl* control)
119  {
120  return std::find(guiControls.begin (), guiControls.end (), control) != guiControls.end ();
121  }
122 
126  void addControl(CControl* control)
127  {
128  if(hasControl(control))
129  return;
130 
131  control->remember();
132  guiControls.push_back(control);
133 
134  // --- set default value (rather than from XML, which is a pain because it must be normalized)
135  if(hasRefGuiControl)
136  {
137  float normalizedValue = (float)refGuiControl.getDefaultValueNormalized();
138  control->setDefaultValue(normalizedValue);
139  }
140  }
141 
145  void removeControl(CControl* control)
146  {
147  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
148  {
149  CControl* ctrl = *it;
150  if(ctrl == control)
151  {
152  ctrl->forget();
153  guiControls.erase(it);
154  return;
155  }
156  }
157  }
158 
164  {
165  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
166  {
167  CControl* ctrl = *it;
168  if(ctrl && ctrl->isEditing())
169  return true;
170  }
171  return false;
172  }
173 
178  float getActualValueWithNormalizedValue(float normalizedValue)
179  {
180  if (hasRefGuiControl)
181  {
182  if (normalizedValue == (float)refGuiControl.getDefaultValueNormalized())
183  {
184  return (float)refGuiControl.getDefaultValue();
185  }
186  }
187 
188  return (float)refGuiControl.getControlValueWithNormalizedValue(normalizedValue);
189  }
190 
195  float getNormalizedValueWithActualValue(float actualValue)
196  {
197  return (float)refGuiControl.getNormalizedControlValueWithActualValue(actualValue);
198  }
199 
203  void updateControlsWithControl(CControl* control)
204  {
205  updateControlsWithActualValue(getActualValueWithNormalizedValue(control->getValueNormalized()), control);
206  }
207 
212  void updateControlsWithNormalizedValue(float normalizedValue, CControl* control = nullptr)
213  {
214  // --- is this the defalt value?
215  if (hasRefGuiControl)
216  {
217  if (normalizedValue == (float)refGuiControl.getDefaultValueNormalized())
218  {
220  return;
221  }
222  }
223 
225  }
226 
230  void initControl(CControl* control)
231  {
232  float actualValue = (float)refGuiControl.getControlValue();
233  updateControlsWithActualValue(actualValue, control);
234  }
235 
240  void updateControlsWithActualValue(float actualValue, CControl* control = nullptr)
241  {
242  // --- eliminiate glitching from AAX parameter loop
243  if(!control && controlInRxGroupIsEditing())
244  return;
245 
246  // --- store on our reference control
247  refGuiControl.setControlValue(actualValue);
248 
249  // --- synchoronize all controls that share this controlID
250  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
251  {
252  CControl* guiCtrl = *it;
253  if(guiCtrl && control != guiCtrl) // nned the check for XY pads
254  {
255  // --- need to take care of multiple control types, slight differences in setup
256  CTextLabel* label = dynamic_cast<CTextLabel*>(guiCtrl);
257  COptionMenu* oMenu = dynamic_cast<COptionMenu*>(guiCtrl);
258  CXYPadEx* xyPad = dynamic_cast<CXYPadEx*>(guiCtrl);
259  CVuMeter* meter = dynamic_cast<CVuMeter*>(guiCtrl);
260 
261  if(meter)
262  {
263  continue;
264  }
265  else if(label)
266  {
267  label->setText(refGuiControl.getControlValueAsString().c_str());
268  label->invalid();
269  }
270  else if(oMenu)
271  {
272  // --- current rafx GUI Designer does not set max to anything
273  guiCtrl->setMin((float)refGuiControl.getGUIMin());
274  guiCtrl->setMax((float)refGuiControl.getGUIMin());
275 
276  // --- load for first time, NOT dynamic loading here
277  oMenu->removeAllEntry();
278 
279  for (uint32_t i = 0; i < refGuiControl.getStringCount(); i++)
280  {
281  oMenu->addEntry(refGuiControl.getStringByIndex(i).c_str(), i);
282  }
283 
284  oMenu->setValue((float)refGuiControl.getControlValue());
285  }
286  else if(xyPad)
287  {
288  float x = 0.f;
289  float y = 0.f;
290  xyPad->calculateXY(xyPad->getValue(), x, y);
291 
292  // --- retrieve the X and Y tags on the CXYPadEx
293  int32_t tagX = xyPad->getTagX();
294  int32_t tagY = xyPad->getTagY();
295 
296  if(tagX == refGuiControl.getControlID())
298  if(tagY == refGuiControl.getControlID())
300 
301  if(tagX >= 0 && tagY >= 0 && !guiCtrl->isEditing())
302  xyPad->setValue(xyPad->calculateValue(x, y));
303  }
304  else if(!guiCtrl->isEditing())
305  guiCtrl->setValueNormalized((float)refGuiControl.getControlValueNormalized());
306 
307  guiCtrl->invalid();
308  }
309  }
310  }
311 
317 
321  int32_t getControlID(){ return refGuiControl.getControlID(); }
322 
327  inline bool controlAndContainerVisible(CControl* ctrl)
328  {
329  if(!ctrl) return false;
330 
331  bool stickyVisible = ctrl->isVisible();
332 
333  if(!stickyVisible)
334  return false;
335 
336  // --- check parents
337  CView* parent = ctrl->getParentView();
338  while(parent)
339  {
340  stickyVisible = parent->isVisible();
341  if(!stickyVisible)
342  return false;
343 
344  parent = parent->getParentView();
345  }
346  return stickyVisible;
347  }
348 
354  int getControlID_WithMouseCoords(const CPoint& where)
355  {
356  CPoint mousePoint = where;
357 
358  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
359  {
360  CControl* ctrl = *it;
361  if(ctrl && controlAndContainerVisible(ctrl))
362  {
363  CPoint point = ctrl->frameToLocal(mousePoint);
364  CRect rect = ctrl->getViewSize();
365  if(rect.pointInside(point))
366  {
367  int tag = ctrl->getTag();
368  if(isReservedTag(tag))
369  return -1;
370  else
371  return tag;
372  }
373  }
374  }
375  return -1;
376  }
377 
383  CControl* getControl_WithMouseCoords(const CPoint& where)
384  {
385  CPoint mousePoint = where;
386 
387  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
388  {
389  CControl* ctrl = *it;
390  if(ctrl && controlAndContainerVisible(ctrl))
391  {
392  CPoint point = ctrl->frameToLocal(mousePoint);
393  CRect rect = ctrl->getViewSize();
394  if(rect.pointInside(point))
395  return ctrl;
396  }
397  }
398  return nullptr;
399  }
400 
401 protected:
403  std::vector<CControl*> guiControls;
404  bool hasRefGuiControl = false;
405  bool isControlListener = false;
406 };
407 
408 
434 class PluginGUI : public IController,
435  public IViewAddedRemovedObserver,
436  public IMouseObserver,
437  public IKeyboardHook,
438  public VSTGUIEditorInterface,
439  public CBaseObject,
440  public ICommandMenuItemTarget,
441  public IGUIView
442 {
443 
444 public:
446  PluginGUI(UTF8StringPtr _xmlFile);
447 
449  virtual ~PluginGUI();
450 
452  bool open(UTF8StringPtr _viewName,
453  void* parent,
454  const std::vector<PluginParameter*>* pluginParameterPtr,
455  const PlatformType& platformType = PlatformType::kDefaultNative,
456  IGUIPluginConnector* _guiPluginConnector = nullptr,
457  void* data = nullptr);
458 
460  void close();
461 
463  void syncGUIControl(uint32_t controlID);
464 
466  void getSize(float& width, float& height);
467 
469  void scaleGUISize(uint32_t controlValue);
470 
472  void writeToPresetFile();
473 
476 
477 protected:
479  virtual void idle();
480 
482  void preCreateGUI();
483 
485  bool createGUI(bool bShowGUIEditor);
486 
488  void save(bool saveAs = false);
489 
491  virtual int32_t getKnobMode() const override;
492 
495  {
496  for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
497  delete *it;
498  }
499  pluginParameters.clear();
500  }
501 
510  {
511  for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
512  PluginParameter* ctrl = *it;
513  if(ctrl->getControlID() == tag)
514  return ctrl;
515  }
516  return nullptr;
517  }
518 
519  // --- protected variables
521  UIDescription* description = nullptr;
522  std::string viewName;
523  std::string xmlFile;
524 
525  uint32_t numUIControls = 0;
526  double zoomFactor = 1.0;
527  CVSTGUITimer* timer;
528 
529  CPoint minSize;
530  CPoint maxSize;
531  CRect nonEditRect;
532 
533  // --- flags for showing view
534  bool showGUIEditor = false;
535  bool createNewView = true;
536 
539  float guiWidth;
540  float guiHeight;
541 
543  CFrame* guiEditorFrame = nullptr;
544  uint32_t knobAction = kLinearMode;
545 
547  std::string getGUIDesignerSize();
548 
550  int getControlID_WithMouseCoords(const CPoint& where);
551 
553  CControl* getControl_WithMouseCoords(const CPoint& where);
554 
556  CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState& buttons);
557 
559  CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState& buttons, const CPoint& where);
560 
562  CMouseEventResult sendAUMouseDown(CControl* control, const CButtonState& buttons);
563 
565  CMouseEventResult sendAUMouseMoved(CControl* control, const CButtonState& buttons, const CPoint& where) { return kMouseEventNotImplemented; }
566 
578  void setPluginParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue)
579  {
580 #ifdef AUPLUGIN
581  setAUEventFromGUIControl(control, tag, actualValue);
582 #endif
583 
584 #ifdef AAXPLUGIN
585  setAAXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
586 #endif
587 
588 #ifdef VSTPLUGIN
589  setVSTParameterFromGUIControl(control, tag, actualValue, normalizedValue);
590 #endif
591 
592 #ifdef RAFXPLUGIN
593  setRAFXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
594 #endif
595 }
596 
600 #ifdef AAXPLUGIN
601 public:
606  void setAAXViewContainer(AAX_IViewContainer* _aaxViewContainer){ aaxViewContainer = _aaxViewContainer;}
607 
609  void setAAXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
610 
612  void updateGUIControlAAX(int tag, float actualPluginValue, float normalizedValue = 0.f, bool useNormalized = false);
613 protected:
614 #endif
615 
616 
617 #ifdef AUPLUGIN
618  AudioUnit m_AU;
619  AUEventListenerRef AUEventListener;
620 
621 public:
623  void dispatchAUControlChange(int tag, float actualPluginValue, int message = -1, bool fromEventListener = false);
624 
628  void setAU(AudioUnit inAU){m_AU = inAU;}
629 
630 protected:
632  void setAUEventFromGUIControl(CControl* control, int tag, float normalizedValue);
633 #endif
634 
635 #ifdef VSTPLUGIN
636 
637  void setVSTParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
638 
640  void updateGUIControlVST(int tag, float normalizedValue);
641 #endif
642 
643 #ifdef RAFXPLUGIN
644 
645  void setRAFXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
646 
648  void updateGUIControlRAFX(int tag, float normalizedValue);
649 #endif
650 
651 
652 public:
654  CMessageResult notify(CBaseObject* sender, IdStringPtr message) override;
655 
657  virtual void valueChanged(VSTGUI::CControl* pControl) override;
658 
660  virtual int32_t controlModifierClicked(VSTGUI::CControl* pControl, VSTGUI::CButtonState button) override { return 0; }
661 
663  virtual void controlBeginEdit(VSTGUI::CControl* pControl) override;
664 
666  virtual void controlEndEdit(VSTGUI::CControl* pControl) override;
667 
669  virtual void controlTagWillChange(VSTGUI::CControl* pControl) override;
670 
672  virtual void controlTagDidChange(VSTGUI::CControl* pControl) override;
673 #if DEBUG
674 
675  virtual char controlModifierClicked(VSTGUI::CControl* pControl, long button) { return 0; }
676 #endif
677 
679  CView* createUserCustomView(std::string viewname, const CRect rect, IControlListener* listener, int32_t tag);
680 
682  CView* createView(const UIAttributes& attributes, const IUIDescription* description) override;
683 
685  IController* createSubController(UTF8StringPtr name, const IUIDescription* description) override;
686 
688  ControlUpdateReceiver* getControlUpdateReceiver(int32_t tag) const;
689 
691  void onViewAdded(CFrame* frame, CView* view) override {}
692 
694  void onViewRemoved(CFrame* frame, CView* view) override;
695 
697  void onMouseEntered(CView* view, CFrame* frame) override {}
698 
700  void onMouseExited(CView* view, CFrame* frame) override {}
701 
703  CMouseEventResult onMouseDown(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
704 
706  CMouseEventResult onMouseMoved(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
707 
709  int32_t onKeyDown(const VstKeyCode& code, CFrame* frame) override { return -1; }
710 
712  int32_t onKeyUp(const VstKeyCode& code, CFrame* frame) override { return -1; }
713 
715  virtual bool validateCommandMenuItem(CCommandMenuItem* item) override;
716 
718  virtual bool onCommandMenuItemSelected(CCommandMenuItem* item) override;
719 
726  virtual void setGUIWindowFrame(IGUIWindowFrame* frame) override
727  {
728  // --- we keep for resiging here
729  guiWindowFrame = frame;
730  }
731 
737  inline static bool parseSize (const std::string& str, CPoint& point)
738  {
739  size_t sep = str.find (',', 0);
740  if (sep != std::string::npos)
741  {
742  point.x = strtol (str.c_str (), 0, 10);
743  point.y = strtol (str.c_str () + sep+1, 0, 10);
744  return true;
745  }
746  return false;
747  }
748 
749  // --- for Meters only right now, but could be used to mark any control as writeable
757  bool hasWriteableControl(CControl* control)
758  {
759  return std::find (writeableControls.begin (), writeableControls.end (), control) != writeableControls.end ();
760  }
761 
768  void checkAddWriteableControl(PluginParameter* piParam, CControl* control)
769  {
770  if(!piParam)
771  return;
772  if(!control)
773  return;
774  if(!piParam->getIsWritable())
775  return;
776  if(!hasWriteableControl(control))
777  {
778  writeableControls.push_back(control);
779  control->remember();
780  }
781  }
782 
788  void checkRemoveWriteableControl(CControl* control)
789  {
790  if(!hasWriteableControl(control)) return;
791 
792  for(std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
793  {
794  CControl* ctrl = *it;
795  if(ctrl == control)
796  {
797  ctrl->forget();
798  writeableControls.erase(it);
799  return;
800  }
801  }
802  }
803 
804 
809  {
810  for (ControlUpdateReceiverMap::const_iterator it = controlUpdateReceivers.begin(), end = controlUpdateReceivers.end(); it != end; ++it)
811  {
812  delete it->second;
813  }
814  controlUpdateReceivers.clear();
815  }
816 
821  {
822  for (std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
823  {
824  CControl* ctrl = *it;
825  ctrl->forget();
826  }
827  writeableControls.clear();
828  }
829 
837  bool hasICustomView(CView* view)
838  {
839  ICustomView* customView = dynamic_cast<ICustomView*>(view);
840  if (customView)
841  return true;
842  return false;
843  }
844 
852  bool hasICustomView(IController* subController)
853  {
854  ICustomView* customView = dynamic_cast<ICustomView*>(subController);
855  if (customView)
856  return true;
857  return false;
858  }
859 
860 private:
861  typedef std::map<int32_t, ControlUpdateReceiver*> ControlUpdateReceiverMap;
862  ControlUpdateReceiverMap controlUpdateReceivers;
863  std::vector<CControl*> writeableControls;
864  std::vector<PluginParameter*> pluginParameters;
865 
866 #ifdef AAXPLUGIN
867  AAX_IViewContainer* aaxViewContainer = nullptr;
868 #endif
869 };
870 
871 }
872 
873 #endif
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&#39;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&#39;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
provided by AVID in the VSTGUI example in SDK
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&#39;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&#39;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