Ase::AudioProcessor class

Audio signal AudioProcessor base class, implemented by all effects and instruments.

Public types

class FloatBuffer

Public static variables

static const String GUIONLY
":G:r:w:" - GUI READABLE WRITABLE
static const String STANDARD
":G:S:r:w:" - GUI STORAGE READABLE WRITABLE
static const String STORAGEONLY
":S:r:w:" - STORAGE READABLE WRITABLE

Public static functions

static auto param_peek_mt(const AudioProcessorP proc, Id32 paramid) →  double
static void registry_add(CString aseid, StaticInfo, MakeProcessorP)
static void registry_foreach(const std::function<void(const String&aseid, StaticInfo)>& fun)
Iterate over the known AudioProcessor types.
static auto timestamp() →  uint64
The current timestamp in sample frames.

Constructors, destructors, conversion operators

AudioProcessor(const ProcessorSetup&) protected explicit
Constructor for AudioProcessor.
~AudioProcessor() protected virtual
The destructor is called when the last std::shared_ptr<> reference drops.

Public functions

auto atomic_bits_iter(size_t pos = 0) const →  AtomicBits::Iter
Allow iterations over the atomic bits.
auto bus_info(IBusId busid) const →  BusInfo
Retrieve BusInfo for an input bus.
auto bus_info(OBusId busid) const →  BusInfo
Retrieve BusInfo for an output bus.
auto check_dirty(Id32 paramid) const →  bool
void connect_event_input(AudioProcessor& oproc)
Connect event input to event output of AudioProcessor oproc.
auto connected(OBusId obusid) const →  bool
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.
auto engine() const ASE_CONST -> AudioEngine&
Retrieve AudioEngine handle for this AudioProcessor.
auto find_ibus(const String& name) const →  IBusId
Return the IBusId for input bus uilabel or else 0.
auto find_obus(const String& name) const →  OBusId
Return the OBusId for output bus uilabel or else 0.
auto find_param(const String& identifier) const →  MaybeParamId
Return the ParamId for parameter identifier or else 0.
auto get_device() const →  DeviceP
Gain access to the Device handle of this AudioProcessor.
auto get_normalized(Id32 paramid) →  double
Get param value normalized into 0…1.
auto get_param(Id32 paramid) →  double
Fetch value of parameter id.
auto has_event_input() const →  bool
Returns true if this AudioProcessor has an event input stream.
auto has_event_output() const →  bool
Returns true if this AudioProcessor has an event output stream.
auto ifloats(IBusId b, uint c) const →  const float*
Access readonly float buffer of input bus b, channel c, see also ofloats().
auto inyquist() const ASE_CONST -> double
Inverse Nyquist frequency, i.e. 1.0 / nyquist().
auto is_initialized() const →  bool
Check if AudioProcessor has been properly intiialized (so the parameter set is fixed).
auto n_ibuses() const →  uint
Number of input buses configured for this AudioProcessor.
auto n_ichannels(IBusId busid) const →  uint
Number of channels of input bus busid configured for this AudioProcessor.
auto n_obuses() const →  uint
Number of output buses configured for this AudioProcessor.
auto n_ochannels(OBusId busid) const →  uint
Number of channels of output bus busid configured for this AudioProcessor.
auto note_to_freq(int note) const →  float
Convert MIDI note to Hertz according to the current MusicalTuning.
auto nyquist() const ASE_CONST -> double
Half the sample rate in Hz as double, used for render().
auto ofloats(OBusId b, uint c) const →  const float*
Access readonly float buffer of output bus b, channel c, see also oblock().
auto param_range(Id32 paramid) const →  MinMax
Retrieve the minimum / maximum values for a parameter.
auto param_value_from_text(uint32_t paramid, const String& text) const →  double virtual
auto param_value_to_text(uint32_t paramid, double value) const →  String virtual
auto parameter(Id32 paramid) const →  ParameterC
Retrieve supplemental information for parameters, usually to enhance the user interface.
auto send_param(Id32 paramid, double value) →  bool
Set parameter id to value within ParamInfo.get_minmax().
auto set_normalized(Id32 paramid, double normalized) →  bool
Set param value normalized into 0…1.
auto text_param_from_quark(uint32_t paramid, uint vint) →  String
Helper for temporary uint<->string conversions.
auto text_param_to_quark(uint32_t paramid, const String& text) →  uint
Ase main-thread helper for temporary string<->uint conversions.
auto transport() const ASE_CONST -> const AudioTransport&
Sample rate mixing frequency in Hz as unsigned, used for render().

Protected functions

auto add_input_bus(CString uilabel, SpeakerArrangement speakerarrangement, const String& hints = "", const String& blurb = "") →  IBusId
Add an input bus with uilabel and channels configured via speakerarrangement.
auto add_output_bus(CString uilabel, SpeakerArrangement speakerarrangement, const String& hints = "", const String& blurb = "") →  OBusId
Add an output bus with uilabel and channels configured via speakerarrangement.
void apply_event(const MidiEvent& event)
Assign MidiEvent::PARAM_VALUE event values to parameters.
void apply_input_events()
void assign_oblock(OBusId b, uint c, float val)
Fill the output buffer of bus b, channel c with v.
auto atomic_bit_notify(size_t nth) →  bool
Set the nth atomic notification bit, return if enotify_enqueue_mt() is needed.
void atomic_bits_resize(size_t count)
Prepare count bits for atomic notifications.
void connect(IBusId ibus, AudioProcessor& oproc, OBusId obus)
Connect input ibusid to output obusid of AudioProcessor prev.
void disconnect(IBusId ibus)
Disconnect input ibusid.
void disconnect_ibuses()
Reset input bus buffer data.
void disconnect_obuses()
Disconnect inputs of all Processors that are connected to outputs of this.
void enotify_enqueue_mt(uint32 pushmask)
void initialize(SpeakerArrangement busses) pure virtual
void install_params(const AudioParams::Map& params)
Reset list of parameters, enqueues parameter value initializaiton events.
auto iobus(OBusId busid) →  IOBus&
Get internal output bus handle.
auto iobus(IBusId busid) →  IOBus&
Get internal input bus handle.
auto midi_event_input() →  MidiEventInput
Access the current MidiEvent inputs during render(), needs prepare_event_input().
auto midi_event_output() →  MidiEventOutput&
Access the current output EventStream during render(), needs prepare_event_output().
auto oblock(OBusId b, uint c) →  float*
auto peek_param_mt(Id32 paramid) const →  double
void prepare_event_input()
void prepare_event_output()
void redirect_oblock(OBusId b, uint c, const float* block)
Redirect output buffer of bus b, channel c to point to block, or zeros if block==nullptr.
void remove_all_buses()
Remove existing bus configurations, useful at the start of configure().
void reschedule()
Request recreation of the audio engine rendering schedule.
auto schedule_processor() →  uint
Schedule this node and its dependencies for engine rendering.

Private functions

void render(uint n_frames) pure virtual
void reset(uint64 target_stamp) pure virtual
Reset all state variables.

Function documentation

static double Ase::AudioProcessor::param_peek_mt(const AudioProcessorP proc, Id32 paramid)

Fetch the current parameter value of a AudioProcessor from any thread. This function is MT-Safe after proper AudioProcessor initialization.

static void Ase::AudioProcessor::registry_add(CString aseid, StaticInfo, MakeProcessorP)

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().

bool Ase::AudioProcessor::check_dirty(Id32 paramid) const

Check if the parameter dirty flag is set. Return true if the parameter value changed during render().

bool Ase::AudioProcessor::connected(OBusId obusid) const

Indicator for connected output buses. Not connected output bus buffers do not need to be filled.

double Ase::AudioProcessor::param_value_from_text(uint32_t paramid, const String& text) const 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).

String Ase::AudioProcessor::param_value_to_text(uint32_t paramid, double value) const 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).

void Ase::AudioProcessor::apply_input_events() protected

Process all input events via apply_event() and adjust_param(). This applies all incoming parameter changes, events like NOTE_ON are not handled.

void Ase::AudioProcessor::enotify_enqueue_mt(uint32 pushmask) protected

Queue an AudioProcessor notification This function is MT-Safe after proper AudioProcessor initialization.

void Ase::AudioProcessor::initialize(SpeakerArrangement busses) pure virtual protected

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.

float* Ase::AudioProcessor::oblock(OBusId b, uint c) protected

Reset buffer redirections and access float buffer of output bus b, channel c. See also ofloats() for readonly access and redirect_oblock() for redirections.

double Ase::AudioProcessor::peek_param_mt(Id32 paramid) const 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.

void Ase::AudioProcessor::prepare_event_input() 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.

void Ase::AudioProcessor::prepare_event_output() 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.

void Ase::AudioProcessor::render(uint n_frames) pure virtual private

Method called for every audio buffer to be processed. Each connected output bus needs to be filled with n_frames, i.e. n_frames many floating point samples per channel. Using the AudioSignal::OBusId (see add_output_bus()), the floating point sample buffers can be addressed via the BusConfig structure as: bus[obusid].channel[nth].buffer, see FloatBuffer for further details. The AudioSignal::IBusId (see add_input_bus()) can be used correspondingly to retrieve input channel values.

Variable documentation

static const String Ase::AudioProcessor::GUIONLY

":G:r:w:" - GUI READABLE WRITABLE

GUI READABLE WRITABLE.

static const String Ase::AudioProcessor::STANDARD

":G:S:r:w:" - GUI STORAGE READABLE WRITABLE

GUI STORAGE READABLE WRITABLE.

static const String Ase::AudioProcessor::STORAGEONLY

":S:r:w:" - STORAGE READABLE WRITABLE

STORAGE READABLE WRITABLE.