AudioProcessorGraph change inside buffer?

Hi !

Generally, in music, things happen in musical time, not sample time. Let’s say I have this delay plugin inside my AudioProcessorGraph. I decide that the delay has to kick-in after one bar, so I start the playback and, 1 bar after I add this delay to the AudioProcessorGraph.

The problem is it’s impossible to do that, because we have to do this inside the audio callback (which is the only reliable and accurate source of time) which works with samples.
If this “1 bar” time means, 1 sample buffer and a half, I would have to add the node DURING the process block of the audio processor graph.

How do you guys generally handle this problem ?

I’ve not made any use of the AudioProcessorGraph, so this idea may be unusable. :slight_smile:

You could keep the node in the graph, but in a ‘pass-thru’ state when it is not needed. It could hold a queue of events (e.g. toggle active state at sample time t). When processing that node, if an event lies in the current block, simply process the samples up to that point, then process the event (i.e. toggle whether or not it should affect the input) and remove it from the queue; then just carry on with the rest of the block. Having a queue would also allow it to cope with multiple changes in a single block (should that case ever arise).

[quote=“haydxn”]I’ve not made any use of the AudioProcessorGraph, so this idea may be unusable. :slight_smile:

You could keep the node in the graph, but in a ‘pass-thru’ state when it is not needed. It could hold a queue of events (e.g. toggle active state at sample time t). When processing that node, if an event lies in the current block, simply process the samples up to that point, then process the event (i.e. toggle whether or not it should affect the input) and remove it from the queue; then just carry on with the rest of the block. Having a queue would also allow it to cope with multiple changes in a single block (should that case ever arise).[/quote]

Yeah that’s the idea however, there’s no way to put a node in a pass-thru state, AFAIK.
Maybe I should code my own version of AudioPluginInstance, which would allow this ?

Haydxn, I think you are into audio development as well, so am I too curious if I ask how did you do it, without using AudioProcessorGraph ? :slight_smile:

No other insight on this issue ? :slight_smile:

The only way you can perform sample-aligned playback would be to create some kind of node that knows when it should start and finish, and leave it running in the graph, letting it play its content at the correct time.

Thanks !