foleys_gui_magic
WYSWYG editor for JUCE GUIs including Visualisers
Public Member Functions | List of all members
MagicGUIState Class Reference

The MagicGuiState is the docking station for the MagicGUIBuilder. More...

+ Inheritance diagram for MagicGUIState:

Public Member Functions

 MagicGUIState ()
 
virtual ~MagicGUIState ()
 
juce::ValueTree getPropertyRoot ()
 Returns the root node for exposed properties for the GUI. More...
 
juce::ValueTree getPropertyRoot () const
 
void setGuiValueTree (const juce::ValueTree &dom)
 Set the GUI DOM to create the GUI components from. More...
 
void setGuiValueTree (const char *data, int dataSize)
 
void setGuiValueTree (const juce::File &file)
 
juce::ValueTree & getGuiTree ()
 Grants access to the gui tree. More...
 
juce::ValueTree & getValueTree ()
 
void setApplicationSettingsFile (juce::File file)
 Set a file to save common settings for all instances. More...
 
juce::ValueTree & getSettings ()
 This is a settings ValueTree that is stored globally for all plugin instances. More...
 
virtual juce::StringArray getParameterNames () const
 Returns the IDs of AudioProcessorParameters for selection. More...
 
virtual juce::RangedAudioParameter * getParameter (const juce::String &paramID)
 
virtual std::unique_ptr< juce::SliderParameterAttachment > createAttachment (const juce::String &paramID, juce::Slider &)
 
virtual std::unique_ptr< juce::ComboBoxParameterAttachment > createAttachment (const juce::String &paramID, juce::ComboBox &)
 
virtual std::unique_ptr< juce::ButtonParameterAttachment > createAttachment (const juce::String &paramID, juce::Button &)
 
virtual juce::PopupMenu createParameterMenu () const
 Return a hierarchical menu of the AudioParameters. More...
 
void addTrigger (const juce::Identifier &triggerID, std::function< void()> function)
 You can store a lambda that can be called from e.g. More...
 
std::function< void()> getTrigger (const juce::Identifier &triggerID)
 Returns a lambda to be connected to your components. More...
 
juce::Value getPropertyAsValue (const juce::String &pathToProperty)
 Returns a property as value inside the ValueTreeState. More...
 
void populatePropertiesMenu (juce::ComboBox &comboBox) const
 Populates a menu with properties found in the persistent ValueTree. More...
 
juce::PopupMenu createPropertiesMenu (juce::ComboBox &combo) const
 
juce::PopupMenu createTriggerMenu () const
 
juce::PopupMenu createAssetFilesMenu () const
 
template<typename T , typename... Ts>
T * createAndAddObject (const juce::Identifier &objectID, Ts &&... t)
 Create and add an object. More...
 
template<typename ObjectType >
juce::StringArray getObjectIDsByType () const
 Returns all identifiers of objects, that can be casted to the given type. More...
 
template<typename ObjectType >
ObjectType * getObjectWithType (juce::Identifier objectID)
 Return an object by objectID. More...
 
void prepareToPlay (double sampleRate, int samplesPerBlockExpected)
 Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup. More...
 
void addBackgroundProcessing (MagicPlotSource *source)
 Registers background processing. More...
 
juce::MidiKeyboardState & getKeyboardState ()
 
virtual juce::AudioProcessor * getProcessor ()
 Return the referenced AudioProcessor, if this state can provide one. More...
 

Detailed Description

The MagicGuiState is the docking station for the MagicGUIBuilder.

You can register properties or objects there, that your GuiItems will connect to. It is also the place, where the data for the visualisers is sent to, which are MagicPlotSources and MagicLevelSources.

Constructor & Destructor Documentation

◆ MagicGUIState()

◆ ~MagicGUIState()

~MagicGUIState ( )
virtual

Member Function Documentation

◆ getPropertyRoot() [1/2]

juce::ValueTree getPropertyRoot ( )

Returns the root node for exposed properties for the GUI.

Referenced by MagicGUIState::createPropertiesMenu(), and MagicGUIState::getPropertyAsValue().

◆ getPropertyRoot() [2/2]

juce::ValueTree getPropertyRoot ( ) const

◆ setGuiValueTree() [1/3]

void setGuiValueTree ( const juce::ValueTree &  dom)

Set the GUI DOM to create the GUI components from.

Referenced by MagicProcessor::createEditor(), ToolBox::loadGUI(), and MagicGUIState::setGuiValueTree().

◆ setGuiValueTree() [2/3]

void setGuiValueTree ( const char *  data,
int  dataSize 
)

◆ setGuiValueTree() [3/3]

void setGuiValueTree ( const juce::File &  file)

◆ getGuiTree()

juce::ValueTree & getGuiTree ( )

Grants access to the gui tree.

This is returned as reference so you are able to connect listeners to it.

Referenced by MagicProcessor::createEditor(), MagicGUIBuilder::getConfigTree(), and MagicPluginEditor::MagicPluginEditor().

◆ getValueTree()

juce::ValueTree & getValueTree ( )

◆ setApplicationSettingsFile()

void setApplicationSettingsFile ( juce::File  file)

Set a file to save common settings for all instances.

◆ getSettings()

juce::ValueTree & getSettings ( )

This is a settings ValueTree that is stored globally for all plugin instances.

◆ getParameterNames()

juce::StringArray getParameterNames ( ) const
virtual

Returns the IDs of AudioProcessorParameters for selection.

Reimplemented in MagicProcessorState.

◆ getParameter()

virtual juce::RangedAudioParameter* getParameter ( const juce::String &  paramID)
virtual

Reimplemented in MagicProcessorState.

◆ createAttachment() [1/3]

virtual std::unique_ptr<juce::SliderParameterAttachment> createAttachment ( const juce::String &  paramID,
juce::Slider &   
)
virtual

Reimplemented in MagicProcessorState.

Referenced by SliderItem::update().

◆ createAttachment() [2/3]

virtual std::unique_ptr<juce::ComboBoxParameterAttachment> createAttachment ( const juce::String &  paramID,
juce::ComboBox &   
)
virtual

Reimplemented in MagicProcessorState.

◆ createAttachment() [3/3]

virtual std::unique_ptr<juce::ButtonParameterAttachment> createAttachment ( const juce::String &  paramID,
juce::Button &   
)
virtual

Reimplemented in MagicProcessorState.

◆ createParameterMenu()

virtual juce::PopupMenu createParameterMenu ( ) const
virtual

Return a hierarchical menu of the AudioParameters.

Implemented in MagicPluginState

Reimplemented in MagicProcessorState.

Referenced by MagicGUIBuilder::createParameterMenuLambda().

◆ addTrigger()

void addTrigger ( const juce::Identifier &  triggerID,
std::function< void()>  function 
)

You can store a lambda that can be called from e.g.

a TextButton.

◆ getTrigger()

std::function< void()> getTrigger ( const juce::Identifier &  triggerID)

Returns a lambda to be connected to your components.

◆ getPropertyAsValue()

juce::Value getPropertyAsValue ( const juce::String &  pathToProperty)

Returns a property as value inside the ValueTreeState.

The nodes are a colon separated list, the last component is the property name

References MagicGUIState::getPropertyRoot().

◆ populatePropertiesMenu()

void populatePropertiesMenu ( juce::ComboBox &  comboBox) const

Populates a menu with properties found in the persistent ValueTree.

Referenced by MagicGUIBuilder::createPropertiesMenuLambda().

◆ createPropertiesMenu()

juce::PopupMenu createPropertiesMenu ( juce::ComboBox &  combo) const

◆ createTriggerMenu()

juce::PopupMenu createTriggerMenu ( ) const

◆ createAssetFilesMenu()

juce::PopupMenu createAssetFilesMenu ( ) const

◆ createAndAddObject()

T* createAndAddObject ( const juce::Identifier &  objectID,
Ts &&...  t 
)

Create and add an object.

The type to create needs to be added as template parameter, the arguments will be forwarded to the constructor.

◆ getObjectIDsByType()

juce::StringArray getObjectIDsByType ( ) const

Returns all identifiers of objects, that can be casted to the given type.

◆ getObjectWithType()

ObjectType* getObjectWithType ( juce::Identifier  objectID)

Return an object by objectID.

The returned type needs to be specified as template parameter. If there is no object with that objectID, or the object is not of the selected type, this will return a nullptr.

Parameters
objectIDis the ID to identify the object.

◆ prepareToPlay()

void prepareToPlay ( double  sampleRate,
int  samplesPerBlockExpected 
)

Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup.

◆ addBackgroundProcessing()

void addBackgroundProcessing ( MagicPlotSource source)

Registers background processing.

◆ getKeyboardState()

juce::MidiKeyboardState & getKeyboardState ( )

◆ getProcessor()

virtual juce::AudioProcessor* getProcessor ( )
virtual

Return the referenced AudioProcessor, if this state can provide one.

Reimplemented in MagicProcessorState.


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