#include "processor.hh"
Classes | |
struct | EventStreams |
class | FloatBuffer |
struct | IOBus |
struct | ProcessorSetup |
struct | RenderContext |
Public Types | |
using | MakeDeviceP = std::function< DeviceP(const String &, StaticInfo, AudioProcessorP)> |
using | MakeProcessor = AudioProcessorP(*)(AudioEngine &) |
using | MakeProcessorP = AudioProcessorP(*)(CString, AudioEngine &) |
using | MaybeParamId = std::pair< ParamId, bool > |
using | StaticInfo = void(*)(AudioProcessorInfo &) |
Public Member Functions | |
void | adjust_all_params () |
AtomicBits::Iter | atomic_bits_iter (size_t pos=0) const |
BusInfo | bus_info (IBusId busid) const |
BusInfo | bus_info (OBusId busid) const |
bool | check_dirty (Id32 paramid) const |
void | connect_event_input (AudioProcessor &oproc) |
bool | connected (OBusId obusid) const |
String | debug_name () const |
void | disconnect_event_input () |
void | enable_engine_output (bool onoff) |
AudioEngine & | engine () const |
IBusId | find_ibus (const String &name) const |
OBusId | find_obus (const String &name) const |
MaybeParamId | find_param (const String &identifier) const |
DeviceP | get_device () const |
double | get_normalized (Id32 paramid) |
double | get_param (Id32 paramid) |
bool | has_event_input () const |
bool | has_event_output () const |
const float * | ifloats (IBusId b, uint c) const |
double | inyquist () const |
bool | is_initialized () const |
uint | n_ibuses () const |
uint | n_ichannels (IBusId busid) const |
uint | n_obuses () const |
uint | n_ochannels (OBusId busid) const |
float | note_to_freq (int note) const |
double | nyquist () const |
const float * | ofloats (OBusId b, uint c) const |
MinMax | param_range (Id32 paramid) const |
virtual double | param_value_from_text (uint32_t paramid, const String &text) const |
virtual String | param_value_to_text (uint32_t paramid, double value) const |
ParameterC | parameter (Id32 paramid) const |
uint | sample_rate () const |
bool | send_param (Id32 paramid, double value) |
bool | set_normalized (Id32 paramid, double normalized) |
String | text_param_from_quark (uint32_t paramid, uint vint) |
uint | text_param_to_quark (uint32_t paramid, const String &text) |
const AudioTransport & | transport () const |
virtual double | value_from_normalized (Id32 paramid, double normalized) const |
virtual double | value_to_normalized (Id32 paramid, double value) const |
![]() | |
void | operator delete (void *ptr, std::size_t sz) |
void | operator delete (void *ptr, std::size_t sz, std::align_val_t al) |
void | operator delete[] (void *ptr, std::size_t sz) |
void | operator delete[] (void *ptr, std::size_t sz, std::align_val_t al) |
void * | operator new (std::size_t sz) |
void * | operator new (std::size_t sz, std::align_val_t al) |
void * | operator new[] (std::size_t sz) |
void * | operator new[] (std::size_t sz, std::align_val_t al) |
Static Public Member Functions | |
template<class AudioProc , class ... Args> | |
static std::shared_ptr< AudioProc > | create_processor (AudioEngine &engine, const Args &...args) |
static double | param_peek_mt (const AudioProcessorP proc, Id32 paramid) |
static void | registry_add (CString aseid, StaticInfo, MakeProcessorP) |
static DeviceP | registry_create (CString aseid, AudioEngine &engine, const MakeDeviceP &) |
static void | registry_foreach (const std::function< void(const String &aseid, StaticInfo)> &fun) |
static uint64 | timestamp () |
Static Public Attributes | |
static const String | GUIONLY |
static const String | STANDARD |
static const String | STORAGEONLY |
Protected Types | |
enum | { INITIALIZED , SCHEDULED , PARAMCHANGE , BUSCONNECT , BUSDISCONNECT , INSERTION , REMOVAL , ENGINE_OUTPUT } |
using | MidiEventInput = MidiEventReader< 2 > |
using | MinMax = std::pair< double, double > |
Static Protected Member Functions | |
static uint | schedule_processor (AudioProcessor &p) |
Protected Attributes | |
CString | aseid_ |
AudioEngine & | engine_ |
std::atomic< uint32 > | flags_ |
Audio signal AudioProcessor base class, implemented by all effects and instruments.
|
protected |
|
protected |
using MakeProcessor = AudioProcessorP (*) (AudioEngine&) |
using MaybeParamId = std::pair<ParamId,bool> |
using StaticInfo = void (*) (AudioProcessorInfo&) |
using MakeDeviceP = std::function<DeviceP (const String&, StaticInfo, AudioProcessorP)> |
using MakeProcessorP = AudioProcessorP (*) (CString,AudioEngine&) |
|
protected |
|
explicitprotected |
Constructor for AudioProcessor.
|
protectedvirtual |
The destructor is called when the last std::shared_ptr<> reference drops.
|
protectedpure virtual |
Mandatory method to setup parameters and I/O busses. See add_param(), add_input_bus() / add_output_bus(). This method will be called once per instance after construction.
Implemented in ClapAudioProcessor, AudioChain::Inlet, AudioChain, and MidiProducerImpl.
|
protected |
Queue an AudioProcessor notification This function is MT-Safe after proper AudioProcessor initialization.
|
protected |
Schedule this node and its dependencies for engine rendering.
|
protected |
Request recreation of the audio engine rendering schedule.
|
protectedvirtual |
Reimplemented in AudioChain.
|
staticprotected |
|
protected |
Reset list of parameters, enqueues parameter value initializaiton events.
|
protected |
Assign MidiEvent::PARAM_VALUE event values to parameters.
|
protected |
Process all input events via apply_event() and adjust_param(). This applies all incoming parameter changes, events like NOTE_ON are not handled.
|
protectedvirtual |
|
protected |
Fetch the current parameter value of an AudioProcessor. This function does not modify the parameter `dirty` flag. This function is MT-Safe after proper AudioProcessor initialization.
|
protected |
Add an input bus with `uilabel` and channels configured via `speakerarrangement`.
|
protected |
Add an output bus with `uilabel` and channels configured via `speakerarrangement`.
|
protected |
Remove existing bus configurations, useful at the start of configure().
|
protected |
Get internal output bus handle.
|
protected |
Get internal input bus handle.
|
protected |
Reset input bus buffer data.
|
protected |
Disconnect inputs of all Processors that are connected to outputs of `this`.
|
protected |
Disconnect input `ibusid`.
|
protected |
Connect input `ibusid` to output `obusid` of AudioProcessor `prev`.
Reset buffer redirections and access float buffer of output bus `b`, channel `c`. See also ofloats() for readonly access and redirect_oblock() for redirections.
Fill the output buffer of bus `b`, channel `c` with `v`.
Redirect output buffer of bus `b`, channel `c` to point to `block`, or zeros if `block==nullptr`.
|
protected |
Prepare the AudioProcessor to receive Event objects during render() via get_event_input(). Note, remove_all_buses() will remove the Event input created by this function.
|
protected |
Prepare the AudioProcessor to produce Event objects during render() via get_event_output(). Note, remove_all_buses() will remove the Event output created by this function.
|
protected |
Access the current MidiEvent inputs during render(), needs prepare_event_input().
|
protected |
Access the current output EventStream during render(), needs prepare_event_output().
|
protected |
Prepare `count` bits for atomic notifications.
|
protected |
Set the nth atomic notification bit, return if enotify_enqueue_mt() is needed.
AtomicBits::Iter atomic_bits_iter | ( | size_t | pos = 0 | ) | const |
Allow iterations over the atomic bits.
float note_to_freq | ( | int | note | ) | const |
Convert MIDI note to Hertz according to the current MusicalTuning.
String debug_name | ( | ) | const |
AudioEngine & engine | ( | ) | const |
Retrieve AudioEngine handle for this AudioProcessor.
const AudioTransport & transport | ( | ) | const |
Sample rate mixing frequency in Hz as unsigned, used for render().
uint sample_rate | ( | ) | const |
double nyquist | ( | ) | const |
Half the sample rate in Hz as double, used for render().
double inyquist | ( | ) | const |
Inverse Nyquist frequency, i.e. 1.0 / nyquist().
double get_param | ( | Id32 | paramid | ) |
Fetch `value` of parameter `id`.
bool send_param | ( | Id32 | paramid, |
double | value | ||
) |
Set parameter `id` to `value` within `ParamInfo.get_minmax()`.
ParameterC parameter | ( | Id32 | paramid | ) | const |
Retrieve supplemental information for parameters, usually to enhance the user interface.
auto find_param | ( | const String & | identifier | ) | const |
Return the ParamId for parameter `identifier` or else 0.
AudioProcessor::MinMax param_range | ( | Id32 | paramid | ) | const |
Retrieve the minimum / maximum values for a parameter.
bool check_dirty | ( | Id32 | paramid | ) | const |
Check if the parameter `dirty` flag is set. Return `true` if the parameter value changed during render().
void adjust_all_params | ( | ) |
|
virtual |
Format a parameter `paramid` value as text string. Currently, this function may be called from any thread, so `this` must be treated as `const` (it might be used concurrently by a different thread).
|
virtual |
Extract a parameter `paramid` value from a text string. The string might contain unit information or consist only of number characters. Non-recognized characters should be ignored, so a best effort conversion is always undertaken. This function may be called from any thread, so `this` must be treated as `const` (it might be used concurrently by a different thread).
|
virtual |
|
virtual |
double get_normalized | ( | Id32 | paramid | ) |
Get param value normalized into 0…1.
bool set_normalized | ( | Id32 | paramid, |
double | normalized | ||
) |
Set param value normalized into 0…1.
bool is_initialized | ( | ) | const |
Check if AudioProcessor has been properly intiialized (so the parameter set is fixed).
Ase main-thread helper for temporary string<->uint conversions.
Helper for temporary uint<->string conversions.
uint n_ibuses | ( | ) | const |
Number of input buses configured for this AudioProcessor.
uint n_obuses | ( | ) | const |
Number of output buses configured for this AudioProcessor.
Number of channels of input bus `busid` configured for this AudioProcessor.
Number of channels of output bus `busid` configured for this AudioProcessor.
bool connected | ( | OBusId | obusid | ) | const |
Indicator for connected output buses. Not connected output bus buffers do not need to be filled.
Access readonly float buffer of input bus `b`, channel `c`, see also ofloats().
Access readonly float buffer of output bus `b`, channel `c`, see also oblock().
|
static |
The current timestamp in sample frames.
DeviceP get_device | ( | ) | const |
Gain access to the Device handle of `this` AudioProcessor.
bool has_event_input | ( | ) | const |
Returns `true` if this AudioProcessor has an event input stream.
bool has_event_output | ( | ) | const |
Returns `true` if this AudioProcessor has an event output stream.
void connect_event_input | ( | AudioProcessor & | oproc | ) |
Connect event input to event output of AudioProcessor `oproc`.
void disconnect_event_input | ( | ) |
Disconnect event input if a connection is present.
void enable_engine_output | ( | bool | onoff | ) |
Configure if the main output of this module is mixed into the engine output.
|
static |
Fetch the current parameter value of a AudioProcessor from any thread. This function is MT-Safe after proper AudioProcessor initialization.
|
static |
Add a new type to the AudioProcessor type registry. New AudioProcessor types must have a unique URI (see `query_info()`) and will be created with the factory function `create()`.
|
static |
|
static |
Iterate over the known AudioProcessor types.
|
static |
|
protected |
|
protected |
|
protected |
|
static |
":G:r:w:" - GUI READABLE WRITABLE
GUI READABLE WRITABLE.
|
static |
":G:S:r:w:" - GUI STORAGE READABLE WRITABLE
GUI STORAGE READABLE WRITABLE.
|
static |
":S:r:w:" - STORAGE READABLE WRITABLE
STORAGE READABLE WRITABLE.