The MagicProcessorState is a subclass of MagicGUIState, that adds AudioProcessor specific functionality. More...
#include <foleys_MagicProcessorState.h>
Public Member Functions | |
MagicProcessorState (juce::AudioProcessor &processorToUse) | |
Create a MagicProcessorState to let the generated GUI communicate with the processor and it's internals. | |
~MagicProcessorState () override | |
juce::StringArray | getParameterNames () const override |
Returns the IDs of AudioProcessorParameters for selection. | |
juce::PopupMenu | createParameterMenu () const override |
Return a hierarchical menu of the AudioParameters. | |
void | updatePlayheadInformation (juce::AudioPlayHead *playhead) |
Calling this in the processBlock() will store the values from AudioPlayHead into the state, so it can be used in the GUI. | |
void | setPlayheadUpdateFrequency (int frequency) |
Starts the timer to fetch the playhead values from the audio thread. | |
void | setLastEditorSize (int width, int height) |
Allows the editor to set its last size to resore next time. | |
bool | getLastEditorSize (int &width, int &height) |
void | getStateInformation (juce::MemoryBlock &destData) |
This method will serialise the plugin state from AudioProcessorValueTreeState for the host to save in the session. | |
void | setStateInformation (const void *data, int sizeInBytes, juce::AudioProcessorEditor *editor=nullptr) |
This method restores the plugin state using the AudioProcessorValueTreeState. | |
juce::RangedAudioParameter * | getParameter (const juce::String ¶mID) override |
Returns a parameter for a parameter ID. | |
void | updateParameterMap () |
std::unique_ptr< juce::SliderParameterAttachment > | createAttachment (const juce::String ¶mID, juce::Slider &slider) override |
std::unique_ptr< juce::ComboBoxParameterAttachment > | createAttachment (const juce::String ¶mID, juce::ComboBox &combobox) override |
std::unique_ptr< juce::ButtonParameterAttachment > | createAttachment (const juce::String ¶mID, juce::Button &button) override |
juce::AudioProcessor * | getProcessor () override |
Return the referenced AudioProcessor, if this state can provide one. | |
void | processMidiBuffer (juce::MidiBuffer &buffer, int numSamples, bool injectIndirectEvents=true) |
Send the midi data to the keyboard and to the MidiLearn mapper. | |
void | mapMidiController (int cc, const juce::String ¶meterID) |
Connects a midi controller CC to a parameter for MIDI learn. | |
int | getLastController () const |
Returns the last moved controller for MIDI learn. | |
Public Member Functions inherited from MagicGUIState | |
MagicGUIState () | |
virtual | ~MagicGUIState () |
juce::ValueTree | getPropertyRoot () |
Returns the root node for exposed properties for the GUI. | |
juce::ValueTree | getPropertyRoot () const |
void | setGuiValueTree (const juce::ValueTree &dom) |
Set the GUI DOM to create the GUI components from. | |
void | setGuiValueTree (const char *data, int dataSize) |
void | setGuiValueTree (const juce::File &file) |
juce::ValueTree & | getGuiTree () |
Grants access to the gui tree. | |
juce::ValueTree & | getValueTree () |
void | setApplicationSettingsFile (juce::File file) |
Set a file to save common settings for all instances. | |
juce::ValueTree & | getSettings () |
This is a settings ValueTree that is stored globally for all plugin instances. | |
void | addTrigger (const juce::Identifier &triggerID, std::function< void()> function) |
You can store a lambda that can be called from e.g. | |
std::function< void()> | getTrigger (const juce::Identifier &triggerID) |
Returns a lambda to be connected to your components. | |
juce::Value | getPropertyAsValue (const juce::String &pathToProperty) |
Returns a property as value inside the ValueTreeState. | |
void | populatePropertiesMenu (juce::ComboBox &comboBox) const |
Populates a menu with properties found in the persistent ValueTree. | |
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. | |
template<typename ObjectType > | |
juce::StringArray | getObjectIDsByType () const |
Returns all identifiers of objects, that can be casted to the given type. | |
template<typename ObjectType > | |
ObjectType * | getObjectWithType (juce::Identifier objectID) |
Return an object by objectID. | |
void | clearAllObjects () |
This removes all objects managed by the MagicGuiState. | |
void | prepareToPlay (double sampleRate, int samplesPerBlockExpected) |
Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup. | |
void | addBackgroundProcessing (MagicPlotSource *source) |
Registers background processing. | |
juce::MidiKeyboardState & | getKeyboardState () |
void | setResourcesFolder (const juce::String &name) |
juce::File | getResourcesFolder () const |
The MagicProcessorState is a subclass of MagicGUIState, that adds AudioProcessor specific functionality.
It allows for instance connecting to AudioProcessorParameters and supplies a default XML tree* of components built from the getParameterTree() from the AudioProcessor.
MagicProcessorState | ( | juce::AudioProcessor & | processorToUse | ) |
Create a MagicProcessorState to let the generated GUI communicate with the processor and it's internals.
|
override |
|
overridevirtual |
Returns the IDs of AudioProcessorParameters for selection.
Reimplemented from MagicGUIState.
References ParameterManager::getParameterNames().
|
overridevirtual |
Return a hierarchical menu of the AudioParameters.
Reimplemented from MagicGUIState.
void updatePlayheadInformation | ( | juce::AudioPlayHead * | playhead | ) |
Calling this in the processBlock() will store the values from AudioPlayHead into the state, so it can be used in the GUI.
To enable this call setPlayheadUpdateFrequency (frequency) with an appropriate value
void setPlayheadUpdateFrequency | ( | int | frequency | ) |
Starts the timer to fetch the playhead values from the audio thread.
void setLastEditorSize | ( | int | width, |
int | height ) |
Allows the editor to set its last size to resore next time.
References MagicGUIState::getValueTree().
Referenced by MagicPluginEditor::resized().
bool getLastEditorSize | ( | int & | width, |
int & | height ) |
References MagicGUIState::getValueTree().
Referenced by MagicProcessorState::setStateInformation().
void getStateInformation | ( | juce::MemoryBlock & | destData | ) |
This method will serialise the plugin state from AudioProcessorValueTreeState for the host to save in the session.
destData | is the memory block to fill |
References MagicGUIState::getValueTree(), and ParameterManager::saveParameterValues().
Referenced by MagicProcessor::getStateInformation().
void setStateInformation | ( | const void * | data, |
int | sizeInBytes, | ||
juce::AudioProcessorEditor * | editor = nullptr ) |
This method restores the plugin state using the AudioProcessorValueTreeState.
If you supply a pointer to the editor (using getActiveEditor()) the last size is automatically restored.
data | is a pointer to the original data |
sizeInBytes | is the length of the data |
editor | is an optional pointer to the editor to apply the last size to |
References MagicProcessorState::getLastEditorSize(), MagicGUIState::getValueTree(), and ParameterManager::loadParameterValues().
Referenced by MagicProcessor::setStateInformation().
|
overridevirtual |
Returns a parameter for a parameter ID.
Reimplemented from MagicGUIState.
References ParameterManager::getParameter().
Referenced by MagicProcessorState::createAttachment(), MagicProcessorState::createAttachment(), and MagicProcessorState::createAttachment().
void updateParameterMap | ( | ) |
References ParameterManager::updateParameterMap().
Referenced by MagicProcessor::createEditor().
|
overridevirtual |
Reimplemented from MagicGUIState.
References MagicProcessorState::getParameter().
|
overridevirtual |
Reimplemented from MagicGUIState.
References MagicProcessorState::getParameter().
|
overridevirtual |
Reimplemented from MagicGUIState.
References MagicProcessorState::getParameter().
|
overridevirtual |
Return the referenced AudioProcessor, if this state can provide one.
Reimplemented from MagicGUIState.
void processMidiBuffer | ( | juce::MidiBuffer & | buffer, |
int | numSamples, | ||
bool | injectIndirectEvents = true ) |
Send the midi data to the keyboard and to the MidiLearn mapper.
buffer | the midi buffer from processBlock |
numSamples | the number of samples in the corresponding audio buffer |
injectIndirectEvents | if true key presses from the GUI are added to the midi stream |
References MagicGUIState::getKeyboardState(), and MidiParameterMapper::processMidiBuffer().
void mapMidiController | ( | int | cc, |
const juce::String & | parameterID ) |
Connects a midi controller CC to a parameter for MIDI learn.
References MidiParameterMapper::mapMidiController().
int getLastController | ( | ) | const |
Returns the last moved controller for MIDI learn.
References MidiParameterMapper::getLastController().
Referenced by MidiLearnComponent::mouseDrag(), and MidiLearnComponent::paint().