• 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: output timestamp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: output timestamp


  • Subject: Re: output timestamp
  • From: William Stewart <email@hidden>
  • Date: Fri, 26 May 2006 10:39:40 -0700


On 25/05/2006, at 6:35 PM, Craig Hopson wrote:

On May 25, 2006, at 6:36 PM, William Stewart wrote:


On 25/05/2006, at 4:20 PM, Craig Hopson wrote:

I'm pretty sure this has been asked before, I just can't find it. Sorry for any redundancy...

I have a music sequence. The associated graph uses the default output unit. Sometimes when I start the MS I want the initial time stamp to be greater than 0. That is, I want to be able to start playing at some arbitrary point in the sequence.

I have tried calling MusicPlayerSetTime. However, when I inspect the timestamps in a Render call, they begin @ 0. (How) can I start the graph and get timestamps greater than zero?

You can't. The SetTime will shift the beats time that the sequence thinks of as "now" - and then it offsets that to render at that new time.
Ah, that explains what I'm seeing with the timestamps.

The question is really, why - it doesn't change the sequence/ player behaviour, but it sound like you want to do something, but you can't?
Yes. I want to play an arbitrary range of events without changing their position in the overall sequence. My events are custom and I feed them to threaded processors based on their timestamps. The graph is delayed somewhat (custom renderers) to allow processing time. The output of the processors is stored in ring buffers which obey the AU timestamps and fill the render buffers - processing on the backside of the buffers, Render pulls on the front side. For what it's worth, my UI is basically a view of the events in the sequence.

When I play the entire sequence, the MS callback for userEvents calls for each of my events. I dispatch to the appropriate processor. The event is processed and stored in the buffer. My delay units are busy returning 0s until the delay time has passed. The delay is small - just enough to keep processing ahead of rendering.

Now, say the first event I want to play is 2 sec into the sequence, here's what happens:

Firstly - you should think about the sequence given the services it provides at the moment. The sequence thinks of time as beats, not seconds. How those beat values are translated into action are based on the tempo events contained within a tempo track (ie. events that describe the beats per minute).


You can simulate a seconds based timeline by setting the tempo of a sequence to 60 bpm. But, this is often not what you want as typically the music events have their own tempo requirements. The sequence and player also provide API services for converting between the sequence's notions of beats and playing time (seconds).


I get the event and go through the above process. Of course, since the event's timestamp is @ 2 sec, I will get 2 secs of silence until the 2 sec timestamp shows up. (Buffers return 0s if the Render timestamp is not one that they can fulfill, or if they don't have any data available, ie., no events have been processed.)

Of course there is more than one way to accomplish this, but I had thought it would be easiest if I could tell the output unit to start its timestamps at the 2 sec point (for example). By starting the output later in time, I would not have to fill the AU buffers with 0 until I hit correct timestamp. Any suggestions?

You can't use just time stamps in an AudioUnit as a way to know where you are in a host's time line - they simply don't provide enough information.


So, we provide host callbacks that an AU and a host can implement, that allow an AU to find out exact information about the host's time lines - current tempo, beat, time sig, samples since started, etc.. The MusicSequence supports providing this information to an AU, and the AU documentation (/Developer/Examples/CoreAudio/Documentation/) provide information about these AU services. The callbacks are also supported in AUBase.

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
________________________________________________________________________ __


_______________________________________________
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: 
 >output timestamp (From: Craig Hopson <email@hidden>)
 >Re: output timestamp (From: William Stewart <email@hidden>)
 >Re: output timestamp (From: Craig Hopson <email@hidden>)

  • Prev by Date: Re: Getting started with AU developmentl
  • Next by Date: Re: Beginner: How to set the sampling rate of a USB audio input device
  • Previous by thread: Re: output timestamp
  • Next by thread: Beginner: How to set the sampling rate of a USB audio input device
  • Index(es):
    • Date
    • Thread