如何托管Apple的Pitch Shift音频单元插件等 [英] How to Host Apple's Pitch Shift Audio Unit plugin and the like

查看:163
本文介绍了如何托管Apple的Pitch Shift音频单元插件等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在自己的窗口中正确托管PitchShift音频单元插件?

How do you host the PitchShift Audio Unit plugin correctly in its own window?

我正在开发一个Mac应用程序,该应用程序托管Apple的系统提供的Audio Unit插件.使用新的OSX 10.7 Lion,某些插件具有更新的视图. PitchShift是其中之一.

I am developing a Mac app that hosts Apple's system supplied Audio Unit plugins. With the new OSX 10.7 Lion, some of the plugins have updated views. PitchShift is one of these.

PitchShift和其他一些具有新的旋钮可以更改那里的参数.用鼠标转动旋钮时,旋钮下方会显示一条水平线,显示该旋钮的参数值.

PitchShift and a few others have new knobs to change there parameters. When a knob is being turned with the mouse, a horizontal bar showing the knob's parameter value is displayed below the knob.

在松开旋钮后,甚至在关闭窗口后,该栏也会停留在屏幕上.如果单击其中一个旋钮,从而创建一个恶意值栏,然后移动PitchShift视图所在的窗口,则该栏将停留在该窗口所在的位置.如果此时再次单击该旋钮,则会出现一个新的条,但是两个条都将使用更改的旋钮参数值信息进行主动更新.每当我重复此过程并在屏幕上停留更多条形时,就会发生这种情况.

This bar stays on screen after the knob is released and even after the window is closed. If I click one of the knobs, thus creating a rogue value bar, and move the window the PitchShift view is in, the bar stays where the window used to be. And if I click the knob again at this point, a new bar appears, but both bars are actively updated with the changing knob parameter value information. This happens every time I repeat this process with more bars staying on screen.

发生几次这种情况后,我的应用程序退出,并且对main.m文件中的NSApplicaionMain()调用的访问权限错误.

After a few times with this happening, my app exits with bad access at NSApplicaionMain() call in the main.m file.

我签入了Logic 9,但这并没有发生.该横条似乎直接绑在旋钮上,因此在您将旋钮放到鼠标上后立即消失.

I checked in Logic 9, and this does not happen there. The bar seems to be tied directly to the knob, and thus disappears immediately after you let the knob go with the mouse.

我将PitchSHift视图设置为专用NSWindow的contentView.

I set the PitchSHift view to be the contentView of a dedicated NSWindow.

逻辑如何阻止这种情况的发生,或者我该怎么办?

How is Logic keeping this from happening, or just how can I?

我尝试查看参数值是否位于PitchShift视图的子视图的位置,但似乎不在.

I've tried seeing if the parameter value bars where subviews of the PitchShift view, but they don't seem to be.

任何帮助将不胜感激.

当第一次出现值栏时,我从程序的控制台中获得以下输出:圆和线不相交

When the a value bar first appears, I get the following output in the console from my program: Circle and line do not intersect

因此,我发现它正在使用核心动画CALayers.现在的问题是,值栏图层不属于PitchShiftView图层层次结构的一部分.换句话说,我可以找到构成pitchShiftView的所有其他层,但是找不到值栏的层.似乎这可能是整个问题的开始.

So I've found that it is using core-animations CALayers. The problem now is that the value bar layers aren't a part of the PitchShiftView's layer hierarchy. In other words, I can find all the other layers that build up the pitchShiftView, but not the layers for the value bars. Which seems like it might be the whole problem to begin with.

推荐答案

我终于知道了.参数值栏是拥有音频单元视图的窗口的子窗口.

I finally figured it out. The parameter value bars are child windows of the window that owns the audio unit view.

为解决该问题,我在NSApplication的子类中捕获了该窗口的鼠标向上事件,然后关闭了子窗口(也称为值栏),以使它们不会停留在屏幕上.

To solve the problem, I catch the mouse up events for the window in my subclass of NSApplication, and I then close the child window (aka the value bar) so that they don't stay on screen.

这并没有阻止出口错误访问.我现在认为这是一个单独的问题,似乎只与这些挥之不去的子窗口有关.

This did not stop the exit bad access. I now think that is a separate issue that only appeared to be related to these lingering child windows.

这篇关于如何托管Apple的Pitch Shift音频单元插件等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆