Re: OpenAL + OggVorbis streaming on MacOSX alSourceQueueBuffers issue
Juan Miguel Martín Muñoz <[email protected]> Fri, 14 Oct 2011 09:45:18 +0200
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <CADN8KfT2+JGxAXMws6Qn26oJxZ72BKftuZV-OUFO+nJyPi89JQ@mail.gmail.com> |
Hi!
Actually is not a problem of OpenAL. The problem is in ov_read (). I could
not find the solution but I found an alternative: ov_read_float (). This
function works fine on OSX 10.6.
Try to do that in your decoding loop:
float **pcm_ch = NULL;
...
...
...
while(true){
...
...
...
lSamplesDecoded = ov_read_float(psOggVorbisFile, &pcm_ch, iBufferMaxSamples
- lSamplesDone, ¤t_section);
// convert from float to short int and interleave channels
for ( int i = 0; i < lSamplesDecoded; i++ )
{
for ( int j = 0; j < ulChannels; j++ )
{
iSample = (short)( pcm_ch[j][i] * 32768.0f );
memcpy( &(pDecodedBuff[iBufferIndex]), &iSample, 2 );
iBufferIndex += 2;
}
if ( iBufferIndex >= ulBuffSize )
break;
}
...
...
...
}
I assume 16 bits Samples, I'm sure you can tune this code ;)
2011/10/14 Eric Wing <[email protected]>
> On 10/13/11, Chris Perry <[email protected]> wrote:
> > Hi there,
> >
> > I was just wondering if this documented issue has been resolved?
> > http://opensource.creative.com/pipermail/openal/2011-July/012422.html
> >
> > Apologies, but I couldn't find a solution to this after searching for a
> > while.
> >
> > I assume the issue in on the Vorbis side so probably not the correct
> place
> > to post this
> > But I'm not positive, and maybe its helpful to other OpenAL devs out
> there
> >
> > The problem seems to persist even with Vobris' latest source. (1.3.2) &
> > libogg version (1.3.0)
> >
> > You will get the corrupted buffer if you follow this tutorial on Mac OSX
> > 10.6
> > http://www.devmaster.net/articles/openal-tutorials/lesson8.php
>
> As far as I know/can-remember, there are no standing issues with
> streaming in (Apple) OpenAL in 10.6. My library, ALmixer
> (http://playcontrol.net/opensource/ALmixer/) uses SDL_sound to decode
> sound and I usually compile in Ogg Vorbis support when I use ALmixer
> on Mac. I have not encountered any problems on Mac in this area. (The
> newly released iOS 5.0 is a different story though.)
>
> -Eric
> --
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
> _______________________________________________
> Openal mailing list
> [email protected]
> http://opensource.creative.com/mailman/listinfo/openal
>
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal