Class Ase::AudioProcessor
ClassList > Ase > AudioProcessor
Audio signal AudioProcessor base class, implemented by all effects and instruments.
#include <processor.hh>
Inherits the following classes: std::enable_shared_from_this< AudioProcessor >, Ase::FastMemory::NewDeleteBase
Inherited by the following classes: Ase::AudioChain::Inlet, Ase::AudioCombo, Ase::ClapAudioProcessor, Ase::EngineMidiInput, Ase::MidiLib::MidiProducerIface
Classes
Type | Name |
---|---|
struct | EventStreams |
class | FloatBuffer |
struct | IOBus |
struct | ProcessorSetup |
struct | RenderContext |
Public Types
Type | Name |
---|---|
typedef std::function< DeviceP(const String &, StaticInfo, AudioProcessorP)> | MakeDeviceP |
typedef AudioProcessorP(*)(AudioEngine &) | MakeProcessor |
typedef AudioProcessorP(*)(CString, AudioEngine &) | MakeProcessorP |
typedef std::pair< ParamId, bool > | MaybeParamId |
typedef void(*)(AudioProcessorInfo &) | StaticInfo |
Public Static Attributes
Type | Name |
---|---|
const String | GUIONLY = = ":G:r:w:" ":G:r:w:" - GUI READABLE WRITABLE |
const String | STANDARD = = ":G:S:r:w:" ":G:S:r:w:" - GUI STORAGE READABLE WRITABLE |
const String | STORAGEONLY = = ":S:r:w:" ":S:r:w:" - STORAGE READABLE WRITABLE |
Public Functions
Type | Name |
---|---|
void | adjust_all_params () |
AtomicBits::Iter | atomic_bits_iter (size_t pos=0) const Allow iterations over the atomic bits. |
BusInfo | bus_info (IBusId busid) const Retrieve BusInfo for an input bus. |
BusInfo | bus_info (OBusId busid) const Retrieve BusInfo for an output bus. |
bool | check_dirty (Id32 paramid) const |
void | connect_event_input (AudioProcessor & oproc) Connect event input to event output of AudioProcessor __ oproc . |
bool | connected (OBusId obusid) const |
String | debug_name () const |
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. |
AudioEngine & | engine () const Retrieve AudioEngine handle for thisAudioProcessor . |
IBusId | find_ibus (const String & name) const Return the IBusId for input bus uilabel or else 0. |
OBusId | find_obus (const String & name) const Return the OBusId for output bus uilabel or else 0. |
MaybeParamId | find_param (const String & identifier) const Return the ParamId for parameter identifier or else 0. |
DeviceP | get_device () const Gain access to the Device handle of this __AudioProcessor . |
double | get_normalized (Id32 paramid) Get param value normalized into 0…1. |
double | get_param (Id32 paramid) Fetch value of parameterid . |
bool | has_event_input () const Returns true if thisAudioProcessor has an event input stream. |
bool | has_event_output () const Returns true if thisAudioProcessor has an event output stream. |
const float * | ifloats (IBusId b, uint c) const Access readonly float buffer of input bus b , channelc , see alsoofloats() . |
double | inyquist () const Inverse Nyquist frequency, i.e. 1.0 / nyquist() . |
bool | is_initialized () const Check if AudioProcessor has been properly intiialized (so the parameter set is fixed). |
uint | n_ibuses () const Number of input buses configured for this AudioProcessor . |
uint | n_ichannels (IBusId busid) const Number of channels of input bus busid configured for thisAudioProcessor . |
uint | n_obuses () const Number of output buses configured for this AudioProcessor . |
uint | n_ochannels (OBusId busid) const Number of channels of output bus busid configured for thisAudioProcessor . |
float | note_to_freq (int note) const Convert MIDI note to Hertz according to the current MusicalTuning. |
double | nyquist () const Half the sample rate in Hz as double, used for render(). |
const float * | ofloats (OBusId b, uint c) const Access readonly float buffer of output bus b , channelc , see alsooblock() . |
MinMax | param_range (Id32 paramid) const Retrieve the minimum / maximum values for a parameter. |
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 Retrieve supplemental information for parameters, usually to enhance the user interface. |
uint | sample_rate () const |
bool | send_param (Id32 paramid, double value) Set parameter id tovalue withinParamInfo.get_minmax() . |
bool | set_normalized (Id32 paramid, double normalized) Set param value normalized into 0…1. |
String | text_param_from_quark (uint32_t paramid, uint vint) Helper for temporary uint<->string conversions. |
uint | text_param_to_quark (uint32_t paramid, const String & text) Ase main-thread helper for temporary string<->uint conversions. |
const AudioTransport & | transport () const Sample rate mixing frequency in Hz as unsigned, used for render(). |
virtual double | value_from_normalized (Id32 paramid, double normalized) const |
virtual double | value_to_normalized (Id32 paramid, double value) const |
Public Static Functions
Type | Name |
---|---|
std::shared_ptr< AudioProc > | create_processor (AudioEngine & engine, const Args &... args) |
double | param_peek_mt (const AudioProcessorP proc, Id32 paramid) |
void | registry_add (CString aseid, StaticInfo static_info, MakeProcessorP makeproc) |
DeviceP | registry_create (CString aseid, AudioEngine & engine, const MakeDeviceP & makedevice) |
void | registry_foreach (const std::function< void(const String &aseid, StaticInfo)> & fun) Iterate over the known AudioProcessor types. |
uint64 | timestamp () The current timestamp in sample frames. |
Protected Types
Type | Name |
---|---|
enum | AudioProcessor |
typedef MidiEventReader< 2 > | MidiEventInput |
typedef std::pair< double, double > | MinMax |
Protected Attributes
Type | Name |
---|---|
CString | aseid_ |
AudioEngine & | engine_ |
std::atomic< uint32 > | flags_ = = 0 |
Protected Functions
Type | Name |
---|---|
AudioProcessor (const ProcessorSetup & psetup) Constructor for AudioProcessor . |
|
IBusId | add_input_bus (CString uilabel, SpeakerArrangement speakerarrangement, const String & hints="", const String & blurb="") Add an input bus with uilabel and channels configured viaspeakerarrangement . |
OBusId | add_output_bus (CString uilabel, SpeakerArrangement speakerarrangement, const String & hints="", const String & blurb="") Add an output bus with uilabel and channels configured viaspeakerarrangement . |
virtual void | adjust_param (uint32_t paramid) |
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 , channelc withv . |
bool | atomic_bit_notify (size_t nth) 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 outputobusid ofAudioProcessor __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) |
virtual void | initialize (SpeakerArrangement busses) = 0 |
void | install_params (const AudioParams::Map & params) Reset list of parameters, enqueues parameter value initializaiton events. |
IOBus & | iobus (OBusId busid) Get internal output bus handle. |
IOBus & | iobus (IBusId busid) Get internal input bus handle. |
const IOBus & | iobus (OBusId busid) const |
const IOBus & | iobus (IBusId busid) const |
MidiEventInput | midi_event_input () Access the current MidiEvent inputs during render(), needsprepare_event_input() . |
MidiEventOutput & | midi_event_output () Access the current output EventStream during render(), needs prepare_event_output() . |
float * | oblock (OBusId b, uint c) |
double | peek_param_mt (Id32 paramid) const |
void | prepare_event_input () |
void | prepare_event_output () |
void | redirect_oblock (OBusId b, uint c, const float * block) Redirect output buffer of bus b , channelc to point toblock , or zeros ifblock==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. |
virtual uint | schedule_children () |
uint | schedule_processor () Schedule this node and its dependencies for engine rendering. |
virtual | ~AudioProcessor () The destructor is called when the last std::shared_ptr<> reference drops. |
Protected Static Functions
Type | Name |
---|---|
uint | schedule_processor (AudioProcessor & p) |
Public Types Documentation
typedef MakeDeviceP
using Ase::AudioProcessor::MakeDeviceP = std::function<DeviceP (const String&, StaticInfo, AudioProcessorP)>;
typedef MakeProcessor
using Ase::AudioProcessor::MakeProcessor = AudioProcessorP (*) (AudioEngine&);
typedef MakeProcessorP
using Ase::AudioProcessor::MakeProcessorP = AudioProcessorP (*) (CString,AudioEngine&);
typedef MaybeParamId
using Ase::AudioProcessor::MaybeParamId = std::pair<ParamId,bool>;
typedef StaticInfo
using Ase::AudioProcessor::StaticInfo = void (*) (AudioProcessorInfo&);
Public Static Attributes Documentation
variable GUIONLY
":G:r:w:" - GUI READABLE WRITABLE
const String Ase::AudioProcessor::GUIONLY;
GUI READABLE WRITABLE.
variable STANDARD
":G:S:r:w:" - GUI STORAGE READABLE WRITABLE
const String Ase::AudioProcessor::STANDARD;
GUI STORAGE READABLE WRITABLE.
variable STORAGEONLY
":S:r:w:" - STORAGE READABLE WRITABLE
const String Ase::AudioProcessor::STORAGEONLY;
STORAGE READABLE WRITABLE.
Public Functions Documentation
function adjust_all_params
inline void Ase::AudioProcessor::adjust_all_params ()
function atomic_bits_iter
AtomicBits::Iter Ase::AudioProcessor::atomic_bits_iter (
size_t pos=0
) const
function bus_info [1/2]
inline BusInfo Ase::AudioProcessor::bus_info (
IBusId busid
) const
function bus_info [2/2]
inline BusInfo Ase::AudioProcessor::bus_info (
OBusId busid
) const
function check_dirty
inline 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().
function connect_event_input
void Ase::AudioProcessor::connect_event_input (
AudioProcessor & oproc
)
function connected
bool Ase::AudioProcessor::connected (
OBusId obusid
) const
Indicator for connected output buses. Not connected output bus buffers do not need to be filled.
function debug_name
String Ase::AudioProcessor::debug_name () const
function disconnect_event_input
void Ase::AudioProcessor::disconnect_event_input ()
function enable_engine_output
void Ase::AudioProcessor::enable_engine_output (
bool onoff
)
function engine
inline AudioEngine & Ase::AudioProcessor::engine () const
function find_ibus
IBusId Ase::AudioProcessor::find_ibus (
const String & name
) const
function find_obus
OBusId Ase::AudioProcessor::find_obus (
const String & name
) const
function find_param
MaybeParamId Ase::AudioProcessor::find_param (
const String & identifier
) const
function get_device
DeviceP Ase::AudioProcessor::get_device () const
function get_normalized
double Ase::AudioProcessor::get_normalized (
Id32 paramid
)
function get_param
inline double Ase::AudioProcessor::get_param (
Id32 paramid
)
function has_event_input
inline bool Ase::AudioProcessor::has_event_input () const
function has_event_output
inline bool Ase::AudioProcessor::has_event_output () const
function ifloats
inline const float * Ase::AudioProcessor::ifloats (
IBusId b,
uint c
) const
function inyquist
inline double Ase::AudioProcessor::inyquist () const
function is_initialized
bool Ase::AudioProcessor::is_initialized () const
function n_ibuses
inline uint Ase::AudioProcessor::n_ibuses () const
function n_ichannels
inline uint Ase::AudioProcessor::n_ichannels (
IBusId busid
) const
function n_obuses
inline uint Ase::AudioProcessor::n_obuses () const
function n_ochannels
inline uint Ase::AudioProcessor::n_ochannels (
OBusId busid
) const
function note_to_freq
float Ase::AudioProcessor::note_to_freq (
int note
) const
function nyquist
inline double Ase::AudioProcessor::nyquist () const
function ofloats
inline const float * Ase::AudioProcessor::ofloats (
OBusId b,
uint c
) const
function param_range
MinMax Ase::AudioProcessor::param_range (
Id32 paramid
) const
function param_value_from_text
virtual double Ase::AudioProcessor::param_value_from_text (
uint32_t paramid,
const String & text
) const
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).
function param_value_to_text
virtual String Ase::AudioProcessor::param_value_to_text (
uint32_t paramid,
double value
) const
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).
function parameter
ParameterC Ase::AudioProcessor::parameter (
Id32 paramid
) const
function sample_rate
inline uint Ase::AudioProcessor::sample_rate () const
function send_param
bool Ase::AudioProcessor::send_param (
Id32 paramid,
double value
)
function set_normalized
bool Ase::AudioProcessor::set_normalized (
Id32 paramid,
double normalized
)
function text_param_from_quark
String Ase::AudioProcessor::text_param_from_quark (
uint32_t paramid,
uint vint
)
function text_param_to_quark
uint Ase::AudioProcessor::text_param_to_quark (
uint32_t paramid,
const String & text
)
function transport
inline const AudioTransport & Ase::AudioProcessor::transport () const
function value_from_normalized
virtual double Ase::AudioProcessor::value_from_normalized (
Id32 paramid,
double normalized
) const
function value_to_normalized
virtual double Ase::AudioProcessor::value_to_normalized (
Id32 paramid,
double value
) const
Public Static Functions Documentation
function create_processor
template<class AudioProc, class ... Args>
static std::shared_ptr< AudioProc > Ase::AudioProcessor::create_processor (
AudioEngine & engine,
const Args &... args
)
function param_peek_mt
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.
function registry_add
static void Ase::AudioProcessor::registry_add (
CString aseid,
StaticInfo static_info,
MakeProcessorP makeproc
)
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()
.
function registry_create
static DeviceP Ase::AudioProcessor::registry_create (
CString aseid,
AudioEngine & engine,
const MakeDeviceP & makedevice
)
function registry_foreach
static void Ase::AudioProcessor::registry_foreach (
const std::function< void(const String &aseid, StaticInfo)> & fun
)
function timestamp
static inline uint64 Ase::AudioProcessor::timestamp ()
Protected Types Documentation
enum AudioProcessor
enum Ase::AudioProcessor::AudioProcessor {
INITIALIZED = 1 << 0,
SCHEDULED = 1 << 2,
PARAMCHANGE = 1 << 3,
BUSCONNECT = 1 << 4,
BUSDISCONNECT = 1 << 5,
INSERTION = 1 << 6,
REMOVAL = 1 << 7,
ENGINE_OUTPUT = 1 << 8
};
typedef MidiEventInput
using Ase::AudioProcessor::MidiEventInput = MidiEventReader<2>;
typedef MinMax
using Ase::AudioProcessor::MinMax = std::pair<double,double>;
Protected Attributes Documentation
variable aseid_
CString Ase::AudioProcessor::aseid_;
variable engine_
AudioEngine& Ase::AudioProcessor::engine_;
variable flags_
std::atomic<uint32> Ase::AudioProcessor::flags_;
Protected Functions Documentation
function AudioProcessor [2/2]
explicit Ase::AudioProcessor::AudioProcessor (
const ProcessorSetup & psetup
)
function add_input_bus
IBusId Ase::AudioProcessor::add_input_bus (
CString uilabel,
SpeakerArrangement speakerarrangement,
const String & hints="",
const String & blurb=""
)
function add_output_bus
OBusId Ase::AudioProcessor::add_output_bus (
CString uilabel,
SpeakerArrangement speakerarrangement,
const String & hints="",
const String & blurb=""
)
function adjust_param
inline virtual void Ase::AudioProcessor::adjust_param (
uint32_t paramid
)
function apply_event
inline void Ase::AudioProcessor::apply_event (
const MidiEvent & event
)
function apply_input_events
inline void Ase::AudioProcessor::apply_input_events ()
Process all input events via apply_event() and adjust_param(). This applies all incoming parameter changes, events like NOTE_ON are not handled.
function assign_oblock
void Ase::AudioProcessor::assign_oblock (
OBusId b,
uint c,
float val
)
function atomic_bit_notify
bool Ase::AudioProcessor::atomic_bit_notify (
size_t nth
)
function atomic_bits_resize
void Ase::AudioProcessor::atomic_bits_resize (
size_t count
)
function connect
void Ase::AudioProcessor::connect (
IBusId ibus,
AudioProcessor & oproc,
OBusId obus
)
function disconnect
void Ase::AudioProcessor::disconnect (
IBusId ibus
)
function disconnect_ibuses
void Ase::AudioProcessor::disconnect_ibuses ()
function disconnect_obuses
void Ase::AudioProcessor::disconnect_obuses ()
function enotify_enqueue_mt
void Ase::AudioProcessor::enotify_enqueue_mt (
uint32 pushmask
)
Queue an AudioProcessor notification This function is MT-Safe after proper AudioProcessor initialization.
function initialize
virtual void Ase::AudioProcessor::initialize (
SpeakerArrangement busses
) = 0
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.
function install_params
void Ase::AudioProcessor::install_params (
const AudioParams::Map & params
)
function iobus [1/4]
IOBus & Ase::AudioProcessor::iobus (
OBusId busid
)
function iobus [2/4]
IOBus & Ase::AudioProcessor::iobus (
IBusId busid
)
function iobus [3/4]
inline const IOBus & Ase::AudioProcessor::iobus (
OBusId busid
) const
function iobus [4/4]
inline const IOBus & Ase::AudioProcessor::iobus (
IBusId busid
) const
function midi_event_input
MidiEventInput Ase::AudioProcessor::midi_event_input ()
function midi_event_output
MidiEventOutput & Ase::AudioProcessor::midi_event_output ()
function oblock
inline float * Ase::AudioProcessor::oblock (
OBusId b,
uint c
)
Reset buffer redirections and access float buffer of output bus b
, channel c
. See also ofloats() for readonly access and redirect_oblock() for redirections.
function peek_param_mt
double Ase::AudioProcessor::peek_param_mt (
Id32 paramid
) const
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.
function prepare_event_input
void Ase::AudioProcessor::prepare_event_input ()
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.
function prepare_event_output
void Ase::AudioProcessor::prepare_event_output ()
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.
function redirect_oblock
void Ase::AudioProcessor::redirect_oblock (
OBusId b,
uint c,
const float * block
)
function remove_all_buses
void Ase::AudioProcessor::remove_all_buses ()
function reschedule
void Ase::AudioProcessor::reschedule ()
function schedule_children
inline virtual uint Ase::AudioProcessor::schedule_children ()
function schedule_processor [1/2]
uint Ase::AudioProcessor::schedule_processor ()
function ~AudioProcessor
virtual Ase::AudioProcessor::~AudioProcessor ()
Protected Static Functions Documentation
function schedule_processor [2/2]
static inline uint Ase::AudioProcessor::schedule_processor (
AudioProcessor & p
)
The documentation for this class was generated from the following file /__w/anklang/anklang/ase/processor.hh