[vorbis-dev] Reading OGG embedded in a pack file - small patch tosdl_mixer and example file
Ken Rogoway
Ken at Rogoway.com
Tue May 4 12:16:19 PDT 2004
Looks good. Hopefully this will also work with the Mix_LoadWAV stuff since
these are sound effects
and I do not want their volume setting changed when the user changes the
music volume. I will look at
this closer tonight when I have a chance.
- Ken
----- Original Message -----
From: "Andre Krause" <post at andre-krause.net>
To: <vorbis-dev at xiph.org>
Sent: Tuesday, May 04, 2004 12:41 PM
Subject: RE: [vorbis-dev] Reading OGG embedded in a pack file - small patch
tosdl_mixer and example file
<p>> Hello, i had the same problem , streaming oggs from an archive. I found a
> very simple solution, just changing a little in sdl_mixer.
> Look here:
> http://www.videofiles.de/SDL_mixer_patch_ogg_streaming_from_sdlrwops.zip
> The zip contains an example file using the great lib PHYSfs (
> http://icculus.org/physfs/ ) for archive support. No need to bother with
> seek - callbacks if you first extract the complete ogg into memory (ok,
not
> optimal, but who cares today about 2-5 megs less working mem) and then
using
> SDL_RWFromMem to create an rwops. The ogg then is streamed from mem using
> sdl_mixer.
>
>
>
>
> SDL_RWops * rw=NULL;
>
> //First thing you need to do is initialize the filesystem. reason:
> linux needs this whyever..
> PHYSFS_init(argv[0]);
> // add the contents of myzip to the end of the "searchpath" (0 to
> the front)
> PHYSFS_addToSearchPath("oggs.zip", 1);
> PHYSFS_file* filehande;
> char* myBuf=NULL;
> if(PHYSFS_exists("test1.ogg"))
> {
> filehande=PHYSFS_openRead("test1.ogg");
> cerr << "\nfilelength:" << PHYSFS_fileLength(filehande);
> myBuf = new char[PHYSFS_fileLength(filehande)];
> int bytesread=PHYSFS_read (filehande, myBuf, sizeof(char),
> PHYSFS_fileLength(filehande));
> cerr << "\nbytes read into mem:" << bytesread;
> rw = SDL_RWFromConstMem(myBuf,bytesread*sizeof(char));
> PHYSFS_close(filehande);
> }
>
> Mix_Music *music = Mix_LoadMUS_RW(rw);
>
>
> > -----Original Message-----
> > From: owner-vorbis-dev at xiph.org
> > [mailto:owner-vorbis-dev at xiph.org] On Behalf Of Ken Rogoway
> > Sent: Dienstag, 4. Mai 2004 18:53
> > To: vorbis-dev at xiph.org
> > Subject: Re: [vorbis-dev] Reading OGG embedded in a pack file
> >
> >
> > > I'm the guy who did the fishmixer thing. It's a patch to SDL_mixer
> > > that replaces the ogg/vorbis loader with fishsound, letting
> > SDL_mixer
> > > load vorbis and speex. Since libfishsound doesn't provide a
> > pcm-total,
> > > and since I hate having to know pcm-total in advance anyway, the
> > > fishmixer patch grows the sound buffer as more samples come in.
> > >
> > > So I make a buffer that's big enough without having to
> > allocate that
> > > buffer at the start. You might give it a look - since you're having
> > > trouble with pcm-total, just don't use it at all.
> >
> > Thanks Daniel. I will take a look at libfishsound.
> >
> > - Ken
> >
> > --- >8 ----
> > List archives: http://www.xiph.org/archives/ Ogg project
> > homepage: http://www.xiph.org/ogg/ To unsubscribe from this
> > list, send a message to 'vorbis-dev-request at xiph.org'
> > containing only the word 'unsubscribe' in the body. No
> > subject is needed.
> > Unsubscribe messages sent to the list will be ignored/filtered.
> >
> >
>
> --- >8 ----
> List archives: http://www.xiph.org/archives/
> Ogg project homepage: http://www.xiph.org/ogg/
> To unsubscribe from this list, send a message to
'vorbis-dev-request at xiph.org'
> containing only the word 'unsubscribe' in the body. No subject is needed.
> Unsubscribe messages sent to the list will be ignored/filtered.
>
>
<p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list