• 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: AudioDeviceRead and timestamps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioDeviceRead and timestamps


  • Subject: Re: AudioDeviceRead and timestamps
  • From: Andrew Kimpton <email@hidden>
  • Date: Tue, 24 Jun 2003 22:18:37 -0700

Jeff Moore wrote:

The PlayEffect sample code uses AudioDeviceRead. You can consult that code for a usage example.

I think that the root of your problem is that you aren't leaving enough slop when calculating the input time. The reason why is that the current time is already too late so you need to back off a bit (determined by experimentation) before subtracting the safety offset and the buffer size.

in response to my question :


On Thursday, June 19, 2003, at 5:04 PM, Andrew Kimpton wrote:

I'm using AudioDeviceRead() during an output callback to also read the audio from the input device (this is USB Audio - so the input and output devices are different).

I've setup my BufferList and everything just fine - I get audio into my buffers without any problems. However there appears to be a +/- 1 sample 'wobble' in the acquired data.


Thanks to a quick chat with Jeff this afternoon at WWDC I appear to have fixed my problem (I've not exhaustively tested it yet however, but for 30 - 90 seconds it sounds fine).

The fix basically was to remember that the two different devices (input & output) are (or can be) running from different clocks, so you can't reliably use the inNow time from the output device ioProc callback to provide a time value for the input device AudioDeviceRead() call.

Instead the solution is to maintain my own count of sample position time for the input device, and to initialize this on the first output device ioProc callback and to then increment it by 'buffer size' samples on each subsequent call. This seems to work fine and my wobbles have gone away.

Thanks for your help Jeff

Andrew 8-)
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >AudioDeviceRead and timestamps (From: Andrew Kimpton <email@hidden>)
 >Re: AudioDeviceRead and timestamps (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: Panther and 64 bits
  • Next by Date: Wait for sysex?
  • Previous by thread: Re: AudioDeviceRead and timestamps
  • Next by thread: Known issues with VST-AU based AudioUnits
  • Index(es):
    • Date
    • Thread