Midi and Audio timebases in an AUGraph
Midi and Audio timebases in an AUGraph
- Subject: Midi and Audio timebases in an AUGraph
- From: Aran Mulholland <email@hidden>
- Date: Wed, 20 Feb 2013 13:20:22 +1100
I am working with the AUSampler and the MusicSequence, MusicPlayer and MusicTrack. I would like to schedule midi events in a pre render callback (AudioUnitAddRenderNotify) Is there a way to determine what midi time span a render callback will cover? In the render notify I can find out the current position of the MusicPlayer as follows:
MusicTimeStamp musicTimeStamp = 0;
MusicPlayerGetTime(musicPlayer_, &musicTimeStamp);
I also have the audioTimeStamp so I can determine the mSampleTime and mHostTime as well as the number of samples in the buffer. What I don't know is what MusicTimeStamp range the render callback will cover. This will be further compounded by the fact that the tempo can change. When a MusicSequence is associated with an AUGraph what is the relationship between the two time bases (audio and midi)?
Supplemental question:
Thinking it through can the tempo even change during the render callback? How would the following situation be dealt with:
Render callback fires and requests 1024 frames
AUSampler (which is driven by a midi track returns the frames)
Tempo change happens (goes extremely fast)
Midi note that now should have been scheduled to play in the 1024 frames gets played when?
_______________________________________________
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