音频单元如何检测其主机的启动和停止?
音频单元组件如何检测音频单元主机的启动和停止?
在组件的 Kernel Process() 中,我尝试使用 CallHostTransportState(...) 方法,该方法返回主机是否正在播放,因此我可以检测到第一次启动;但是当主机停止时,不再调用 Process() ,因此我无法通过这种方式检测停止。由于未检测到停止,因此我无法检测下一次启动,因为尚未检测到“停止”状态。
有什么想法吗?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,似乎没有一个特定的属性可供您监听有关主机传输状态更改的信息,这意味着您需要自己监视它们。在我的脑海中,最简单的方法是创建一个新的运行循环(即使用 CFRunLoop 或 NSRunLoop ,具体取决于您是否在 C++/ Obj-C 层)并向其传递一个对空闲函数的引用,该函数反过来会将主机传输的状态传递给您的插件。
在 VST 世界中,此任务通常通过重写idle()来完成,但由于 AudioUnit 是面向拉的而不是面向推的,因此有时需要拉信息并将其推送到手工制作你的插件。
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
orNSRunLoop
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.