Re: stop a sound file after playing once?
Re: stop a sound file after playing once?
- Subject: Re: stop a sound file after playing once?
- From: Aran Mulholland <email@hidden>
- Date: Fri, 22 Jul 2011 10:14:17 +1000
yep you must fill the buffer every time - that's because it is real
time audio. the callback is called every time the samples are needed
and the graph doesn't stop requesting samples unless you tell it to
(by stopping it etc). you have missed a little bit of the fundamental
knowledge and you should probably go and read the audio unit guide or
similar that talks about real time audio and buffers.
a bit off topic - there is a good article about real time audio and
avoiding glitching that I found a most interesting read here:
http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing
On Fri, Jul 22, 2011 at 9:49 AM, Bob Sabiston <email@hidden> wrote:
>
> On Jul 21, 2011, at 6:41 PM, Aran Mulholland wrote:
>
>> check out here :
>> http://lists.apple.com/archives/coreaudio-api/2010/Jun/msg00230.html
>> for a description of what (and what not) to do.
>
> Well, that was a little confusing. In that link it seems to say that the render callback MUST fill the sample array, every time!? Even if you want silence you can't just fill it with 0's once? I was thinking I could just clear the buffer when it first reached the end, then afterward just return instantly from the callback. So you can't do that? WTF that is so inefficient it doesn't make any sense to be randomly filling buffers with memory for no reason like that.
>
> But I guess openGL is similar you always have to clear out buffers and rerender the whole thing even if you aren't changing it.
>
> Man I feel like I am in wonderland this audio stuff is so low level compared to their visual and UI interface stuff. Freaky.
>
> Bob
>
>
>
_______________________________________________
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