• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Midi and Audio timebases in an AUGraph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Midi and Audio timebases in an AUGraph


  • Subject: Re: Midi and Audio timebases in an AUGraph
  • From: Aran Mulholland <email@hidden>
  • Date: Thu, 28 Feb 2013 21:07:08 +1100

In order to get the time that is covered by a render callback do the following

    MusicTimeStamp startMusicTimeStamp = 0;

    MusicTimeStamp lengthMusicTimeStamp = 0;

    MusicPlayerGetTime(musicPlayer_, &startMusicTimeStamp);

    Float64 renderCallbackCoversSeconds = (Float64)inNumberFrames / 44100.f;

    MusicSequenceGetBeatsForSeconds (musicSequence_, renderCallbackCoversSeconds, &lengthMusicTimeStamp);



On Wed, Feb 20, 2013 at 1:20 PM, Aran Mulholland <email@hidden> wrote:
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

References: 
 >Midi and Audio timebases in an AUGraph (From: Aran Mulholland <email@hidden>)

  • Prev by Date: MusicEventIterator questions
  • Next by Date: Re: Where should CAStreamBasicDescription be instantiated?
  • Previous by thread: Midi and Audio timebases in an AUGraph
  • Next by thread: Playback Filtering
  • Index(es):
    • Date
    • Thread