• 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: AudioDeviceGetCurrentTime after headphone plug/unplug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioDeviceGetCurrentTime after headphone plug/unplug


  • Subject: Re: AudioDeviceGetCurrentTime after headphone plug/unplug
  • From: Brant Sears <email@hidden>
  • Date: Thu, 18 Jan 2007 16:08:16 -0500

Hi. I've been following this thread, but I probably don't have the expertise in Core Audio to fully understand Jeff's statements.

I'm using PortAudio for a cross platform application and we ran into the "headphones" problem. We are relying on a PortAudio call that uses AudioDeviceGetCurrentTime(). There was some mention of using AudioDeviceTranslateTime() to work around this. I tried the following:

AudioTimeStamp timeStamp2;
AudioTimeStamp timeStamp;

memset(&timeStamp, 0, sizeof(AudioTimeStamp));
memset(&timeStamp2, 0, sizeof(AudioTimeStamp));
timeStamp.mFlags= kAudioTimeStampHostTimeValid;
timeStamp.mHostTime = AudioGetCurrentHostTime();
timeStamp2.mFlags = kAudioTimeStampSampleHostTimeValid;
AudioDeviceTranslateTime(stream->outputDevice, &timeStamp, &timeStamp2);

Then, I try to read the mSampleTime from timeStamp2. This is still not working for me. What am I doing wrong?

I wish there was a really detailed (and simple to understand) book on CoreAudio. The documentation is confusing to me (but of course I'm no expert on audio in general).

Brant Sears

On Jan 18, 2007, at 2:58 PM, Jeff Moore wrote:

The API is in the form of the time stamps that AUHAL passes out in it's various callbacks, which is where it applies the math in AUTimestampGenerator. To my knowledge, AUHAL does not have a wrapper for AudioDeviceGetCurrentTime().

On Jan 18, 2007, at 7:57 AM, Bjorn Roche wrote:


On Jan 17, 2007, at 3:01 PM, Jeff Moore wrote:

The amount of churn that gets caused by plugging in headphones to a device really depends on the device. For some devices, it is totally transparent. For others, it requires a massive reconfiguration of the hardware. From the sound of it, you are probably talking about the built-in hardware on some of our machines. That hardware does indeed cause a lot of churn, including stopping and restarting IO which causes the timeline to change.

Probably the easiest way to address this is to use the HAL output unit, AUHAL, that can be configured so that it's time stamps are continuous even when the HAL's time stamps are discontinuous. Short of that, you'll need to implement the math that does the same thing. Fortunately, the code that AUHAL uses to do this is in our SDK in the form of the AUTimestampGenerator class.


Thanks for the reply. I am already using AUHAL, and from what you say there is already an existing API for this, but I don't see anything in the docs. What is the appropriate function name I should google for?


_______________________________________________ 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: AudioDeviceGetCurrentTime after headphone plug/unplug
      • From: Bjorn Roche <email@hidden>
References: 
 >AudioDeviceGetCurrentTime after headphone plug/unplug (From: Bjorn Roche <email@hidden>)
 >Re: AudioDeviceGetCurrentTime after headphone plug/unplug (From: Jeff Moore <email@hidden>)
 >Re: AudioDeviceGetCurrentTime after headphone plug/unplug (From: Bjorn Roche <email@hidden>)
 >Re: AudioDeviceGetCurrentTime after headphone plug/unplug (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: AudioDeviceGetCurrentTime after headphone plug/unplug
  • Next by Date: Re: AudioDeviceGetCurrentTime after headphone plug/unplug
  • Previous by thread: Re: AudioDeviceGetCurrentTime after headphone plug/unplug
  • Next by thread: Re: AudioDeviceGetCurrentTime after headphone plug/unplug
  • Index(es):
    • Date
    • Thread