Re: Wrapper class for Cocoa Audio Units in Carbon Hosts
Re: Wrapper class for Cocoa Audio Units in Carbon Hosts
- Subject: Re: Wrapper class for Cocoa Audio Units in Carbon Hosts
- From: Seth Nickell <email@hidden>
- Date: Sat, 8 Aug 2009 10:02:55 -0700
Hi Tahome,
I appreciate you finding all these issues! I may not be able to
address them in the next couple days, but I intend to roll them
together and create a more finished system. I completely forgot I'd
added AUCarbonViewBase to my project, as well as the
GetUIComponentDescs calls.
This class is extracted from one of my projects (I didn't write it in
a very modular way originally ;-), and I'm not basing off it yet, so I
must admit there are probably bugs I've introduced. I'll battle test
the class a bit more in the next couple days and see if I can fix some
issues.
With my AU (similar but not idential to the wrapper class), I'm not
seeing the CPU starvation issues in AU Lab, Logic or Ableton. I'll try
using the class with the CocoaUI template in XCode, and try to
reproduce.
Toward a better Solution:
Stephan from Prosoniq told me how they've handled this issue: they
create a carbon window with a "open cocoa window" button which brings
up a new cocoa window. This is certainly the most compatible solution,
but also not the ideal user experience... but it inspires me to think
about a similar trick: use a Carbon window as a virtual frame for a
border-less Cocoa window. Size the Carbon window to "swallow" the
borderless cocoa window, and place the cocoa window directly above it.
Whenever the carbon is moved/resized, move/resize the cocoa. Create
the illusion that its all just one window.
I've used this trick on Linux with GNOME applications before (to
swallow non-GNOME apps), with good success... but X-Windows has
"window" as a low-level primitive, shared by all toolkits, so it might
be less feasible on OS/X. I haven't looked to see how feasible this is
with Carbon+Cocoa, but it might present a high-compatibility, low
maintenance, ideal experience approach. Will investigate.
-Seth
On Fri, Aug 7, 2009 at 3:27 AM, tahome izwah<email@hidden> wrote:
> Hi Seth, I have a couple of additional things concerning the wrapper:
>
> Corrections:
> ----------------
> Convolution_COMP_SUBTYPE and Convolution_COMP_MANF in your
> AUCarbonViewCocoaWrapper.h should be MyAU_COMP_SUBTYPE and
> MyAU_COMP_MANF respectively.
>
> Additions:
> ----------------
> In order for the wrapper to work, you have to make the following
> additional changes to your Cocoa AU project:
>
> 1. You need to add the following code to your MyAU class in MyAU.h:
>
> #include "AUCarbonViewBase.h"
>
> ...
>
> int GetNumCustomUIComponents () { return 1; }
>
> void GetUIComponentDescs (ComponentDescription* inDescArray)
> {
> inDescArray[0].componentType =
> kAudioUnitCarbonViewComponentType;
> inDescArray[0].componentSubType = MyAU_COMP_SUBTYPE;
> inDescArray[0].componentManufacturer = MyAU_COMP_MANF;
> inDescArray[0].componentFlags = 0;
> inDescArray[0].componentFlagsMask = 0;
> }
>
> 2. You need to add the AUCarbonViewBase folder to your project (can be
> found in /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase)
>
> 3. You need to add CAStreamBasicDescription.cpp|h,
> CAAudioChannelLayout.cpp|h, CAVectorUnit.cpp|h, CAAUParameter.cpp|h,
> CADebugMacros.h, AUViewLocalizedStringKeys.h to your project if not
> already there, and en/disable source files in your project as needed.
>
> Problems:
> ----------------
> The Cocoa-in-Carbon view doesn't behave properly wrt. editing. When I
> switch to the Carbon view in AULab the window immediately deactivates
> and the changes (moving the slider etc.) take a few seconds to be
> reflected in the UI (but only if the text field has the keyboard
> focus, otherwise the view is completely disabled). FYI I am using the
> default Cocoa AU project which has one slider and a text field.
>
> The crash in AULab on exit remains (this happens when the Carbon UI is
> open during quit) and AudioHijack Pro immediately crashes when opening
> the plug in's editor.
>
> HTH
> --th
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden