Re: A bug in OpenAL on iPhone?
Re: A bug in OpenAL on iPhone?
- Subject: Re: A bug in OpenAL on iPhone?
- From: 张立著 <email@hidden>
- Date: Fri, 2 Jul 2010 09:10:58 +0800
Thanks for your reply.
I think it is because I call the OpenAL functions too frequently. I make the buffer bigger, it is OK now.
2010/6/30 Eric Wing
<email@hidden>
On 6/28/10, <
email@hidden> wrote:
> Hi all,
> I want to use OpenAL to implement a raw PCM data player. The data is
> received from internet and buffered it to an OpenAL buffer. But it seems
> that the OpenAL buffer is not enough all the time even I allocate for 1000
> buffers and use them cyclic.
> What shall I do?
> Thanks.
>
It's not clear to me from your description why this is not working for
you. What exactly is the problem you are encountering?
Here are some thoughts since I don't have enough info.
Allocating 1000 buffers seems like a lot, though I don't know how big
your buffers are. But if your buffers are too big, you could be
exhausting the amount of RAM available on your iPhone. You want to
keep as little data in RAM at any given time. You might be pulling in
data too fast...much faster than you can play it. This forces you to
keep more data in RAM and you exhaust your memory. Instead, you should
either write out the data to a temporary file or just slow down your
internet connections.
If you are using alBufferData, every call is essentially a memory copy
from the original data source. If you have 1000 buffers, you might be
actually using twice that memory if you didn't delete the original
data source. alBufferDataStatic might help you here a little because
it avoids the memory copy. But be warned, alBufferDataStatic is a
sharp knife you can cut yourself with if you are not careful.
Maybe the problem is completely different and you are suffering from a
starvation/underrun condition?
I cover OpenAL in pretty great detail including the alBufferDataStatic
extension in the book I co-authored, Beginning iPhone Games
Development.
http://playcontrol.net/iphonegamebook
-Eric
--
Mr. Zhang Lizhu
Department of Electronic
Engineering, Tsinghua University
BeiJing 100084, China.P.R
_______________________________________________
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