views:

25

answers:

1

Hi,

How can an Audio Unit component detect start and stop of an Audio Unit host?

Within the component's Kernel Process(), I tried with the CallHostTransportState(...) method, which returns whether the host is playing or not, therefore I can detect a first start; but the Process() is not called anymore when the host stops, so I can't detect the stop this way. And since the stop is not detected, I can't detect the next start because the state "stopped" has not been detected.

Any idea?

Thanks.

+1  A: 

Well, it doesn't seem that there is a particular property that you can listen to regarding host transport state changes, which means that you would need to monitor them yourself. Off the top of my head, the easiest way to do this would be to create a new runloop (ie by using CFRunLoop or NSRunLoop depending on whether you are in the C++/Obj-C layer) and pass it a reference to an idle function, which in turn would pass the state of the host's transport to your plugin.

This is a task which would normally be accomplished by overriding idle() in the VST world, but since AudioUnits are pull-oriented instead of push-oriented, you need to sometimes pull the information and push it to your plugin by hand.

Nik Reiman