On Aug 16, 2010, at 12:50 PM, Gregory Wieber wrote: Could I use the AudioInputQueue concurrently with an AUGraph?
My goal is to count time / send obj-c messages at an interval of 16 ticks per 'beat', at a sample rate of 44100. So, at 60 beats per minute, that would mean 1 beat = 1 second, and one 'tick' of my clock = 1 second divided by 16.
At the moment I'm putting my counting code into the render callback of a multichannel mixer ( a hack, I realize). I'm going to look into AudioInputQueue like you suggest.
For a multichannel mixer, you can indeed just count samples - that is presuming that it is connected to the AURemoteIO. The reason you can do this is that it is operating in the basic real-time mode that the AURemoteIO imposes (it calls you for audio every N msec, where N is the number of samples it needs to provide N msecs of audio data for playback). So, this isn't a hack, but is a perfectly legitimate way to understand the progression of time because of the context you are being called in.
Audio Queue does NOT call you with real-time semantics. It calls you when the buffer you gave the queue has been consumed (or filled) by the audio queue object. This is faster than real time (so, imagine, you fill a buffer submit it to the AQ, it decodes it, stores the results in an intermediary buffer that it owns, then gives your buffer back to you. It is meanwhile, playing out the results of that decode, but it has already given the buffer back to you before those results have been played). So for audio queue, you know time from asking the audio queue "what time is it". You can't count samples with an AQ like you do with and audio unit (in fact in a lose sense, the AQ derives its sense of time by counting samples from the AUs it uses to render)....
Bill
Thanks On Mon, Aug 16, 2010 at 12:39 PM, William Stewart <email@hidden> wrote:
So, this is not the way to do this.
If you need a particular I/O cycle size, then you MUST use the AudioSession property.
MaxFrames has no affect.
If you are wanting to get buffers of a particular duration and have no need to do low-latency I/O processing, then I would use an AudioInputQueue and create buffers of the duration that you would like to operate at.
Perhaps a short description of the basic parameters of your objectives would help...
Bill
On Aug 11, 2010, at 10:14 AM, Gregory Wieber wrote:
> I have a similar question related to counting samples (for a metronome) that was addressed here a while ago.it was suggested that a metronome could be implemented by counting samples using the time stamp in a render callback. However, the render callback deals with chunks of frames (let's say 512). So, this doesn't seem like the right approach. If I'm dealing with a sample rate of 44100, where should I be sticking my sample counting code?
>
> _______________________________________________
> 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
|