Re: OpenAl for streaming
Bob Aron <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
Susmith, It would be helpful if you could write a bug report to Apple and include a test program that exhibits this behavior. thanks, -bob aron ________________________________ Bob Aron • CoreAudio Team, Apple Inc. [email protected] On Jul 28, 2010, at 1:35 AM, Susmith M R (RBEI/ECF1) wrote: > Thanks for your reply > I am not using alBufferDataStatic. My problem is, when I use alSourceUnqueueBuffers, I am getting the same Unqueued bufferid again. Why it is happening? This changes the state of my program. > > One more question. > Can I use alSourceUnqueueBuffers while some buffer is playing. When I used like this sometimes I am getting AL_INVALID_VALUE. Why is this? How do we know the buffer id of the processed buffers? > I am using > alGetSourcei( m_nALOalSource, AL_BUFFERS_PROCESSED, &iBuffersProcessed ); > To get the no of buffers processed and using the following loop to unqueue > while ( iBuffersProcessed ) > { > uiBuffer = 0; > alSourceUnqueueBuffers( m_nALOalSource, 1, &uiBuffer ); > bCheckPrintALErrorString("alSourceUnqueueBuffers") > iBuffersProcessed--; > } > I am not sure why alSourceUnqueueBuffers is returing AL_INVALID_VALUE. In the document it is specified that alSourceUnqueueBuffers will only return AL_INVALID_VALUE when "At least one buffer can not be unqueued because it has not been processed yet.". From the above code how is that possible since I am only unqueueing iBuffersProcessed from the processed queue. > > > Best Regards > Susmith MR > > -----Original Message----- > From: Eric Wing [mailto:[email protected]] > Sent: Wednesday, 28. July 2010 12:20 PM > To: Susmith M R (RBEI/ECF1) > Cc: [email protected] > Subject: Re: [Openal] OpenAl for streaming > > On 7/27/10, Susmith M R (RBEI/ECF1) <[email protected]> wrote: >> Hi everyone, >> >> I am developing an OpenAL based application for iPhone. >> >> When I use alSourceUnqueueBuffers in a loop I get the same unqueued BufferID >> for the immediately-next alSourceUnqueueBuffers command. Since I am using a >> bufferID list to reuse the bufferIDs for my application, there is no need to >> recreate or delete the buffers. I have already created a set of buffers >> during the initialization of my application. After unqueuing the buffer from >> the OpenAl queue I use the unqueued bufferIDs to fill new buffer data using >> albufferdata and then queue it to OpenAL. I don't know when exactly the >> buffer will be freed. Please refer >> http://old.nabble.com/Why-does-alDeleteBuffers-gives-a-AL_INVALID_OPERATION-error--td22632832.html. >> Can this result in any internal conflict in OpenAL state? alBufferData and >> alSourceQueueBuffer are not returning any error. >> >> Is there any way to know the completion of the command >> alSourceUnqueueBuffers? >> > > Reusing the buffer is fine. I think of it like malloc and free. You > use malloc to allocate a block of memory. You write over and over > again to that same block of memory for reuse. But when you are finally > done, you need to free that block of memory. > > If you stick to standard OpenAL, I don't think you need to expect > alSourceUnqueueBuffers to have a race condition unless Apple has a > bug, in which case you should file a bug report. However, if you are > using the iPhone OpenAL extension, alBufferDataStatic, then you have > to worry about alDeleteBuffers failing. It is not just limited to > alSourceUnqueueBuffers either. alDeleteBuffers will be your pinch > point. You will need to call alDeleteBuffers and check alGetError() to > see if it failed (because Apple overloaded the function for this > case). Then you must react accordingly (after the fact) if there is a > failure. > > Or you could avoid using the alBufferDataStatic extension. > > > I highly recommend my book, "Beginning iPhone Games Development" in > which I extensively cover OpenAL. Coincidentally, the longest chapter > in the book is on audio streaming and there is a full blown OpenAL > implementation that includes streaming. I also spend considerable > energy explaining the sharp knives associated with the > alBufferDataStatic extension on iOS. (The Creative/Xbox implementation > which also offers the extension is apparently immune to these > problems.) > > http://playcontrol.net/iphonegamebook/ > > -Eric > > _______________________________________________ > Openal mailing list > [email protected] > http://opensource.creative.com/mailman/listinfo/openal _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal