Re: Problems with alSourceQueueBuffers on MacOSX
Juan Miguel Martín Muñoz <[email protected]> Fri, 15 Jul 2011 13:57:53 +0200
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <CADN8KfSrY28AxaBZNBKmssCt-gXuDvYmepO-xCJ5WZpDNtOpYw@mail.gmail.com> |
Hi! I'm still working on that. pDecodeBuffer is full of trash, so OpenAL is innocent (not at all, alGetError() does not tell the truth). The problem is my DecodeOggVorbis function. if anyone has experience with OpenAL and ogg on macosx I'll send him the code otherwise do not bother you more :) Thanks! El 15 de julio de 2011 09:56, Juan Miguel Martín Muñoz <[email protected]>escribió: > Ah, sorry Eric, alGetString(err) returns NULL :( > > El 15 de julio de 2011 09:48, Juan Miguel Martín Muñoz <[email protected]>escribió: > > Good morning! >> >> Jason, Eric, thanks for your reply. >> alGetError() after alSourceQueueBuffers() returns -50. I don't understand >> that, -50 is not a valid return value for alGetError. >> But I found some new. alSourceQueueBuffers returns some error (???) >> because the buffer is corrupt. >> >> I'll try to explain what happens with the code >> >> ALenum err = alGetError(); *// at this point alGetError >> returns AL_NO_ERROR* >> >> // Is the buffer empty? >> alGetSourcei(uiSource, AL_BUFFERS_QUEUED, &iQueuedBuffers); *// iQueuedBuffers >> is 0* >> err = alGetError(); *// at this point alGetError returns AL_NO_ERROR* >> >> if (iQueuedBuffers == 0) >> { >> // Fill all the Buffers with decoded audio data from the OggVorbis >> file >> for (iLoop = 0; iLoop < PS_NUM_BUFFERS; iLoop++) *// PS_NUM_BUFFERS = >> 2* >> >> { >> ulBytesWritten = DecodeOggVorbis(&sOggVorbisFile, pDecodeBuffer, >> ulBufferSize, ulChannels); >> if (ulBytesWritten) >> { >> alGetError(); >> *// ulFormat is AL_FORMAT_STEREO16, pDecodeBuffer type is >> (ALchar *), ulBytesWritten is 44100, ulFrequency is 44100* >> alBufferData(uiBuffers[iLoop], ulFormat, pDecodeBuffer, >> ulBytesWritten, ulFrequency); >> err = alGetError(); *// at this point alGetError >> returns AL_NO_ERROR!!!* >> } >> } >> >> ALboolean bTest = alIsBuffer(uiBuffers[0]); *// bTest = AL_TRUE* >> bTest = alIsBuffer(uiBuffers[1]); *// bTest = AL_TRUE* >> >> ALint res; >> alGetBufferi(uiBuffers[0], AL_BITS, &res); *// res = 16 (this is OK)* >> alGetBufferi(uiBuffers[0], AL_CHANNELS, &res); *// res = 2 (this is OK)* >> alGetBufferi(uiBuffers[0], AL_SIZE, &res); *// res = 44100 (this is OK)* >> alGetBufferi(uiBuffers[0], AL_FREQUENCY, &res); *// res = -2147483648 >> (this is CORRUPT!)* >> *// uiBuffers[1] returns the same values* >> >> err = alGetError(); *// at this point alGetError returns AL_NO_ERROR!!!* >> >> alSourceQueueBuffers(uiSource, PS_NUM_BUFFERS, uiBuffers); >> err = alGetError(); *// err is -50 ?¿?¿?¿?¿* >> } >> >> Thanks for your time! >> >> El 14 de julio de 2011 23:15, Eric Wing <[email protected]> escribió: >> >> On 7/14/11, Juan Miguel Martín Muñoz <[email protected]> wrote: >>> > Hi! >>> > >>> > I've this code to fill buffers with decode audio data >>> > >>> > // Is the buffer empty? >>> > alGetSourcei(uiSource, AL_BUFFERS_QUEUED, &iQueuedBuffers); >>> > if (iQueuedBuffers == 0) >>> > { >>> > // Fill all the Buffers with decoded audio data from the OggVorbis file >>> > for (iLoop = 0; iLoop < PS_NUM_BUFFERS; iLoop++) >>> > { >>> > ulBytesWritten = DecodeOggVorbis(&sOggVorbisFile, pDecodeBuffer, >>> > ulBufferSize, ulChannels); >>> > if (ulBytesWritten) >>> > { >>> > alBufferData(uiBuffers[iLoop], ulFormat, pDecodeBuffer, ulBytesWritten, >>> > ulFrequency); >>> > } >>> > } >>> > alGetError(); >>> > alSourceQueueBuffers(uiSource, PS_NUM_BUFFERS, uiBuffers); >>> > ALenum err = alGetError(); >>> > } >>> > >>> > // Start playing source >>> > alSourcePlay(uiSource); >>> > >>> > This code works fine on PC but on MacOSX (10.6) I ger an error code >>> "-50" >>> > after alSourceQueueBuffers. >>> > >>> > Thanks in advance! >>> > >>> >>> What does alGetString(err) say? >>> Does alGetError return an error for any of your other OpenAL commands? >>> >>> Random guess: maybe you need more syntax: >>> alSourceQueueBuffers(uiSource, PS_NUM_BUFFERS, &uiBuffers); >>> or >>> alSourceQueueBuffers(uiSource, PS_NUM_BUFFERS, &uiBuffers[0]); >>> >>> -Eric >>> -- >>> Beginning iPhone Games Development >>> http://playcontrol.net/iphonegamebook/ >>> >> >> > _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal