[SDL] SDL_Mixer and streamed vorbis data

Kostas Kostiadis kos at climaxgroup.com
Fri Jun 1 07:58:38 PDT 2007


Hm...I think I need to have a think about where I'm going in the audio
department ;-)
Has anyone already looked into SDL_Mixer vs SDL_Audio vs OpenAL?
Is so, what are the pros/cons of using each one?

For example if SDL_Mixer can't do pcm streaming, that will really help me
out since I can immediately not consider it.

Cheers,
Kos
 

> -----Original Message-----
> From: sdl-bounces at lists.libsdl.org 
> [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of David Olofson
> Sent: 01 June 2007 15:41
> To: A list for developers using the SDL library. (includes 
> SDL-announce)
> Subject: Re: [SDL] SDL_Mixer and streamed vorbis data
> 
> On Friday 01 June 2007, Kostas Kostiadis wrote:
> > Hello all,
> > 
> > I'm decoding a video stream that contains video (theora) and audio
> > (vorbis) data.
> > I'm wondering if I can use SDL_Mixer to play the audio.
> 
> Well, you *can*, one way or another, but SDL_Mixer isn't really 
> designed for this kind of use...
> 
> 
> > I'm guessing I can use Mix_QuickLoad_RAW to read the pcm data in,
> > and then use something like
> > Mix_PlayChannel to play the Mix_Chunk I get back (?)
> 
> Not really. SDL_Mixer doesn't have a streaming API of the sort you'd 
> use for this. You could hack your way around it by abusing the Effect 
> API, and use a dummy looping chunk to keep the channel going.
> 
> Either way, why bother? Why do you want to use SDL_Mixer, rather than 
> just using the SDL audio API directly? The "raw" SDL API is more 
> appropriate for this kind of stuff.
> 
> 
> > Here comes the questions:
> > 
> > The docs read:
> > 	Mix_Chunk *Mix_QuickLoad_RAW(Uint8 *mem)
> > mem
> >     Memory buffer containing a WAVE file in output format. 
> > 
> > 1) How does that interface with the data you get back from
> > vorbis_synthesis_pcmout?
> 
> It doesn't, AFAICT. I'm not familiar with the Vorbis API, but I would 
> expect - and it sure looks like - a block based streaming interface 
> of some sort. SDL_Mixer OTOH, expects you to "upload" one-shot or 
> looped waveforms to use as sound effects and such.
> 
> 
> > 2) Vorbis stuff is 16 bit...i.e. you get back things in ogg_int16_t.
> > Why is QuickLoad taking in Uint8?
> 
> This is just because SDL_Mixer supports various sample formats. 
> Instead of using a special version of the call for every possible 
> format, you just cast the pointer to (Uint8 *), and the sample format 
> is assumed to be the same as the output format.
> 
> 
> //David Olofson - Programmer, Composer, Open Source Advocate
> 
> .-------  http://olofson.net - Games, SDL examples  -------.
> |        http://zeespace.net - 2.5D rendering engine       |
> |       http://audiality.org - Music/audio engine          |
> |     http://eel.olofson.net - Real time scripting         |
> '--  http://www.reologica.se - Rheology instrumentation  --'
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> 


More information about the SDL mailing list