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

« « « Anklang Documentation
Loading...
Searching...
No Matches
processor.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#ifndef __ASE_PROCESSOR_HH__
3#define __ASE_PROCESSOR_HH__
4
5#include <ase/gadget.hh>
6#include <ase/parameter.hh>
7#include <ase/midievent.hh>
8#include <ase/datautils.hh>
9#include <ase/properties.hh>
10#include <ase/engine.hh>
11#include <ase/atomics.hh>
12#include <any>
13
14namespace Ase {
15
17enum class ParamId : uint32 {};
18ASE_DEFINE_ENUM_EQUALITY (ParamId);
19
21enum class IBusId : uint16 {};
22ASE_DEFINE_ENUM_EQUALITY (IBusId);
23
25enum class OBusId : uint16 {};
26ASE_DEFINE_ENUM_EQUALITY (OBusId);
27
39
41template<typename T> CString register_audio_processor (const char *aseid = nullptr);
42
52
54struct AudioParams final {
56 const uint32_t *ids = nullptr;
57 double *values = nullptr;
58 std::atomic<uint64_t> *bits = nullptr;
59 const ParameterC *parameters = nullptr;
60 std::weak_ptr<Property> *wprops = nullptr;
61 uint32 count = 0;
62 bool changed = false;
63 void clear ();
64 void install (const Map &params);
65 ssize_t index (uint32_t id) const;
66 double value (uint32_t id) const;
67 double value (uint32_t id, double newval);
68 bool dirty (uint32_t id) const { return dirty_index (index (id)); }
69 void dirty (uint32_t id, bool d) { return dirty_index (index (id), d); }
70 /*dtor*/ ~AudioParams();
71 bool dirty_index (uint32_t idx) const;
72 void dirty_index (uint32_t idx, bool d);
73};
74
77 struct IOBus;
78 struct EventStreams;
79 struct RenderContext;
80 class FloatBuffer;
81 friend class ProcessorManager;
82 friend class DeviceImpl;
83 friend class NativeDeviceImpl;
84 friend class AudioEngineThread;
85 struct OConnection {
86 AudioProcessor *proc = nullptr; IBusId ibusid = {};
87 bool operator== (const OConnection &o) const { return proc == o.proc && ibusid == o.ibusid; }
88 };
90 AudioProcessor *sched_next_ = nullptr;
91protected:
92#ifndef DOXYGEN
93 // Inherit `AudioSignal` concepts in derived classes from other namespaces
95#endif
97 enum { INITIALIZED = 1 << 0,
98 // = 1 << 1,
99 SCHEDULED = 1 << 2,
100 PARAMCHANGE = 1 << 3,
101 BUSCONNECT = 1 << 4,
102 BUSDISCONNECT = 1 << 5,
103 INSERTION = 1 << 6,
104 REMOVAL = 1 << 7,
105 ENGINE_OUTPUT = 1 << 8,
106 };
107 std::atomic<uint32> flags_ = 0;
108private:
109 uint32 output_offset_ = 0;
110 FloatBuffer *fbuffers_ = nullptr;
111 std::vector<IOBus> iobuses_;
112 AudioParams params_;
114 EventStreams *estreams_ = nullptr;
115 AtomicBits *atomic_bits_ = nullptr;
116 uint64_t render_stamp_ = 0;
119 MidiEventVectorAP t0events_ = nullptr;
120 RenderContext *render_context_ = nullptr;
121 std::vector<CString> cstrings0_, cstrings1_;
122 template<class F> void modify_t0events (const F&);
123 void assign_iobufs ();
124 void release_iobufs ();
125 void ensure_initialized (DeviceP devicep);
126 const FloatBuffer& float_buffer (IBusId busid, uint channelindex) const;
127 FloatBuffer& float_buffer (OBusId busid, uint channelindex, bool resetptr = false);
128 static
129 const FloatBuffer& zero_buffer ();
130 void render_block (uint64 target_stamp);
131 void reset_state (uint64 target_stamp);
132 /*copy*/ AudioProcessor (const AudioProcessor&) = delete;
133 virtual void render (uint n_frames) = 0;
134 virtual void reset (uint64 target_stamp) = 0;
135 PropertyS access_properties () const;
136public:
138 CString aseid;
139 AudioEngine &engine;
140 };
141protected:
142 AudioEngine &engine_;
143 CString aseid_;
144 explicit AudioProcessor (const ProcessorSetup&);
145 virtual ~AudioProcessor ();
146 virtual void initialize (SpeakerArrangement busses) = 0;
147 void enotify_enqueue_mt (uint32 pushmask);
149 void reschedule ();
150 virtual uint schedule_children () { return 0; }
151 static uint schedule_processor (AudioProcessor &p) { return p.schedule_processor(); }
152 // Parameters
153 void install_params (const AudioParams::Map &params);
154 void apply_event (const MidiEvent &event);
155 void apply_input_events ();
156 virtual void adjust_param (uint32_t paramid) {}
157 double peek_param_mt (Id32 paramid) const;
158 // Buses
159 IBusId add_input_bus (CString uilabel, SpeakerArrangement speakerarrangement,
160 const String &hints = "", const String &blurb = "");
161 OBusId add_output_bus (CString uilabel, SpeakerArrangement speakerarrangement,
162 const String &hints = "", const String &blurb = "");
163 void remove_all_buses ();
164 IOBus& iobus (OBusId busid);
165 IOBus& iobus (IBusId busid);
166 const IOBus& iobus (OBusId busid) const { return const_cast<AudioProcessor*> (this)->iobus (busid); }
167 const IOBus& iobus (IBusId busid) const { return const_cast<AudioProcessor*> (this)->iobus (busid); }
168 void disconnect_ibuses ();
169 void disconnect_obuses ();
170 void disconnect (IBusId ibus);
171 void connect (IBusId ibus, AudioProcessor &oproc, OBusId obus);
172 float* oblock (OBusId b, uint c);
173 void assign_oblock (OBusId b, uint c, float val);
174 void redirect_oblock (OBusId b, uint c, const float *block);
175 // event stream handling
176 void prepare_event_input ();
177 void prepare_event_output ();
178 MidiEventInput midi_event_input ();
179 MidiEventOutput& midi_event_output ();
180 // Atomic notification bits
181 void atomic_bits_resize (size_t count);
182 bool atomic_bit_notify (size_t nth);
183public:
184 AtomicBits::Iter atomic_bits_iter (size_t pos = 0) const;
185 using MakeProcessor = AudioProcessorP (*) (AudioEngine&);
186 using MaybeParamId = std::pair<ParamId,bool>;
187 static const String GUIONLY;
188 static const String STANDARD;
189 static const String STORAGEONLY;
190 float note_to_freq (int note) const;
191 String debug_name () const;
192 AudioEngine& engine () const ASE_CONST;
193 const AudioTransport& transport () const ASE_CONST;
194 uint sample_rate () const ASE_CONST;
195 double nyquist () const ASE_CONST;
196 double inyquist () const ASE_CONST;
197 // Parameters
198 double get_param (Id32 paramid);
199 bool send_param (Id32 paramid, double value);
200 ParameterC parameter (Id32 paramid) const;
201 MaybeParamId find_param (const String &identifier) const;
202 MinMax param_range (Id32 paramid) const;
203 bool check_dirty (Id32 paramid) const;
204 void adjust_all_params ();
205 virtual String param_value_to_text (uint32_t paramid, double value) const;
206 virtual double param_value_from_text (uint32_t paramid, const String &text) const;
207 virtual double value_to_normalized (Id32 paramid, double value) const;
208 virtual double value_from_normalized (Id32 paramid, double normalized) const;
209 double get_normalized (Id32 paramid);
210 bool set_normalized (Id32 paramid, double normalized);
211 bool is_initialized () const;
212 uint text_param_to_quark (uint32_t paramid, const String &text);
213 String text_param_from_quark (uint32_t paramid, uint vint);
214 // Buses
215 IBusId find_ibus (const String &name) const;
216 OBusId find_obus (const String &name) const;
217 uint n_ibuses () const;
218 uint n_obuses () const;
219 uint n_ichannels (IBusId busid) const;
220 uint n_ochannels (OBusId busid) const;
221 BusInfo bus_info (IBusId busid) const;
222 BusInfo bus_info (OBusId busid) const;
223 bool connected (OBusId obusid) const;
224 const float* ifloats (IBusId b, uint c) const;
225 const float* ofloats (OBusId b, uint c) const;
226 static uint64 timestamp ();
227 DeviceP get_device () const;
228 bool has_event_input () const;
229 bool has_event_output () const;
232 void enable_engine_output (bool onoff);
233 // MT-Safe accessors
234 static double param_peek_mt (const AudioProcessorP proc, Id32 paramid);
235 // AudioProcessor Registry
236 using StaticInfo = void (*) (AudioProcessorInfo&);
237 using MakeDeviceP = std::function<DeviceP (const String&, StaticInfo, AudioProcessorP)>;
238 using MakeProcessorP = AudioProcessorP (*) (CString,AudioEngine&);
239 static void registry_add (CString aseid, StaticInfo, MakeProcessorP);
240 static DeviceP registry_create (CString aseid, AudioEngine &engine, const MakeDeviceP&);
241 static void registry_foreach (const std::function<void (const String &aseid, StaticInfo)> &fun);
242 template<class AudioProc, class ...Args> std::shared_ptr<AudioProc>
243 static create_processor (AudioEngine &engine, const Args &...args);
244private:
245 static bool enotify_pending ();
246 static void enotify_dispatch ();
247 std::atomic<AudioProcessor*> nqueue_next_ { nullptr };
248 AudioProcessorP nqueue_guard_;
249 std::weak_ptr<Device> device_;
250 static constexpr uint32 NOTIFYMASK = PARAMCHANGE | BUSCONNECT | BUSDISCONNECT | INSERTION | REMOVAL;
251 static __thread uint64 tls_timestamp;
252};
253
258 void check ();
260 alignas (64) float fblock[AUDIO_BLOCK_MAX_RENDER_SIZE] = { 0, };
261 const uint64 canary0_ = const_canary;
262 const uint64 canary1_ = const_canary;
263 struct { uint64 d1, d2, d3, d4; }; // dummy mem
264 SpeakerArrangement speaker_arrangement_ = SpeakerArrangement::NONE;
265 SpeakerArrangement speaker_arrangement () const;
266 static constexpr uint64 const_canary = 0xE14D8A302B97C56F;
267 friend class AudioProcessor;
269 float *buffer = &fblock[0];
270};
271
272// == ProcessorManager ==
275protected:
276 static auto pm_remove_all_buses (AudioProcessor &p) { return p.remove_all_buses(); }
277 static auto pm_disconnect_ibuses (AudioProcessor &p) { return p.disconnect_ibuses(); }
278 static auto pm_disconnect_obuses (AudioProcessor &p) { return p.disconnect_obuses(); }
279 static auto pm_connect (AudioProcessor &p, IBusId i, AudioProcessor &d, OBusId o)
280 { return p.connect (i, d, o); }
281 static auto pm_connect_event_input (AudioProcessor &oproc, AudioProcessor &iproc)
282 { return iproc.connect_event_input (oproc); }
283};
284
285// == Inlined Internals ==
286// AudioProcessor internal input/output bus book keeping
288 enum IOTag : uint { IBUS = 1, OBUS = 2 };
289 union {
290 IOTag iotag;
291 struct /*IBus*/ {
292 IOTag ibus;
293 OBusId obusid;
294 AudioProcessor *oproc;
295 };
296 struct /*OBus*/ {
297 IOTag obus;
298 uint fbuffer_concounter;
299 uint fbuffer_count;
300 uint fbuffer_index; /* = ~0 */
301 };
302 uint mem_[4] = { 0, 0, 0, 0 };
303 };
304 explicit IOBus (IOTag io_tag, const String &ident, const String &label, SpeakerArrangement sa);
305};
306
307// AudioProcessor internal input/output event stream book keeping
309 static constexpr auto EVENT_ISTREAM = IBusId (0xff01); // *not* an input bus, ID is used for OConnection
310 AudioProcessor *oproc = nullptr;
311 MidiEventOutput midi_event_output;
312 bool has_event_input = false;
313 bool has_event_output = false;
314};
315
317inline ssize_t
318AudioParams::index (const uint32_t id) const
319{
320 if (id - 1 < count && ids[id - 1] == id) [[likely]]
321 return id - 1; // fast path for consecutive IDs
322 if (id < count && ids[id] == id) [[likely]]
323 return id - 1; // fast handling of 0-based IDs
324 auto [it,found] = Aux::binary_lookup_insertion_pos (ids, ids + count,
325 [] (auto a, auto b) { return a < b ? -1 : a > b; },
326 id);
327 return found ? it - ids : -1;
328}
329
331inline double
332AudioParams::value (uint32_t id) const
333{
334 const auto idx = index (id);
335 return idx < 0 ? 0.0 : values[idx];
336}
337
339inline double
340AudioParams::value (uint32_t id, double newval)
341{
342 const auto idx = index (id);
343 if (idx < 0) return 0.0;
344 const double old = values[idx];
345 values[idx] = newval;
346 if (!wprops[idx].expired()) {
347 dirty_index (idx, true);
348 changed = true;
349 }
350 return old;
351}
352
354inline bool
355AudioParams::dirty_index (uint32_t idx) const
356{
357 return bits[idx >> 6] & uint64_t (1) << (idx & (64-1));
358}
359
361inline void
362AudioParams::dirty_index (uint32_t idx, bool d)
363{
364 if (d)
365 bits[idx >> 6] |= uint64_t (1) << (idx & (64-1));
366 else
367 bits[idx >> 6] &= ~(uint64_t (1) << (idx & (64-1)));
368}
369
371template<class F> void
372AudioProcessor::modify_t0events (const F &mod)
373{
374 ASE_ASSERT_RETURN (this_thread_is_ase());
375 MidiEventVector *t0events = nullptr;
376 t0events = t0events_.exchange (t0events);
377 if (!t0events)
378 t0events = new std::vector<MidiEvent>;
379 mod (*t0events);
380 if (!t0events->empty())
381 t0events = t0events_.exchange (t0events);
382 delete t0events;
383}
384
386inline void
388{
389 switch (event.type)
390 {
391 case MidiEvent::PARAM_VALUE:
392 params_.value (event.param, event.pvalue);
393 break;
394 default: ;
395 }
396}
397
401inline void
403{
405 for (const auto &event : evinput)
406 switch (event.type) // event.message()
407 {
408 case MidiEvent::PARAM_VALUE:
409 apply_event (event);
410 adjust_param (event.param);
411 break;
412 default: ;
413 }
414}
415
417inline uint
419{
420 return speaker_arrangement_count_channels (speakers);
421}
422
424inline AudioEngine&
426{
427 return engine_;
428}
429
431inline const AudioTransport&
433{
434 return engine_.transport();
435}
436
437inline uint
438AudioProcessor::sample_rate () const
439{
440 return engine_.sample_rate();
441}
442
444inline double
446{
447 return engine_.nyquist();
448}
449
451inline double
453{
454 return engine_.inyquist();
455}
456
458inline bool
460{
461 return estreams_ && estreams_->has_event_input;
462}
463
465inline bool
467{
468 return estreams_ && estreams_->has_event_output;
469}
470
472inline uint
474{
475 return output_offset_;
476}
477
479inline uint
481{
482 return iobuses_.size() - output_offset_;
483}
484
486inline BusInfo
488{
489 return iobus (busid);
490}
491
493inline BusInfo
495{
496 return iobus (busid);
497}
498
500inline uint
502{
503 const IOBus &ibus = iobus (busid);
504 return ibus.n_channels();
505}
506
508inline uint
510{
511 const IOBus &obus = iobus (busid);
512 return obus.n_channels();
513}
514
515// Call adjust_param() for all parameters.
516inline void
517AudioProcessor::adjust_all_params()
518{
519 for (size_t idx = 0; idx < params_.count; idx++)
520 adjust_param (params_.ids[idx]);
521}
522
524inline double
526{
527 const ssize_t idx = params_.index (paramid.id);
528 if (idx < 0) [[unlikely]]
529 return 0;
530 return params_.values[idx];
531}
532
535inline bool
537{
538 const ssize_t idx = params_.index (paramid.id);
539 if (idx < 0) [[unlikely]]
540 return false;
541 return params_.dirty_index (idx);
542}
543
545inline const float*
547{
548 return float_buffer (b, c).buffer;
549}
550
552inline const float*
554{
555 return const_cast<AudioProcessor*> (this)->float_buffer (b, c).buffer;
556}
557
560inline float*
562{
563 return float_buffer (b, c, true).buffer;
564}
565
567inline uint64
569{
570 return tls_timestamp;
571}
572
575AudioProcessor::FloatBuffer::speaker_arrangement () const
576{
577 return speaker_arrangement_;
578}
579
581template<typename T> extern inline CString
582register_audio_processor (const char *caseid)
583{
584 CString aseid = caseid ? caseid : typeid_name<T>();
586 {
587 auto make_shared = [] (CString aseid, AudioEngine &engine) -> AudioProcessorP {
588 const AudioProcessor::ProcessorSetup psetup { aseid, engine };
589 return std::make_shared<T> (psetup);
590 };
591 AudioProcessor::registry_add (aseid, &T::static_info, make_shared);
592 }
593 else
594 static_assert (sizeof (T) < 0, "type `T` must be constructible from `T(AudioEngine&)`");
595 return aseid;
596}
597
598template<class AudioProc, class ...Args> std::shared_ptr<AudioProc>
599AudioProcessor::create_processor (AudioEngine &engine, const Args &...args)
600{
601 String aseid = typeid_name<AudioProc>();
602 const ProcessorSetup psetup { aseid, engine };
604 if (proc) {
605 AudioProcessorP aproc = proc;
606 aproc->ensure_initialized (nullptr);
607 }
608 return proc;
609}
610
611} // Ase
612
613#endif // __ASE_PROCESSOR_HH__
Vector of atomic bits, operates in blocks of 64 bits.
Definition atomics.hh:232
Audio signal AudioProcessor base class, implemented by all effects and instruments.
Definition processor.hh:76
bool set_normalized(Id32 paramid, double normalized)
Set param value normalized into 0…1.
Definition processor.cc:321
static const String GUIONLY
":G:r:w:" - GUI READABLE WRITABLE
Definition processor.hh:187
static uint64 timestamp()
The current timestamp in sample frames.
Definition processor.hh:568
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.
Definition processor.cc:611
void enotify_enqueue_mt(uint32 pushmask)
BusInfo bus_info(IBusId busid) const
Retrieve BusInfo for an input bus.
Definition processor.hh:487
void remove_all_buses()
Remove existing bus configurations, useful at the start of configure().
Definition processor.cc:646
float note_to_freq(int note) const
Convert MIDI note to Hertz according to the current MusicalTuning.
Definition processor.cc:123
const float * ifloats(IBusId b, uint c) const
Access readonly float buffer of input bus b, channel c, see also ofloats().
Definition processor.hh:546
IBusId find_ibus(const String &name) const
Return the IBusId for input bus uilabel or else 0.
Definition processor.cc:549
double get_param(Id32 paramid)
Fetch value of parameter id.
Definition processor.hh:525
double inyquist() const
Inverse Nyquist frequency, i.e. 1.0 / nyquist().
Definition processor.hh:452
IOBus & iobus(OBusId busid)
Get internal output bus handle.
Definition processor.cc:146
virtual String param_value_to_text(uint32_t paramid, double value) const
Definition processor.cc:336
bool send_param(Id32 paramid, double value)
Set parameter id to value within ParamInfo.get_minmax().
Definition processor.cc:238
MidiEventInput midi_event_input()
Access the current MidiEvent inputs during render(), needs prepare_event_input().
Definition processor.cc:844
MidiEventOutput & midi_event_output()
Access the current output EventStream during render(), needs prepare_event_output().
Definition processor.cc:859
uint n_ibuses() const
Number of input buses configured for this AudioProcessor.
Definition processor.hh:473
uint n_ochannels(OBusId busid) const
Number of channels of output bus busid configured for this AudioProcessor.
Definition processor.hh:509
virtual double param_value_from_text(uint32_t paramid, const String &text) const
Definition processor.cc:351
const AudioTransport & transport() const
Sample rate mixing frequency in Hz as unsigned, used for render().
Definition processor.hh:432
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.
Definition processor.cc:530
const float * ofloats(OBusId b, uint c) const
Access readonly float buffer of output bus b, channel c, see also oblock().
Definition processor.hh:553
bool has_event_input() const
Returns true if this AudioProcessor has an event input stream.
Definition processor.hh:459
bool is_initialized() const
Check if AudioProcessor has been properly intiialized (so the parameter set is fixed).
Definition processor.cc:407
void atomic_bits_resize(size_t count)
Prepare count bits for atomic notifications.
Definition processor.cc:380
void reschedule()
Request recreation of the audio engine rendering schedule.
Definition processor.cc:439
void prepare_event_output()
Definition processor.cc:467
AtomicBits::Iter atomic_bits_iter(size_t pos=0) const
Allow iterations over the atomic bits.
Definition processor.cc:399
MaybeParamId find_param(const String &identifier) const
Return the ParamId for parameter identifier or else 0.
Definition processor.cc:225
void connect_event_input(AudioProcessor &oproc)
Connect event input to event output of AudioProcessor oproc.
Definition processor.cc:494
uint text_param_to_quark(uint32_t paramid, const String &text)
Ase main-thread helper for temporary string<->uint conversions.
Definition processor.cc:359
double get_normalized(Id32 paramid)
Get param value normalized into 0…1.
Definition processor.cc:314
static void registry_foreach(const std::function< void(const String &aseid, StaticInfo)> &fun)
Iterate over the known AudioProcessor types.
Definition processor.cc:909
void disconnect_obuses()
Disconnect inputs of all Processors that are connected to outputs of this.
Definition processor.cc:673
bool atomic_bit_notify(size_t nth)
Set the nth atomic notification bit, return if enotify_enqueue_mt() is needed.
Definition processor.cc:389
ParameterC parameter(Id32 paramid) const
Retrieve supplemental information for parameters, usually to enhance the user interface.
Definition processor.cc:262
String text_param_from_quark(uint32_t paramid, uint vint)
Helper for temporary uint<->string conversions.
Definition processor.cc:372
double peek_param_mt(Id32 paramid) const
Definition processor.cc:272
AudioEngine & engine() const
Retrieve AudioEngine handle for this AudioProcessor.
Definition processor.hh:425
void disconnect(IBusId ibus)
Disconnect input ibusid.
Definition processor.cc:687
virtual void initialize(SpeakerArrangement busses)=0
Definition processor.cc:432
bool connected(OBusId obusid) const
Definition processor.cc:637
MinMax param_range(Id32 paramid) const
Retrieve the minimum / maximum values for a parameter.
Definition processor.cc:414
void enable_engine_output(bool onoff)
Configure if the main output of this module is mixed into the engine output.
Definition processor.cc:446
bool check_dirty(Id32 paramid) const
Definition processor.hh:536
void apply_event(const MidiEvent &event)
Assign MidiEvent::PARAM_VALUE event values to parameters.
Definition processor.hh:387
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.
Definition processor.cc:510
virtual ~AudioProcessor()
The destructor is called when the last std::shared_ptr<> reference drops.
Definition processor.cc:111
uint n_obuses() const
Number of output buses configured for this AudioProcessor.
Definition processor.hh:480
uint schedule_processor()
Schedule this node and its dependencies for engine rendering.
Definition processor.cc:781
static double param_peek_mt(const AudioProcessorP proc, Id32 paramid)
Definition processor.cc:283
bool has_event_output() const
Returns true if this AudioProcessor has an event output stream.
Definition processor.hh:466
double nyquist() const
Half the sample rate in Hz as double, used for render().
Definition processor.hh:445
void disconnect_ibuses()
Reset input bus buffer data.
Definition processor.cc:662
static void registry_add(CString aseid, StaticInfo, MakeProcessorP)
Definition processor.cc:879
uint n_ichannels(IBusId busid) const
Number of channels of input bus busid configured for this AudioProcessor.
Definition processor.hh:501
void disconnect_event_input()
Disconnect event input if a connection is present.
Definition processor.cc:477
void install_params(const AudioParams::Map &params)
Reset list of parameters, enqueues parameter value initializaiton events.
Definition processor.cc:213
float * oblock(OBusId b, uint c)
Definition processor.hh:561
static const String STANDARD
":G:S:r:w:" - GUI STORAGE READABLE WRITABLE
Definition processor.hh:188
OBusId find_obus(const String &name) const
Return the OBusId for output bus uilabel or else 0.
Definition processor.cc:561
void assign_oblock(OBusId b, uint c, float val)
Fill the output buffer of bus b, channel c with v.
Definition processor.cc:627
void connect(IBusId ibus, AudioProcessor &oproc, OBusId obus)
Connect input ibusid to output obusid of AudioProcessor prev.
Definition processor.cc:713
static const String STORAGEONLY
":S:r:w:" - STORAGE READABLE WRITABLE
Definition processor.hh:189
DeviceP get_device() const
Gain access to the Device handle of this AudioProcessor.
Definition processor.cc:130
Compact, deduplicating string variant for constant strings.
Definition memory.hh:138
A stream of writable MidiEvent structures.
Definition midievent.hh:96
An in-order MidiEvent reader for multiple MidiEvent sources.
Definition midievent.hh:117
Interface for management, connecting and processing of AudioProcessor instances.
Definition processor.hh:274
#define ASE_ASSERT_RETURN(expr,...)
Return from the current function if expr evaluates to false and issue an assertion warning.
Definition cxxaux.hh:82
T exchange(T... args)
std::pair< RandIter, bool > binary_lookup_insertion_pos(RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg)
Definition utils.hh:289
The Anklang C++ API namespace.
Definition api.hh:9
CString website_url
Website of/about this AudioProcessor.
Definition processor.hh:35
uint64_t uint64
A 64-bit unsigned integer, use PRI*64 in format strings.
Definition cxxaux.hh:25
IBusId
ID type for AudioProcessor input buses, buses are numbered with increasing index.
Definition processor.hh:21
SpeakerArrangement
Definition transport.hh:11
OBusId
ID type for AudioProcessor output buses, buses are numbered with increasing index.
Definition processor.hh:25
CString version
Version identifier.
Definition processor.hh:31
CString description
Elaborate description for help dialogs.
Definition processor.hh:34
ParamId
ID type for AudioProcessor parameters, the ID numbers are user assignable.
Definition processor.hh:17
CString creator_url
Internet contact of the creator.
Definition processor.hh:37
CString blurb
Short description for overviews.
Definition processor.hh:33
CString creator_name
Name of the creator.
Definition processor.hh:36
CString register_audio_processor(const char *aseid=nullptr)
Add an AudioProcessor derived type to the audio processor registry.
Definition processor.hh:582
uint16_t uint16
A 16-bit unsigned integer.
Definition cxxaux.hh:23
CString label
Preferred user interface name.
Definition processor.hh:30
std::string String
Convenience alias for std::string.
Definition cxxaux.hh:35
uint32_t uint32
A 32-bit unsigned integer.
Definition cxxaux.hh:24
uint32_t uint
Provide 'uint' as convenience type.
Definition cxxaux.hh:18
CString category
Category to allow grouping for processors of similar function.
Definition processor.hh:32
Detailed information and common properties of AudioProcessor subclasses.
Definition processor.hh:29
typedef uint32_t
Audio parameter handling, internal to AudioProcessor.
Definition processor.hh:54
double value(uint32_t id) const
Read current value of parameter identified by id.
Definition processor.hh:332
void install(const Map &params)
Clear and install a new set of parameters.
Definition processor.cc:65
void clear()
Clear all fields.
Definition processor.cc:45
ssize_t index(uint32_t id) const
Find index of parameter identified by id or return -1.
Definition processor.hh:318
bool dirty_index(uint32_t idx) const
Check if parameter is dirty (changed).
Definition processor.hh:355
Transport information for AudioSignal processing.
Definition transport.hh:113
Structure providing supplementary information about input/output buses.
Definition processor.hh:44
uint n_channels() const
Number of channels described by speakers.
Definition processor.hh:418
SpeakerArrangement speakers
Channel to speaker arrangement.
Definition processor.hh:49
CString label
Preferred user interface name.
Definition processor.hh:46
CString blurb
Short description for user interface tooltips.
Definition processor.hh:48
CString ident
Identifier used for serialization.
Definition processor.hh:45
CString hints
Hints for parameter handling.
Definition processor.hh:47
Helper class for integer IDs up to 32 Bit, possibly of enum type.
Definition cxxaux.hh:403
MidiEvent data structure.
Definition midievent.hh:50
MidiEventType type
MidiEvent type, one of the MidiEventType members.
Definition midievent.hh:55
typedef ssize_t