AU HostCallback - musical location
AU HostCallback - musical location
- Subject: AU HostCallback - musical location
- From: Bill Stewart <email@hidden>
- Date: Fri, 27 Sep 2002 14:48:38 -0700
There have been a number of comments about wanting a richer support for
musical location...
Currently, this is done through the following mechanism:
typedef OSStatus (*HostCallback_GetBeatAndTempo) (
void *inHostUserData,
Float64 *outCurrentBeat,
Float64 *outCurrentTempo);
Then, for eg, the host can set up an AudioUnit with the following call:
HostCallbackInfo info;
info.hostUserData = this;
info.beatAndTempoProc = DispatchGetBeatAndTempo;
//ignore result of this - don't care if the property isn't supported
AudioUnitSetProperty (mAudioUnit,
kAudioUnitProperty_HostCallbacks,
kAudioUnitScope_Global,
0,
&info,
sizeof (HostCallbackInfo));
To add the additional support that has been discussed we're proposing the
following:
typedef struct HostCallbackInfo {
void * hostUserData;
HostCallback_GetBeatAndTempo beatAndTempoProc;
HostCallback_GetMusicalTimeLocation musicalTimeLocationProc;
} HostCallbackInfo;
An AudioUnit can determine if its being called for just the first proc
through checking the size of the passed in data proc. If the host cannot
support the features of the second callback it can set up the callback
struct:
HostCallbackInfo info;
info.hostUserData = this;
info.beatAndTempoProc = DispatchGetBeatAndTempo;
Info.musicalTimeLocationProc = NULL;
The new callback will look like this:
// Any of these parameters when called by the AudioUnit can be NULL
// (except for the HostUserData which must be supplied by the AU as given to
it when the property was set)
//
// outDeltaSampleOffsetToNextBeat - will contain the number of samples until
the next beat
// from the start sample of the current rendering buffer
// outTimeSig_NumBeats - the number of beats of value "beat type" that is
contained in the current measure
// outTimeSig_BeatType - music notational conventions (4 is a quarter note,
8 an eigth note, etc)
// outCurrentMeasureDownBeat - the beat that corresponds to the downbeat
(first beat) of the current measure
typedef OSStatus (*HostCallback_GetMusicalTimeLocation) (
void *inHostUserData,
UInt32 *outDeltaSampleOffsetToNextBeat,
Float32 *outTimeSig_NumBeats,
UInt32 *outTimeSig_BeatType,
Float64 *outCurrentMeasureDownBeat);
The AU may have enough information with the first callback... The second one
can also be used (if available) to get more precise information.
Comments greatly appreciated - this is still not final and we may tweak this
- particularly in light of feedback, etc...
(We can make this available simply as an addition to the header file - for
host apps - and a rev of the SDK's AUBase class)
Bill
--
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
__________________________________________________________________________
------ End of Forwarded Message
_______________________________________________
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.