The MagicProcessorState is a subclass of MagicGUIState, that adds AudioProcessor specific functionality. More...
Public Member Functions | |
MagicProcessorState (juce::AudioProcessor &processorToUse) | |
Create a MagicProcessorState to let the generated GUI communicate with the processor and it's internals. More... | |
juce::StringArray | getParameterNames () const override |
Returns the IDs of AudioProcessorParameters for selection. More... | |
juce::PopupMenu | createParameterMenu () const override |
Return a hierarchical menu of the AudioParameters. More... | |
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. More... | |
void | setPlayheadUpdateFrequency (int frequency) |
Starts the timer to fetch the playhead values from the audio thread. More... | |
void | setLastEditorSize (int width, int height) |
Allows the editor to set its last size to resore next time. More... | |
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. More... | |
void | setStateInformation (const void *data, int sizeInBytes, juce::AudioProcessorEditor *editor=nullptr) |
This method restores the plugin state using the AudioProcessorValueTreeState. More... | |
juce::RangedAudioParameter * | getParameter (const juce::String ¶mID) override |
Returns a parameter for a parameter ID. More... | |
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. More... | |
void | processMidiBuffer (juce::MidiBuffer &buffer, int numSamples, bool injectIndirectEvents=true) |
Send the midi data to the keyboard and to the MidiLearn mapper. More... | |
void | mapMidiController (int cc, const juce::String ¶meterID) |
Connects a midi controller CC to a parameter for MIDI learn. More... | |
int | getLastController () const |
Returns the last moved controller for MIDI learn. More... | |
Public Member Functions inherited from MagicGUIState | |
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... | |
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 () |
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.
|
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.
Referenced by MagicPluginEditor::resized().
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.
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 MagicGUIState::getValueTree(), and ParameterManager::loadParameterValues().
Referenced by MagicProcessor::setStateInformation().
|
overridevirtual |
Returns a parameter for a parameter ID.
Reimplemented from MagicGUIState.
References ParameterManager::getParameter().
void updateParameterMap | ( | ) |
References ParameterManager::updateParameterMap().
Referenced by MagicProcessor::createEditor().
|
overridevirtual |
Reimplemented from MagicGUIState.
|
overridevirtual |
Reimplemented from MagicGUIState.
|
overridevirtual |
Reimplemented from MagicGUIState.
|
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.
int getLastController | ( | ) | const |
Returns the last moved controller for MIDI learn.
References MidiParameterMapper::getLastController().