Re: Using AudioQueue to play short sounds repeatedly?
Re: Using AudioQueue to play short sounds repeatedly?
- Subject: Re: Using AudioQueue to play short sounds repeatedly?
- From: tahome izwah <email@hidden>
- Date: Thu, 30 Sep 2010 13:02:38 +0200
You really should set up one player that is running continuously and
copy the sample data that you're playing to the stream when you reach
the time of a note-on. NSTimer is way too inaccurate to trigger
anything that has to be in time, and having the AQ overhead on each
note-on will cause the notes to be delayed even more.
HTH
--th
2010/9/30 Steve gfx <email@hidden>:
> Hi List,
> As most google searches for Audio Queue point to this list I thought it was
> time to subscribe :)
> I'm making a simple drum machine (for iPhone) to sequence and playback short
> sounds, but have come up against problems when using Audio Queue to play
> back sounds in quick succession; at high tempos the queue seems to not play
> at all and I get silence where I'm expecting a sample to play back.
> Looking at a simple test case of firing one particular short sample (0.25
> seconds) every 0.5 seconds, I call the following (from an NSTimer)
>
> for (int i = 0; i < kNumberBuffers; ++i)
> {
> AQBufferCallback (this, mQueue, mBuffers[i]);
> }
> return AudioQueueStart(mQueue, inAudioQueueStartTime);
>
> Because the sounds are so short:
> 1) I have kNumberBuffers set to 1. The sounds are so short they fit entirely
> in to one small buffer.
> 2) Inside my callback, the buffer is being filled via memcpy() rather than
> read off disk, again because they're so small.
> 2) All sounds are uncompressed PCM in .caf format.
> This is working fine at lower speeds, however, when trying to play back more
> rapidly, it seems sometimes the queue doesn't play back.
> (I should add that although initially I had some timing problems, and
> problems with the first 15-20 ms of sounds missing, both of these have been
> cured by using an AudioTimeStamp set a small amount in to the future, rather
> than NULL. )
> Are there any fundamental problems with trying to re-trigger a queue like
> this?
> I see there is a method called AudioQueueReset(), but I'm not sure if I
> should be using it or not.
> All sample code I've seen assumes playing back longer sounds and controlling
> their playback, which I have no problem with.
> Thanks
> Steve
>
>
>
>
> _______________________________________________
> 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