hosting Audio Units
hosting Audio Units
- Subject: hosting Audio Units
- From: Luigi Castelli <email@hidden>
- Date: Mon, 4 Jun 2007 19:06:13 -0700 (PDT)
Hi there,
I am on writing a small application in C to be able to host Audio Unit
effects and instruments.
Specifically, I am now dealing with the CarbonView/UI part and I am
using the AUEditWindow.cpp file, part of AudioUnitHosting
(Developer/Examples/CoreAudio/Services) as a template. Indeed, I read
all the threads I could find on the subject and sometimes got partial
answers to my questions, but there are still many things I don't quite
understand.
Let's start:
1 - I am analyzing this piece of code:
void AUEditWindow::SetUnitToDisplay (AudioUnit editUnit,
ComponentDescription& inDesc)
{
CloseView();
mEditUnit = editUnit;
Component editComp = FindNextComponent(NULL, &inDesc);
verify_noerr(OpenAComponent(editComp, &mEditView));
ControlRef rootControl;
verify_noerr(GetRootControl(mWindow, &rootControl));
Rect r;
GetControlBounds(rootControl, &r);
Float32Point location = { kOffsetForAUView_X, kOffsetForAUView_Y };
Float32Point size = { Float32(r.right), Float32(r.bottom) };
verify_noerr(AudioUnitCarbonViewCreate(mEditView, mEditUnit, mWindow,
rootControl, &location, &size, &mAUViewPane));
mViewPaneResizer = new ResizeControlHandler(this);
EventTypeSpec resizeEvent[] = {
{ kEventClassControl, kEventControlBoundsChanged },
};
mViewPaneResizer->WantEventTypes (GetControlEventTarget(mAUViewPane),
GetEventTypeCount(resizeEvent), resizeEvent);
AudioUnitCarbonViewSetEventListener(mEditView, EventListener, this);
ResizeUI();
}
once I get the root control I am supposed to get its bounds with
GetControlBounds(). Why ? I see this as an unnecessary step since I am
gonna resize the window later anyway with ResizeUI(). Also the bounds
of the window given by GetControlBounds(rootControl, &r) are - in my
experiments - 32768 and 32768 both for right and bottom, which I don't
find very useful. The mAUViewPanel field is where I find the real,
useful bounds of the view. So why not just write:
ControlRef rootControl;
verify_noerr(GetRootControl(mWindow, &rootControl));
const Float32Point location = { kOffsetForAUView_X, kOffsetForAUView_Y
};
const Float32Point size = { 0, 0 };
verify_noerr(AudioUnitCarbonViewCreate(mEditView, mEditUnit, mWindow,
rootControl, &location, &size, &mAUViewPane));
2 - After calling AudioUnitCarbonViewCreate I read (Technical Q&A
QA1343) I am supposed to install an event listener for
kEventControlBoundsChanged type of events. It seems that
AudioUnitCarbonViewSetEventListener is deprecated so I am trying to use
AUEventListenerCreate with no success.
First of all, is my choice appropriate ?
Can someone post an example on how to install such an event listener
for kEventControlBoundsChanged types ?
In my PropertyEventListenerProc callback how do I listen for the
specified event ?
An example is appreciated.
Do I need to dispose of the event listener created with
AUEventListenerCreate ?
I couldn't find any function to do that.
3 - the small application AULab handles the Audio Unit UI stuff well.
it would be a great tool to learn how to do certain tasks related to
Audio Units.
Is it possible to have access to its source code ?
Thanks for any advice.
Best.
- Luigi
------------------------------------------------------------
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT email@hidden AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
------------------------------------------------------------
____________________________________________________________________________________
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
_______________________________________________
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