tags:

views:

18

answers:

0

I have two audio queues that I want to synchronize to start playing at the same time. I would like to use

  OSStatus playbackCallback(void *inRefCon, 
                      AudioUnitRenderActionFlags *ioActionFlags, 
                      const AudioTimeStamp *inTimeStamp, 
                      UInt32 inBusNumber, 
                      UInt32 inNumberFrames, 
                      AudioBufferList *ioData) 

and set identical start times (in the AudioTimeStamps) but I'm at a loss as how to do this.

There are five choices as far as fields that I could set in the AudioTimeStamp, and mSampleTime and mSMPTETime don't seem relevant. I don't really understand what mRateScalar is but it doesn't seem relevant to this either, and I can't find anything on what exactly mWordClockTime is. That leaves me with mHostTime. What I'd like to do is get the current host time add a little "time" to that value, then use FillOutAudioTimeStampWithHostTime to set the time in two AudioTimeStamp structs and use AudioQueueEnqueBufferWithParameters to set the start times for both audio queues.

Here are the structs and function calls related to the above paragraphs:

 struct AudioTimeStamp { Float64 mSampleTime; UInt64 mHostTime; 
    // This is the only         field that I can see how to use for my purpose
   Float64 mRateScalar; // ??? UInt64    
  mWordClockTime; // ??? SMPTETime mSMPTETime; 
 UInt32 mFlags; 
  UInt32 mReserved; };

Example: i start play audio first time 100%original= i start play audio second time

Also

          SInt64 noi;
           noi= SInt64(inTimeStamp->mHostTime);
          printf("\n%f", noi);

0.000000

But i wait like 0.99995