Re: How to delay AudioQueue playing
Re: How to delay AudioQueue playing
- Subject: Re: How to delay AudioQueue playing
- From: Steven Winston <email@hidden>
- Date: Wed, 30 Sep 2009 17:07:36 -0700
AudioQueue unfortunately isn't the best way to go about doing this.
It inherently creates a queue that's buffered ahead of the PCM data
that's played. You'll notice a "lag" on anything that you alter in
your buffering callback which is what you'd expect from that type of
application. Might I recommend using AudioUnits? They'll give you
quicker feedback.
That said, here's the trick that will solve your current question of
how to play silence:
in AudioQueueServices you have a buffer callback and somewhere a call
to AudioQueueEnqueueBuffer. Don't call that when you don't want audio
from that AudioQueue to play. That or you can pass it a buffer full
of 0.
On Wed, Sep 30, 2009 at 9:06 AM, Michael Becker <email@hidden> wrote:
> Hello list, this is my first post!
>
> I have been searching a lot on the web and in the list archives, but I have
> not found anything that helped me, although I guess that my question has
> been asked a zillion times before: I am trying to build an audio sequencer,
> i.e. an 8 track sequencer that plays audio samples. The concept is fairly
> easy: Every sample is exactly the same length, the user can only switch
> samples on or off for a complete duration.
>
> I am using the AudioQueue API and I think I understand that I should use one
> Audio Queue for each track. So far I have managed to have two queues loop
> two samples synchronously. I basically stuck to the Apple documentation
> ("Looping audio files"). It works great, they are perfectly in sync.
>
> Now comes the problem: How do I omit individual samples during playback? I
> think the solution either comes down to "playing silence" for the duration
> of one or more samples, or delaying the playback of the next sample for a
> time that is a multiple of a sample length.
>
> On a sidenote: Is this the right way to go about this? Or should I somehow
> create a "main clock" that ticks and only play samples according to this
> "clock"? (Instead of rigorously looping the samples back to back).
>
> Maybe I am phrasing my question the wrong way, but please bear with me as I
> am really new to Core Audio and Sound programming in general.
>
> Kind regards,
> Michael
> _______________________________________________
> 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
>
_______________________________________________
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