Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
Ase::AudioProcessor Class Referenceabstract

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

#include "processor.hh"

Inheritance diagram for Ase::AudioProcessor:
[legend]

Classes

struct  EventStreams
 
class  FloatBuffer
 
struct  IOBus
 
union  IOBus.__unnamed27__
 
struct  IOBus.__unnamed27__.__unnamed29__
 
struct  IOBus.__unnamed27__.__unnamed31__
 
struct  ProcessorSetup
 
struct  RenderContext
 

Public Types

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 &)
 

Public Member Functions

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
 
AudioEngineengine () const
 Retrieve AudioEngine handle for this AudioProcessor.
 
const AudioTransporttransport () 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.
 
MaybeParamId find_param (const String &identifier) const
 Return the ParamId for parameter identifier or else 0.
 
MinMax param_range (Id32 paramid) const
 Retrieve the minimum / maximum values for a parameter.
 
bool check_dirty (Id32 paramid) const
 
void adjust_all_params ()
 
virtual String param_value_to_text (uint32_t paramid, double value) const
 
virtual double param_value_from_text (uint32_t paramid, const String &text) const
 
virtual double value_to_normalized (Id32 paramid, double value) const
 
virtual double value_from_normalized (Id32 paramid, double normalized) const
 
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).
 
uint text_param_to_quark (uint32_t paramid, const String &text)
 Ase main-thread helper for temporary string<->uint conversions.
 
String text_param_from_quark (uint32_t paramid, uint vint)
 Helper for temporary uint<->string conversions.
 
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.
 
uint n_ibuses () const
 Number of input buses configured for this AudioProcessor.
 
uint n_obuses () const
 Number of output buses configured for this AudioProcessor.
 
uint n_ichannels (IBusId busid) const
 Number of channels of input bus busid configured for this AudioProcessor.
 
uint n_ochannels (OBusId busid) const
 Number of channels of output bus busid configured for this AudioProcessor.
 
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 connected (OBusId obusid) const
 
const floatifloats (IBusId b, uint c) const
 Access readonly float buffer of input bus b, channel c, see also ofloats().
 
const floatofloats (OBusId b, uint c) const
 Access readonly float buffer of output bus b, channel c, see also oblock().
 
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.
 
- Public Member Functions inherited from std::enable_shared_from_this< AudioProcessor >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 
~enable_shared_from_this (T... args)
 
- Public Member Functions inherited from Ase::FastMemory::NewDeleteBase
void * operator new (std::size_t sz)
 
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, std::align_val_t al)
 
void operator delete (void *ptr, std::size_t sz)
 
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, std::align_val_t al)
 

Static Public Member Functions

static uint64 timestamp ()
 The current timestamp in sample frames.
 
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)
 Iterate over the known AudioProcessor types.
 
template<class AudioProc , class ... Args>
static std::shared_ptr< AudioProc > create_processor (AudioEngine &engine, const Args &...args)
 

Static Public Attributes

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
 

Protected Types

enum  {
  INITIALIZED , SCHEDULED , PARAMCHANGE , BUSCONNECT ,
  BUSDISCONNECT , INSERTION , REMOVAL , ENGINE_OUTPUT
}
 
using MinMax = std::pair< double, double >
 
using MidiEventInput = MidiEventReader< 2 >
 

Protected Member Functions

 AudioProcessor (const ProcessorSetup &)
 Constructor for AudioProcessor.
 
virtual ~AudioProcessor ()
 The destructor is called when the last std::shared_ptr<> reference drops.
 
virtual void initialize (SpeakerArrangement busses)=0
 
void enotify_enqueue_mt (uint32 pushmask)
 
uint schedule_processor ()
 Schedule this node and its dependencies for engine rendering.
 
void reschedule ()
 Request recreation of the audio engine rendering schedule.
 
virtual uint schedule_children ()
 
void install_params (const AudioParams::Map &params)
 Reset list of parameters, enqueues parameter value initializaiton events.
 
void apply_event (const MidiEvent &event)
 Assign MidiEvent::PARAM_VALUE event values to parameters.
 
void apply_input_events ()
 
virtual void adjust_param (uint32_t paramid)
 
double peek_param_mt (Id32 paramid) const
 
IBusId add_input_bus (CString uilabel, SpeakerArrangement speakerarrangement, const String &hints="", const String &blurb="")
 Add an input bus with uilabel and channels configured via speakerarrangement.
 
OBusId add_output_bus (CString uilabel, SpeakerArrangement speakerarrangement, const String &hints="", const String &blurb="")
 Add an output bus with uilabel and channels configured via speakerarrangement.
 
void remove_all_buses ()
 Remove existing bus configurations, useful at the start of configure().
 
IOBusiobus (OBusId busid)
 Get internal output bus handle.
 
IOBusiobus (IBusId busid)
 Get internal input bus handle.
 
const IOBusiobus (OBusId busid) const
 
const IOBusiobus (IBusId busid) const
 
void disconnect_ibuses ()
 Reset input bus buffer data.
 
void disconnect_obuses ()
 Disconnect inputs of all Processors that are connected to outputs of this.
 
void disconnect (IBusId ibus)
 Disconnect input ibusid.
 
void connect (IBusId ibus, AudioProcessor &oproc, OBusId obus)
 Connect input ibusid to output obusid of AudioProcessor prev.
 
floatoblock (OBusId b, uint c)
 
void assign_oblock (OBusId b, uint c, float val)
 Fill the output buffer of bus b, channel c with v.
 
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 prepare_event_input ()
 
void prepare_event_output ()
 
MidiEventInput midi_event_input ()
 Access the current MidiEvent inputs during render(), needs prepare_event_input().
 
MidiEventOutputmidi_event_output ()
 Access the current output EventStream during render(), needs prepare_event_output().
 
void atomic_bits_resize (size_t count)
 Prepare count bits for atomic notifications.
 
bool atomic_bit_notify (size_t nth)
 Set the nth atomic notification bit, return if enotify_enqueue_mt() is needed.
 

Static Protected Member Functions

static uint schedule_processor (AudioProcessor &p)
 

Protected Attributes

std::atomic< uint32flags_
 
AudioEngineengine_
 
CString aseid_
 

Friends

class ProcessorManager
 
class DeviceImpl
 
class NativeDeviceImpl
 
class AudioEngineThread
 

Detailed Description

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

Definition at line 76 of file processor.hh.


Class Documentation

◆ Ase::AudioProcessor::IOBus.__unnamed27__

union Ase::AudioProcessor::IOBus.__unnamed27__

Definition at line 289 of file processor.hh.

Class Members
struct IOBus.__unnamed27__.__unnamed29__ __unnamed__
struct IOBus.__unnamed27__.__unnamed31__ __unnamed__
IOTag iotag
uint mem_[4]

◆ Ase::AudioProcessor::IOBus.__unnamed27__.__unnamed29__

struct Ase::AudioProcessor::IOBus.__unnamed27__.__unnamed29__

Definition at line 291 of file processor.hh.

Class Members
IOTag ibus
OBusId obusid
AudioProcessor * oproc

◆ Ase::AudioProcessor::IOBus.__unnamed27__.__unnamed31__

struct Ase::AudioProcessor::IOBus.__unnamed27__.__unnamed31__

Definition at line 296 of file processor.hh.

Class Members
uint fbuffer_concounter
uint fbuffer_count
uint fbuffer_index
IOTag obus

◆ Ase::AudioProcessor::ProcessorSetup

struct Ase::AudioProcessor::ProcessorSetup

Definition at line 137 of file processor.hh.

Class Members
CString aseid
AudioEngine & engine

◆ Ase::AudioProcessor::RenderContext

struct Ase::AudioProcessor::RenderContext

Definition at line 804 of file processor.cc.

Class Members
MidiEventVector * render_events

Member Typedef Documentation

◆ MakeDeviceP

using Ase::AudioProcessor::MakeDeviceP = std::function<DeviceP (const String&, StaticInfo, AudioProcessorP)>

Definition at line 237 of file processor.hh.

◆ MakeProcessor

using Ase::AudioProcessor::MakeProcessor = AudioProcessorP (*) (AudioEngine&)

Definition at line 185 of file processor.hh.

◆ MakeProcessorP

using Ase::AudioProcessor::MakeProcessorP = AudioProcessorP (*) (CString,AudioEngine&)

Definition at line 238 of file processor.hh.

◆ MaybeParamId

Definition at line 186 of file processor.hh.

◆ MidiEventInput

Definition at line 96 of file processor.hh.

◆ MinMax

Definition at line 94 of file processor.hh.

◆ StaticInfo

using Ase::AudioProcessor::StaticInfo = void (*) (AudioProcessorInfo&)

Definition at line 236 of file processor.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Definition at line 97 of file processor.hh.

Constructor & Destructor Documentation

◆ AudioProcessor()

Ase::AudioProcessor::AudioProcessor ( const ProcessorSetup psetup)
explicitprotected

Constructor for AudioProcessor.

Definition at line 104 of file processor.cc.

◆ ~AudioProcessor()

Ase::AudioProcessor::~AudioProcessor ( )
protectedvirtual

The destructor is called when the last std::shared_ptr<> reference drops.

Definition at line 111 of file processor.cc.

References std::atomic::exchange(), and remove_all_buses().

Member Function Documentation

◆ add_input_bus()

IBusId Ase::AudioProcessor::add_input_bus ( CString  uilabel,
SpeakerArrangement  speakerarrangement,
const String hints = "",
const String blurb = "" 
)
protected

Add an input bus with uilabel and channels configured via speakerarrangement.

Definition at line 510 of file processor.cc.

References assert_return, iobus(), is_initialized(), n_ibuses(), Ase::string_to_identifier(), and uint64_t.

Referenced by Ase::ClapAudioProcessor::initialize(), and Ase::AudioChain::initialize().

◆ add_output_bus()

OBusId Ase::AudioProcessor::add_output_bus ( CString  uilabel,
SpeakerArrangement  speakerarrangement,
const String hints = "",
const String blurb = "" 
)
protected

Add an output bus with uilabel and channels configured via speakerarrangement.

Definition at line 530 of file processor.cc.

References assert_return, iobus(), is_initialized(), n_obuses(), Ase::string_to_identifier(), and uint64_t.

Referenced by Ase::ClapAudioProcessor::initialize(), Ase::AudioChain::Inlet::initialize(), and Ase::AudioChain::initialize().

◆ adjust_all_params()

void Ase::AudioProcessor::adjust_all_params ( )

Definition at line 517 of file processor.hh.

◆ adjust_param()

virtual void Ase::AudioProcessor::adjust_param ( uint32_t  paramid)
protectedvirtual

Definition at line 156 of file processor.hh.

◆ apply_event()

void Ase::AudioProcessor::apply_event ( const MidiEvent event)
protected

Assign MidiEvent::PARAM_VALUE event values to parameters.

Definition at line 387 of file processor.hh.

References Ase::MidiEvent::type, and Ase::AudioParams::value().

Referenced by apply_input_events().

◆ apply_input_events()

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.

Definition at line 402 of file processor.hh.

References apply_event(), and midi_event_input().

◆ assign_oblock()

void Ase::AudioProcessor::assign_oblock ( OBusId  b,
uint  c,
float  val 
)
protected

Fill the output buffer of bus b, channel c with v.

Definition at line 627 of file processor.cc.

References Ase::floatfill(), and oblock().

◆ atomic_bit_notify()

bool Ase::AudioProcessor::atomic_bit_notify ( size_t  nth)
protected

Set the nth atomic notification bit, return if enotify_enqueue_mt() is needed.

Definition at line 389 of file processor.cc.

References assert_return.

◆ atomic_bits_iter()

AtomicBits::Iter Ase::AudioProcessor::atomic_bits_iter ( size_t  pos = 0) const

Allow iterations over the atomic bits.

Definition at line 399 of file processor.cc.

References return_unless.

◆ atomic_bits_resize()

void Ase::AudioProcessor::atomic_bits_resize ( size_t  count)
protected

Prepare count bits for atomic notifications.

Definition at line 380 of file processor.cc.

◆ bus_info() [1/2]

BusInfo Ase::AudioProcessor::bus_info ( IBusId  busid) const

Retrieve BusInfo for an input bus.

Definition at line 487 of file processor.hh.

References iobus().

◆ bus_info() [2/2]

BusInfo Ase::AudioProcessor::bus_info ( OBusId  busid) const

Retrieve BusInfo for an output bus.

Definition at line 494 of file processor.hh.

References iobus().

◆ check_dirty()

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

Definition at line 536 of file processor.hh.

References Ase::AudioParams::dirty_index(), Ase::AudioParams::index(), and ssize_t.

◆ connect()

void Ase::AudioProcessor::connect ( IBusId  ibus,
AudioProcessor oproc,
OBusId  obus 
)
protected

◆ connect_event_input()

void Ase::AudioProcessor::connect_event_input ( AudioProcessor oproc)

Connect event input to event output of AudioProcessor oproc.

Definition at line 494 of file processor.cc.

References assert_return, disconnect_event_input(), enotify_enqueue_mt(), has_event_input(), has_event_output(), std::vector::push_back(), and reschedule().

◆ connected()

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

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

Definition at line 637 of file processor.cc.

References assert_return, iobus(), n_obuses(), and size_t.

◆ create_processor()

template<class AudioProc , class ... Args>
std::shared_ptr< AudioProc > Ase::AudioProcessor::create_processor ( AudioEngine engine,
const Args &...  args 
)
static

Definition at line 599 of file processor.hh.

◆ debug_name()

String Ase::AudioProcessor::debug_name ( ) const

Definition at line 423 of file processor.cc.

◆ disconnect()

void Ase::AudioProcessor::disconnect ( IBusId  ibus)
protected

◆ disconnect_event_input()

void Ase::AudioProcessor::disconnect_event_input ( )

Disconnect event input if a connection is present.

Definition at line 477 of file processor.cc.

References assert_return, enotify_enqueue_mt(), Ase::Aux::erase_first(), and reschedule().

Referenced by connect_event_input(), and disconnect().

◆ disconnect_ibuses()

void Ase::AudioProcessor::disconnect_ibuses ( )
protected

Reset input bus buffer data.

Definition at line 662 of file processor.cc.

References disconnect(), n_ibuses(), and reschedule().

◆ disconnect_obuses()

void Ase::AudioProcessor::disconnect_obuses ( )
protected

Disconnect inputs of all Processors that are connected to outputs of this.

Definition at line 673 of file processor.cc.

References std::vector::back(), reschedule(), return_unless, and std::vector::size().

◆ enable_engine_output()

void Ase::AudioProcessor::enable_engine_output ( bool  onoff)

Configure if the main output of this module is mixed into the engine output.

Definition at line 446 of file processor.cc.

References assert_return, has_event_output(), and n_obuses().

◆ engine()

AudioEngine & Ase::AudioProcessor::engine ( ) const

Retrieve AudioEngine handle for this AudioProcessor.

Definition at line 425 of file processor.hh.

Referenced by Ase::register_audio_processor().

◆ enotify_enqueue_mt()

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

◆ find_ibus()

IBusId Ase::AudioProcessor::find_ibus ( const String name) const

Return the IBusId for input bus uilabel or else 0.

Definition at line 549 of file processor.cc.

References Ase::BusInfo::ident, iobus(), Ase::CString::lookup(), n_ibuses(), and size_t.

◆ find_obus()

OBusId Ase::AudioProcessor::find_obus ( const String name) const

Return the OBusId for output bus uilabel or else 0.

Definition at line 561 of file processor.cc.

References Ase::BusInfo::ident, iobus(), Ase::CString::lookup(), n_obuses(), and size_t.

◆ find_param()

auto Ase::AudioProcessor::find_param ( const String identifier) const

Return the ParamId for parameter identifier or else 0.

Definition at line 225 of file processor.cc.

References Ase::CString::lookup(), and std::make_pair().

◆ get_device()

DeviceP Ase::AudioProcessor::get_device ( ) const

Gain access to the Device handle of this AudioProcessor.

Definition at line 130 of file processor.cc.

Referenced by Ase::ClapAudioProcessor::initialize().

◆ get_normalized()

double Ase::AudioProcessor::get_normalized ( Id32  paramid)

Get param value normalized into 0…1.

Definition at line 314 of file processor.cc.

References get_param().

◆ get_param()

double Ase::AudioProcessor::get_param ( Id32  paramid)

Fetch value of parameter id.

Definition at line 525 of file processor.hh.

References Ase::AudioParams::index(), and ssize_t.

Referenced by get_normalized().

◆ has_event_input()

bool Ase::AudioProcessor::has_event_input ( ) const

Returns true if this AudioProcessor has an event input stream.

Definition at line 459 of file processor.hh.

Referenced by connect_event_input(), and Ase::ClapAudioProcessor::initialize().

◆ has_event_output()

bool Ase::AudioProcessor::has_event_output ( ) const

Returns true if this AudioProcessor has an event output stream.

Definition at line 466 of file processor.hh.

Referenced by connect_event_input(), enable_engine_output(), and Ase::ClapAudioProcessor::initialize().

◆ ifloats()

const float * Ase::AudioProcessor::ifloats ( IBusId  b,
uint  c 
) const

Access readonly float buffer of input bus b, channel c, see also ofloats().

Definition at line 546 of file processor.hh.

Referenced by Ase::ClapAudioProcessor::render(), and Ase::AudioChain::Inlet::render().

◆ initialize()

void Ase::AudioProcessor::initialize ( SpeakerArrangement  busses)
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 Ase::ClapAudioProcessor, Ase::AudioChain::Inlet, Ase::AudioChain, and Ase::MidiLib::MidiProducerImpl.

Definition at line 432 of file processor.cc.

References assert_return, n_ibuses(), and n_obuses().

◆ install_params()

void Ase::AudioProcessor::install_params ( const AudioParams::Map params)
protected

Reset list of parameters, enqueues parameter value initializaiton events.

Definition at line 213 of file processor.cc.

References assert_return, and Ase::AudioParams::install().

◆ inyquist()

double Ase::AudioProcessor::inyquist ( ) const

Inverse Nyquist frequency, i.e. 1.0 / nyquist().

Definition at line 452 of file processor.hh.

◆ iobus() [1/4]

AudioProcessor::IOBus & Ase::AudioProcessor::iobus ( IBusId  busid)
protected

Get internal input bus handle.

Definition at line 159 of file processor.cc.

References assert_return, assert_warn, n_ibuses(), and size_t.

◆ iobus() [2/4]

const IOBus & Ase::AudioProcessor::iobus ( IBusId  busid) const
protected

Definition at line 167 of file processor.hh.

◆ iobus() [3/4]

AudioProcessor::IOBus & Ase::AudioProcessor::iobus ( OBusId  busid)
protected

◆ iobus() [4/4]

const IOBus & Ase::AudioProcessor::iobus ( OBusId  busid) const
protected

Definition at line 166 of file processor.hh.

◆ is_initialized()

bool Ase::AudioProcessor::is_initialized ( ) const

Check if AudioProcessor has been properly intiialized (so the parameter set is fixed).

Definition at line 407 of file processor.cc.

Referenced by add_input_bus(), and add_output_bus().

◆ midi_event_input()

AudioProcessor::MidiEventInput Ase::AudioProcessor::midi_event_input ( )
protected

Access the current MidiEvent inputs during render(), needs prepare_event_input().

Definition at line 844 of file processor.cc.

Referenced by apply_input_events(), and Ase::MidiLib::MidiProducerImpl::render().

◆ midi_event_output()

MidiEventOutput & Ase::AudioProcessor::midi_event_output ( )
protected

Access the current output EventStream during render(), needs prepare_event_output().

Definition at line 859 of file processor.cc.

References assert_return.

Referenced by Ase::MidiLib::MidiProducerImpl::render().

◆ n_ibuses()

uint Ase::AudioProcessor::n_ibuses ( ) const

Number of input buses configured for this AudioProcessor.

Definition at line 473 of file processor.hh.

Referenced by add_input_bus(), connect(), disconnect(), disconnect_ibuses(), find_ibus(), initialize(), iobus(), and schedule_processor().

◆ n_ichannels()

uint Ase::AudioProcessor::n_ichannels ( IBusId  busid) const

Number of channels of input bus busid configured for this AudioProcessor.

Definition at line 501 of file processor.hh.

References iobus(), and Ase::BusInfo::n_channels().

Referenced by connect(), Ase::ClapAudioProcessor::render(), and Ase::AudioChain::Inlet::render().

◆ n_obuses()

uint Ase::AudioProcessor::n_obuses ( ) const

Number of output buses configured for this AudioProcessor.

Definition at line 480 of file processor.hh.

Referenced by add_output_bus(), connect(), connected(), disconnect(), enable_engine_output(), find_obus(), initialize(), iobus(), and redirect_oblock().

◆ n_ochannels()

uint Ase::AudioProcessor::n_ochannels ( OBusId  busid) const

Number of channels of output bus busid configured for this AudioProcessor.

Definition at line 509 of file processor.hh.

References iobus(), and Ase::BusInfo::n_channels().

Referenced by connect(), Ase::ClapAudioProcessor::render(), Ase::AudioChain::Inlet::render(), and Ase::AudioChain::render().

◆ note_to_freq()

float Ase::AudioProcessor::note_to_freq ( int  note) const

Convert MIDI note to Hertz according to the current MusicalTuning.

Definition at line 123 of file processor.cc.

References Ase::MidiNote::note_to_freq().

◆ nyquist()

double Ase::AudioProcessor::nyquist ( ) const

Half the sample rate in Hz as double, used for render().

Definition at line 445 of file processor.hh.

◆ oblock()

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.

Definition at line 561 of file processor.hh.

Referenced by assign_oblock(), and Ase::ClapAudioProcessor::render().

◆ ofloats()

const float * Ase::AudioProcessor::ofloats ( OBusId  b,
uint  c 
) const

Access readonly float buffer of output bus b, channel c, see also oblock().

Definition at line 553 of file processor.hh.

Referenced by Ase::AudioChain::render().

◆ param_peek_mt()

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

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

Definition at line 283 of file processor.cc.

References assert_return.

◆ param_range()

AudioProcessor::MinMax Ase::AudioProcessor::param_range ( Id32  paramid) const

Retrieve the minimum / maximum values for a parameter.

Definition at line 414 of file processor.cc.

References fmax(), fmin(), parameter(), and return_unless.

◆ param_value_from_text()

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

Definition at line 351 of file processor.cc.

References parameter().

◆ param_value_to_text()

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

Definition at line 336 of file processor.cc.

References parameter().

◆ parameter()

ParameterC Ase::AudioProcessor::parameter ( Id32  paramid) const

Retrieve supplemental information for parameters, usually to enhance the user interface.

Definition at line 262 of file processor.cc.

References Ase::AudioParams::index(), and ssize_t.

Referenced by param_range(), param_value_from_text(), param_value_to_text(), send_param(), and text_param_to_quark().

◆ peek_param_mt()

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.

Definition at line 272 of file processor.cc.

References Ase::AudioParams::index(), and ssize_t.

◆ prepare_event_input()

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.

Definition at line 456 of file processor.cc.

References assert_return.

Referenced by Ase::ClapAudioProcessor::initialize(), and Ase::MidiLib::MidiProducerImpl::initialize().

◆ prepare_event_output()

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.

Definition at line 467 of file processor.cc.

References assert_return.

Referenced by Ase::ClapAudioProcessor::initialize(), and Ase::MidiLib::MidiProducerImpl::initialize().

◆ redirect_oblock()

void Ase::AudioProcessor::redirect_oblock ( OBusId  b,
uint  c,
const float block 
)
protected

Redirect output buffer of bus b, channel c to point to block, or zeros if block==nullptr.

Definition at line 611 of file processor.cc.

References assert_return, Ase::const_float_zeros, iobus(), n_obuses(), and size_t.

Referenced by Ase::AudioChain::Inlet::render(), and Ase::AudioChain::render().

◆ registry_add()

void Ase::AudioProcessor::registry_add ( CString  aseid,
StaticInfo  static_info,
MakeProcessorP  makeproc 
)
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().

Definition at line 879 of file processor.cc.

References Ase::AudioProcessorRegistry::aseid, assert_return, std::atomic_compare_exchange_strong(), and Ase::string_startswith().

Referenced by Ase::register_audio_processor().

◆ registry_create()

DeviceP Ase::AudioProcessor::registry_create ( CString  aseid,
AudioEngine engine,
const MakeDeviceP makedevice 
)
static

Definition at line 892 of file processor.cc.

◆ registry_foreach()

void Ase::AudioProcessor::registry_foreach ( const std::function< void(const String &aseid, StaticInfo)> &  fun)
static

Iterate over the known AudioProcessor types.

Definition at line 909 of file processor.cc.

◆ remove_all_buses()

void Ase::AudioProcessor::remove_all_buses ( )
protected

Remove existing bus configurations, useful at the start of configure().

Definition at line 646 of file processor.cc.

References assert_return, std::vector::empty(), and reschedule().

Referenced by Ase::ClapAudioProcessor::initialize(), Ase::AudioChain::Inlet::initialize(), Ase::MidiLib::MidiProducerImpl::initialize(), and ~AudioProcessor().

◆ reschedule()

void Ase::AudioProcessor::reschedule ( )
protected

Request recreation of the audio engine rendering schedule.

Definition at line 439 of file processor.cc.

Referenced by connect(), connect_event_input(), disconnect(), disconnect_event_input(), disconnect_ibuses(), disconnect_obuses(), Ase::AudioCombo::insert(), Ase::AudioCombo::remove(), and remove_all_buses().

◆ sample_rate()

uint Ase::AudioProcessor::sample_rate ( ) const

Definition at line 438 of file processor.hh.

◆ schedule_children()

virtual uint Ase::AudioProcessor::schedule_children ( )
protectedvirtual

Definition at line 150 of file processor.hh.

◆ schedule_processor() [1/2]

uint Ase::AudioProcessor::schedule_processor ( )
protected

Schedule this node and its dependencies for engine rendering.

Definition at line 781 of file processor.cc.

References iobus(), std::max(), n_ibuses(), and schedule_processor().

Referenced by schedule_processor().

◆ schedule_processor() [2/2]

static uint Ase::AudioProcessor::schedule_processor ( AudioProcessor p)
staticprotected

Definition at line 151 of file processor.hh.

◆ send_param()

bool Ase::AudioProcessor::send_param ( Id32  paramid,
double  value 
)

Set parameter id to value within ParamInfo.get_minmax().

Definition at line 238 of file processor.cc.

References assert_return, Ase::AudioParams::index(), parameter(), and ssize_t.

Referenced by set_normalized().

◆ set_normalized()

bool Ase::AudioProcessor::set_normalized ( Id32  paramid,
double  normalized 
)

Set param value normalized into 0…1.

Definition at line 321 of file processor.cc.

References ASE_ISLIKELY, and send_param().

◆ text_param_from_quark()

String Ase::AudioProcessor::text_param_from_quark ( uint32_t  paramid,
uint  vint 
)

Helper for temporary uint<->string conversions.

Definition at line 372 of file processor.cc.

◆ text_param_to_quark()

uint Ase::AudioProcessor::text_param_to_quark ( uint32_t  paramid,
const String text 
)

Ase main-thread helper for temporary string<->uint conversions.

Definition at line 359 of file processor.cc.

References assert_return, and parameter().

◆ timestamp()

uint64 Ase::AudioProcessor::timestamp ( )
static

The current timestamp in sample frames.

Definition at line 568 of file processor.hh.

◆ transport()

const AudioTransport & Ase::AudioProcessor::transport ( ) const

Sample rate mixing frequency in Hz as unsigned, used for render().

Definition at line 432 of file processor.hh.

Referenced by Ase::MidiLib::MidiProducerImpl::render().

◆ value_from_normalized()

double Ase::AudioProcessor::value_from_normalized ( Id32  paramid,
double  normalized 
) const
virtual

Definition at line 302 of file processor.cc.

◆ value_to_normalized()

double Ase::AudioProcessor::value_to_normalized ( Id32  paramid,
double  value 
) const
virtual

Definition at line 291 of file processor.cc.

Friends And Related Symbol Documentation

◆ AudioEngineThread

friend class AudioEngineThread
friend

Definition at line 84 of file processor.hh.

◆ DeviceImpl

friend class DeviceImpl
friend

Definition at line 82 of file processor.hh.

◆ NativeDeviceImpl

friend class NativeDeviceImpl
friend

Definition at line 83 of file processor.hh.

◆ ProcessorManager

friend class ProcessorManager
friend

Definition at line 81 of file processor.hh.

Member Data Documentation

◆ aseid_

CString Ase::AudioProcessor::aseid_
protected

Definition at line 143 of file processor.hh.

◆ engine_

AudioEngine& Ase::AudioProcessor::engine_
protected

Definition at line 142 of file processor.hh.

◆ flags_

std::atomic<uint32> Ase::AudioProcessor::flags_
protected

Definition at line 107 of file processor.hh.

◆ GUIONLY

const String Ase::AudioProcessor::GUIONLY
static

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

GUI READABLE WRITABLE.

Definition at line 187 of file processor.hh.

◆ STANDARD

const String Ase::AudioProcessor::STANDARD
static

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

GUI STORAGE READABLE WRITABLE.

Definition at line 188 of file processor.hh.

◆ STORAGEONLY

const String Ase::AudioProcessor::STORAGEONLY
static

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

STORAGE READABLE WRITABLE.

Definition at line 189 of file processor.hh.


The documentation for this class was generated from the following files: