• 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
iPhone RemoteIO timeline strange behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iPhone RemoteIO timeline strange behavior


  • Subject: iPhone RemoteIO timeline strange behavior
  • From: Zachary Kulis <email@hidden>
  • Date: Thu, 19 Nov 2009 12:09:40 -0500

Hi,

I am trying to synchronize input (recorded) and output audio samples
using the RemoteIO timeline. Unfortunately, I am getting inconsistent
timestamp information between the mSampleTime field and the mHostTime
fields in the AudioTimeStamp struct.

My first question is: does the mSampleTime provided in the input and
output callbacks refer to the same audio timeline? Below, I outline the
code I am using to produce the issue...

Since the RemoteIO input callback is always invoked before the output
callback, I simply set sampleTime0 equal to the first input timestamp
(mSampleTime). I do the same thing for hostTime0 using the first host
timestamp. For each subsequent callback, I compute elapsed times using
these initial timestamps. This code is shown below (assuming 16kHz
sampling):

sampleTimeElapsed = (sampleTimeCurrent - sampleTime0)*16000
hostTimeElapsed = AudioUtils::elapsedTime(hostTimeCurrent - hostTime0),
where elapsedTime() is defined below (I know that this function works
correctly).

Float64 AudioUtils::elapsedTime(UInt64 elapsed) {
    mach_timebase_info_data_t info;
    mach_timebase_info(&info);

    elapsed *= info.numer;
    elapsed /= info.denom;

    return (elapsed*1e-9);
}

The problem is that the results are inconsistent. On the iPhone (2.2.1),
the elapsed host and sample times for the input are roughly equal, but
drift apart as time proceeds (to be expected). However, on the
simulator, the elapsed input timestamps (sample vs host) do not agree at
all. Also, for both platforms, the elapsed output timestamps (sample vs
host) do not agree.

I am only trying to measure the delay between the input and output. I am
currently quite confused as to the cause of these inconsistencies. Any
insight would be greatly appreciated.

Zach
 _______________________________________________
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

  • Follow-Ups:
    • Re: iPhone RemoteIO timeline strange behavior
      • From: Jeff Moore <email@hidden>
  • Prev by Date: iPhone RemoteIO partial input render
  • Next by Date: Re: iPhone RemoteIO timeline strange behavior
  • Previous by thread: Re: iPhone RemoteIO partial input render
  • Next by thread: Re: iPhone RemoteIO timeline strange behavior
  • Index(es):
    • Date
    • Thread