AudioStream source inhibit mechanism?

MarkT

Well-known member
Just a quick thought about Audio library. In several situations an AudioStream may be ignoring one or more of
its sources - for instance a mixer with a channel gain set to zero, or a fader currently at zero, or an envelope
that has isActive() returning false.

It might make sense at the point this happens to check if the source in question only has the one destination and
if so call a method like enable(false)... When that source becomes wanted again it calls enable(true) on it.

A notable scenario is synthesis. You setup a note by calling begin() on the waveform generator, and noteOn() on
the envelope. You call noteOff() on the envelope (but at that point cannot disable the waveform). When the
envelope finishes its release phase it could notify the waveform generator to turn off and save CPU cycles. Currently
this can be done by polling the envelopes explicitly using isActive(), but that's a little clunky.

The enable() method could also be useful to implement switching components in and out of the processing
graph simply and with useful efficiency - various effects and mixer/fader would propagate their enable status to
their sources.
 
Back
Top