Event fired on playback start

Hey guys,

I’m just trying to implement my first plugin.
I was wondering if there is an option to get some kind of signal or event that gets triggered when the playback is started??

I just know that there is a flag that I can check in the AudioPlayHead class.
But busy waiting is of course not an option …

Any ideas are welcome!

Thanks,

guitarlow

No, sorry - hosts don’t send out anything like that, you have to check the flag yourself.

Ok …

what I need to know is when the host starts to play, or, if that’s not possible, when the host stops playback.
The only function I could do that in is the “processBlock()” function, as the “releaseResources()” function does not get called when playback stops.
( Although the comments say that )

But I will never get a AudioPlayHead::CurrentPositionInfo::isPlaying.false() because the “processBlock()” function just gets called when the playback is running.
Is there any option to retrieve that information from the host?

I am counting up a variable in the processBlock function and this would need to be reset to 0 on every playback start.

Thanks in advance,

guitarflow

Most hosts will keep the plugins running even when the transport is stopped, that’s why the flag is there.

I tried it with GarageBand and Logic …

Both don’t process blocks when playback is not running.
Logic seems to go into “Stop” for a short period when playback is running and you click somewhere in the timeline to locate.
GarageBand does just the same.

I have one variable storing the “timeInSeconds” from the CurrentPositionInfo structure every time the processBlock() function is executed.
In every execution cycle I check whether the new position is not greater than the previous one + 0.5 seconds ( that’s what I found out as a well-doing value).

The only problem I’m keeping to get is that GarageBand does not give me the CurrentPositionInfo with continuous values.
In random intervals the “timeInSeconds” within the structure has values that are definitely wrong…

The value jumps from 80 seconds to 16 seconds for example just for one processing block…
I don’t have any idea what I could do about it …

Maybe one of you guys has a better idea??

best,

guitarflow