ASPiK SDK
Loading...
Searching...
No Matches
VSTGUI::KnobLinkController Class Reference

This object demonstrates how to create a sub-controller. In this object, you can link multiple knob controls together so that moving one control moves all of them. There is an associated button used to enable/disable the linking operation. More...

#include <customviews.h>

Inheritance diagram for VSTGUI::KnobLinkController:

Public Member Functions

 KnobLinkController (IController *_parentController)
 
bool isLinkedControl (CControl *control)
 
virtual CView * verifyView (CView *view, const UIAttributes &attributes, const IUIDescription *description) override
 
virtual void valueChanged (CControl *control) override
 
virtual CView * createView (const UIAttributes &attributes, const IUIDescription *description) override
 
virtual void controlBeginEdit (CControl *pControl) override
 
virtual void controlEndEdit (CControl *pControl) override
 
virtual void controlTagWillChange (CControl *pControl) override
 
virtual void controlTagDidChange (CControl *pControl) override
 

Protected Types

typedef std::vector< CAnimKnob * > KnobList
 list of knobs
 

Protected Attributes

IController * parentController = nullptr
 pointer to owning listener
 
CTextButton * linkControl = nullptr
 the link button is defined as a CTextButton (by me)
 
KnobList linkedKnobs
 
bool linkControls = false
 enable linking
 

Detailed Description

This object demonstrates how to create a sub-controller. In this object, you can link multiple knob controls together so that moving one control moves all of them. There is an associated button used to enable/disable the linking operation.

  • Subcontroller that links some number of CAnimKnobs so that when linked turning one knobs turns all of the rest of the linked knobs regardless of their control tags
  • use the sub-controller string "KnobLinkController" for the view view container that holds the knobs to link; there can only be one KnobLinkController for each view container
  • To hard-wire the linkage, set the flag in the constructor
  • To make linkage variable, a CTextButton must be used as the switcher; you can easily change that by changing the code involving the linkControl variable
  • the verifyView( ) function gets called once per child view of the outer continer; this is where we save the linker control (button) and push the CAnimKnob controls onto our vector
  • the valueChanged( ) function gets called when any of the view containers sub controls are moved; we only stash and control the CAnimKnobs so you can mix other controls in the same view container that won't be affected
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Constructor & Destructor Documentation

◆ KnobLinkController()

VSTGUI::KnobLinkController::KnobLinkController ( IController *  _parentController)
inline

KnobLinkController constructor

Parameters
_parentController- pointer to the parent controller so we can forward messages to it

Member Function Documentation

◆ controlBeginEdit()

virtual void VSTGUI::KnobLinkController::controlBeginEdit ( CControl *  pControl)
inlineoverridevirtual

called when the user begins to edit a control (mouse click) - we simply forward the call to the parent listener

Parameters
pControl- the control

◆ controlEndEdit()

virtual void VSTGUI::KnobLinkController::controlEndEdit ( CControl *  pControl)
inlineoverridevirtual

called when the user ends editing a control (mouse released) - we simply forward the call to the parent listener

Parameters
pControl- the control

◆ controlTagDidChange()

virtual void VSTGUI::KnobLinkController::controlTagDidChange ( CControl *  pControl)
inlineoverridevirtual

register the control update receiver objects that allow us to ultimately bind GUI controls to plugin variables (thread-safe of course)

Parameters
pControl- the control

◆ controlTagWillChange()

virtual void VSTGUI::KnobLinkController::controlTagWillChange ( CControl *  pControl)
inlineoverridevirtual

register the control update receiver objects that allow us to ultimately bind GUI controls to plugin variables (thread-safe of course)

Parameters
pControl- the control

◆ createView()

virtual CView * VSTGUI::KnobLinkController::createView ( const UIAttributes &  attributes,
const IUIDescription *  description 
)
inlineoverridevirtual

called once per child view of the container - we simply forward the call to the parent listener

Parameters
attributes- UIAttributes of control
IUIDescription- IUIDescription of control
Returns
the verified view

◆ isLinkedControl()

bool VSTGUI::KnobLinkController::isLinkedControl ( CControl *  control)
inline

test to see if control is in the list of linked controls

Parameters
control- control to test
Returns
true if control is in list, false otherwise

◆ valueChanged()

virtual void VSTGUI::KnobLinkController::valueChanged ( CControl *  control)
inlineoverridevirtual

called when any control in the view container changes; we only care about the link button and the knobs, we ignore the others view objects that we want to link

Parameters
control- the control whose value changed

◆ verifyView()

virtual CView * VSTGUI::KnobLinkController::verifyView ( CView *  view,
const UIAttributes &  attributes,
const IUIDescription *  description 
)
inlineoverridevirtual

called once per child view of the container that owns the sub-controller this is where we grab and store the view objects that we want to link

Parameters
view- the newly created view to use
attributes- UIAttributes of control
IUIDescription- IUIDescription of control
Returns
the verified view

The documentation for this class was generated from the following file: