Re: Setting the HostCallback Property
Re: Setting the HostCallback Property
- Subject: Re: Setting the HostCallback Property
- From: Jeremy Sagan <email@hidden>
- Date: Tue, 11 May 2004 21:41:31 -0400
Bill told me to throw eggs if I want but with all of the help he has
given me that is the last thing I want to do.
Here is, however, the correct way to Set the HostCallback Property
(Commence the egg throwing)...
Of course NewPtr can be exchanged for malloc or some other allocator as
long as the allocated memory is cleared to zeros after the
allocation....
On May 11, 2004, at 9:29 PM, William Stewart wrote:
if (AudioUnitGetPropertyInfo(au, kAudioUnitProperty_HostCallbacks,
kAudioUnitScope_Global,
nil, &outDataSize, &outWritable) == noErr)
{
TempHostCallbackInfo *hostcbInfo =
(TempHostCallbackInfo*)NewPtrClear(outDataSize);
if (hostcbInfo)
{
if (outWritable)
{
hostcbInfo->beatAndTempoProc = mybeatAndTempoProc;
hostcbInfo->hostUserData = this; //OPTIONAL
if (outDataSize > offsetof(TempHostCallbackInfo,
musicalTimeLocationProc))
{
hostcbInfo->musicalTimeLocationProc = mymusicalTimeLocationProc;
}
//Metro 6.2 adds this
if (outDataSize > offsetof(TempHostCallbackInfo,
transportStateProc))
{
hostcbInfo->transportStateProc = myTransportStateProc;
}
AudioUnitSetProperty(au, kAudioUnitProperty_HostCallbacks,
kAudioUnitScope_Global,
0, hostcbInfo, outDataSize);
}
DisposePtr((Ptr)hostcbInfo);
}
}
Jeremy
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.