|
Krotos Modules 3
|
An interface for an audio processor designed for modular use. More...
#include <KwidgetProcessor.h>
Classes | |
| class | AttachmentInfo |
| Holds the info required to create a new KAttachment for a Kwidget parameter. More... | |
Public Member Functions | |
| KwidgetProcessor (Kwidget &owner) | |
| ~KwidgetProcessor () override=default | |
| void | prepareToPlay (double, int) override final |
| void | processBlock (AudioBuffer< float > &buffer, MidiBuffer &) override final |
| virtual void | prepare (double sampleRate, int samplesPerBlock)=0 |
| virtual void | process (AudioBuffer< float > &buffer)=0 |
| virtual void | noteOn (int midiNoteNumber, float velocity, int voiceIndex=-1) |
| virtual void | noteOff (float velocity) |
| virtual bool | isActive () |
| virtual void | noteCleared () |
| std::shared_ptr< KAttachment > | getAttachment (const String ¶mID) |
| int | getNumModulators () const |
| Modulator * | getModulator (int index) |
| const String & | getKwidgetType () const |
| const String & | getKwidgetID () const |
| void | updateAttachments () |
Protected Member Functions | |
| void | nextBlock (int numSamples) |
| void | nextSample () |
| void | addModulator (bool useAudioRate) |
| void | addParameterAttachments (std::vector< AttachmentInfo >) |
| void | addParameterCallback (const String ¶mID, std::function< void(float)> callback) |
| Kwidget & | getOwner () const |
Private Member Functions | |
| const String | getName () const override |
| AudioProcessorEditor * | createEditor () override |
| bool | hasEditor () const override |
| double | getTailLengthSeconds () const override |
| bool | acceptsMidi () const override |
| bool | producesMidi () const override |
| int | getNumPrograms () override |
| int | getCurrentProgram () override |
| void | setCurrentProgram (int) override |
| const String | getProgramName (int) override |
| void | changeProgramName (int, const String &) override |
| void | getStateInformation (MemoryBlock &) override |
| void | setStateInformation (const void *, int) override |
| void | releaseResources () override |
Private Attributes | |
| const double | m_smoothingTimeSeconds {20e-3f} |
| Kwidget & | m_owner |
| std::vector< std::shared_ptr< KAttachment > > | m_attachments |
| std::unordered_map< String, std::shared_ptr< KAttachment > > | m_attachmentMap |
| std::vector< KAttachment::ParameterUpdater * > | m_activeUpdaters |
| OwnedArray< KParameter::AudioListenerObject > | m_parameterCallbacks |
| OwnedArray< Modulator > | m_modulators |
An interface for an audio processor designed for modular use.
| krotos::KwidgetProcessor::KwidgetProcessor | ( | Kwidget & | owner | ) |
Constructor.
|
overridedefault |
Destructor.
|
inlineoverrideprivate |
|
inlineprotected |
Child classes that are capable of sending out modulation signals should use this method to add all of the Modulator objects that it will use.
| useAudioRate | If true, the new modulator will use sample-accurate modulation. If false, the new modulator will use block-rate modulation. |
|
protected |
Creates new KAttachment objects for a list of Kwidget parameters. After the KAttachment objects are constructed, they will begin receiving updates from their parameters and dispatching them to this processor via the provided lambda functions.
If you don't want to provide a callback, you can instead choose to access a buffer of parameter values for each sample in the current block:
|
protected |
Add an action to be performed when a specified parameter changes value.
| paramID | The ID of the parameter to listen to. |
| callback | The action to be performed when the parameter changes value. |
|
inlineoverrideprivate |
|
inlineoverrideprivate |
| std::shared_ptr< KAttachment > krotos::KwidgetProcessor::getAttachment | ( | const String & | paramID | ) |
Get a pointer to a KAttachment belonging to this processor.
|
inlineoverrideprivate |
| const String & krotos::KwidgetProcessor::getKwidgetID | ( | ) | const |
Get the ID of the Kwidget represented by this UI object (ex. "Sine0").
| const String & krotos::KwidgetProcessor::getKwidgetType | ( | ) | const |
Get the type of Kwidget represented by this UI object (ex. "Sine").
| Modulator * krotos::KwidgetProcessor::getModulator | ( | int | index | ) |
Get a pointer to a Modulator object owned by this processor.
|
inlineoverrideprivate |
| int krotos::KwidgetProcessor::getNumModulators | ( | ) | const |
Get the total number of Modulator objects used by this processor.
|
inlineoverrideprivate |
|
inlineprotected |
Get a reference to the Kwidget that created this processor.
|
inlineoverrideprivate |
|
inlineoverrideprivate |
|
inlineoverrideprivate |
|
inlineoverrideprivate |
|
virtual |
Reimplemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_CoreEngine, and krotos::KwidgetProcessor_Reformer.
|
protected |
Call at the start of each block to update the parameter values of any parameters that have changed since the last block.
| numSamples | The current block size |
To apply the changes:
|
protected |
Call this once for each sample in the block.
|
inlinevirtual |
Override this method to perform any necessary cleanup when a voice is cleared.
Reimplemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_CoreEngine, krotos::KwidgetProcessor_Reformer, krotos::KwidgetProcessor_Scaledadsr, krotos::KwidgetProcessor_Template, and krotos::KwidgetProcessor_TriggerButton.
|
virtual |
Override this method to process a note off event, if necessary.
| velocity | The relative velocity of the note event (between 0 and 1). |
Reimplemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_CoreEngine, krotos::KwidgetProcessor_Recorder, krotos::KwidgetProcessor_Reformer, krotos::KwidgetProcessor_Scaledadsr, krotos::KwidgetProcessor_Template, and krotos::KwidgetProcessor_TriggerButton.
|
virtual |
Override this method to process a note on event, if necessary.
| midiNoteNumber | The integer value of the MIDI note. |
velocity The relative velocity of the note event (between 0 and 1). voiceIndex Optionally pass in a voice index, used ultimately to identify the voice associated with a playing note Defaults to -1 if unused
Reimplemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_CoreEngine, krotos::KwidgetProcessor_Recorder, krotos::KwidgetProcessor_Reformer, krotos::KwidgetProcessor_Sawtooth, krotos::KwidgetProcessor_Scaledadsr, krotos::KwidgetProcessor_Sine, krotos::KwidgetProcessor_Template, and krotos::KwidgetProcessor_TriggerButton.
|
pure virtual |
Override this method to inform your processor of the sample rate and maximum block size.
Implemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_AudioOut, krotos::KwidgetProcessor_ConvolutionReverb, krotos::KwidgetProcessor_CoreEngine, krotos::KwidgetProcessor_Filter, krotos::KwidgetProcessor_Lfo, krotos::KwidgetProcessor_MacroControls, krotos::KwidgetProcessor_MacroSlider, krotos::KwidgetProcessor_MoogVcf, krotos::KwidgetProcessor_OfflineAnalyser, krotos::KwidgetProcessor_Pan, krotos::KwidgetProcessor_PhaseVocoder, krotos::KwidgetProcessor_Recorder, krotos::KwidgetProcessor_Reformer, krotos::KwidgetProcessor_SAFilter, krotos::KwidgetProcessor_Saturation, krotos::KwidgetProcessor_Sawtooth, krotos::KwidgetProcessor_Scaledadsr, krotos::KwidgetProcessor_Sine, krotos::KwidgetProcessor_Template, krotos::KwidgetProcessor_TriggerButton, and krotos::KwidgetProcessor_XyPad.
|
finaloverride |
Do not override prepareToPlay()! Use prepare() instead in child classes.
|
pure virtual |
Override this method to process a buffer of audio.
Implemented in krotos::KwidgetProcessor_Adsr, krotos::KwidgetProcessor_AudioOut, krotos::KwidgetProcessor_ConvolutionReverb, krotos::KwidgetProcessor_CoreEngine, krotos::KwidgetProcessor_Filter, krotos::KwidgetProcessor_Lfo, krotos::KwidgetProcessor_MacroControls, krotos::KwidgetProcessor_MacroSlider, krotos::KwidgetProcessor_MoogVcf, krotos::KwidgetProcessor_OfflineAnalyser, krotos::KwidgetProcessor_Pan, krotos::KwidgetProcessor_PhaseVocoder, krotos::KwidgetProcessor_Recorder, krotos::KwidgetProcessor_Reformer, krotos::KwidgetProcessor_SAFilter, krotos::KwidgetProcessor_Saturation, krotos::KwidgetProcessor_Sawtooth, krotos::KwidgetProcessor_Scaledadsr, krotos::KwidgetProcessor_Sine, krotos::KwidgetProcessor_Template, krotos::KwidgetProcessor_TriggerButton, and krotos::KwidgetProcessor_XyPad.
|
finaloverride |
Do not override processBlock()! Use process() instead in child classes.
|
inlineoverrideprivate |
|
inlineoverrideprivate |
|
inlineoverrideprivate |
|
inlineoverrideprivate |
| void krotos::KwidgetProcessor::updateAttachments | ( | ) |
Call this function to ensure that all KAttachment objects are fully up to date, and their values have been applied to the processor.
This function is used in Kwidgets with multiple voices to make sure that a voice is up to date with the latest parameter values before it begins processing after previously being in an 'off' state.
This is necessary because parameter smoothing only occurs when a voice is active, so if this function is not called, then any smoothed parameters with pending updates will ramp from their previous value to the current value in the first few moments of audio processing.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |