views:

46

answers:

1

Hi,

I have a basic doubt about AudioQueues, I am using AudioQueue to record and am basically following the SpeakHere app. I found out that whenever I pause recording using the api: AudioQueuePause on AudioQueue object, the recording is not paused immediately. Is there a callback in AudioQueues which intimates the delegate that audio recording is paused?

Or am I wrong in understanding that AudioQueuePause api is asynchronous? The API as depicted in the docs is:

OSStatus AudioQueuePause (
   AudioQueueRef inAQ
);

It does return OSStatus, but which one of them indicates a successful call and whether they (OSStatus) indicate that the call is synchronous?

Thanks, Raj

+1  A: 

You could try

AudioQueueGetCurrentTime or AudioQueueDeviceGetCurrentTime

as soon as the "pause request" fromn your UI occurs. Then you can ignore/delete the additional samples that were recorded after your "pause request" due to the asynchronous AudioQueuePause command.

zeroinverse
Raj
I am simply suggesting you track the "exact time" when your user clicks PAUSE (on the user interface). At that time, call the AudioQueue time functions and store that value. Then you can go back and remove all samples that are "past" that point in time.Specifically, since your samples are stored in N samples at X sample rate (like 1,000,000 samples at 44.1kHz is about 22.6 seconds). If your user clicked pause button and AQ time function tells you "I was at sample 999,000, then you can delete all samples after 999,001"AQ time functions can return both time in seconds and time in samples.
zeroinverse