Mix_LoadMUS_RW

I’d really, really like to have a working Mix_LoadMUS_RW() in SDL_Mixer.

I have music soundtracks in ogg format. I get them from custom
datafiles. So far I have to load them as samples (which support reading
from a RWOps) but have the huge disadvantage of eating a lot of memory
because the ogg is decompressed to memory on load, unlike the Mix_Music
implementation of ogg, which has the ogg in memory and decompresses on
the fly.

A quick look at the sources shows that almost everything is in place,
for ogg files at least. I also found a patch (see this old thread -
http://www.devolution.com/pipermail/sdl/2004-March/060537.html ) but I
wonder why it didn’t make it to CVS (or 1.2.6 at least)

Any authoritative figure (Ryan?) can comment on this? Would a patch to
stream ogg music from a RWOps be useful, even if it doesn’t support
other formats?

Thanks,
–Gabriel

A quick look at the sources shows that almost everything is in place,
for ogg files at least. I also found a patch (see this old thread -
http://www.devolution.com/pipermail/sdl/2004-March/060537.html ) but I
wonder why it didn’t make it to CVS (or 1.2.6 at least)

I submitted a patch which does this in August 2004, which got merged in.
This should be in 1.2.6, but IIRC at least the prebuilt osx binaries
didn’t have the Mix_LoadMUS_RW symbol exported. This might be the case for
the windows prebuilt binaries, too.

// MartinOn Sat, 24 Sep 2005, Gabriel wrote:

Unless something happened…ogg files have been supported for quite a
while (at least in the libraries I’ve been using). Could it be that the
compiler couldn’t find the ogg libraries? From the SDL website
(www.libsdl.org):
SDL_mixer is a sample multi-channel audio mixer library.
It supports any number of simultaneously playing channels of 16 bit
stereo audio, plus a single channel of music, mixed by the popular
MikMod MOD, Timidity MIDI, Ogg Vorbis, and SMPEG MP3 libraries.

Try installing the libogg and libvorbis devel libraries and recompiling
your SDL_mixer.

SDL_mixer @ libsdl.org:
http://www.libsdl.org/projects/SDL_mixer/

How to load an ogg file with SDL_mixer @ gpwiki:
http://gpwiki.org/index.php/C:Using_SDL_mixer_to_play_an_Ogg_music_file

Hope that helps.
-Elden

Martin Storsj? wrote:> On Sat, 24 Sep 2005, Gabriel wrote:

A quick look at the sources shows that almost everything is in place,
for ogg files at least. I also found a patch (see this old thread -
http://www.devolution.com/pipermail/sdl/2004-March/060537.html ) but I
wonder why it didn’t make it to CVS (or 1.2.6 at least)

I submitted a patch which does this in August 2004, which got merged
in. This should be in 1.2.6, but IIRC at least the prebuilt osx
binaries didn’t have the Mix_LoadMUS_RW symbol exported. This might be
the case for the windows prebuilt binaries, too.

// Martin


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I submitted a patch which does this in August 2004, which got merged in.
This should be in 1.2.6, but IIRC at least the prebuilt osx binaries
didn’t have the Mix_LoadMUS_RW symbol exported. This might be the case for
the windows prebuilt binaries, too.

You’re right. It’s available in Linux but not in Windows (I didn’t check
OSX yet). It seems to work fine in Linux. Anyone knows why isn’t it
exported by default?

--Gabriel

My mistake, I misread the original post. (Work tends to make one skim
more than usual…sorry about that)
As for Mix_LoadMUS_RW: You won’t notice any difference (in reality)
between using a standard channel, and using the pre-allocated Music
channel from SDL_mixer. If you use libvorbis/ogg to stream your audio
data, it won’t really matter whether it’s the music channel or an effect
channel (in the long run), aside from being short one channel (that was
allocated for your music channel). devmaster has a streaming ogg (from
memory) article which uses openal, but sending the data to SDL_mixer
shouldn’t be a whole lot different. Hope that actually helps this time.
(Sorry for my misreading earlier)

http://www.devmaster.net/articles/openal-ogg-file/

-Elden
Elden Armbrust wrote:> Unless something happened…ogg files have been supported for quite a

while (at least in the libraries I’ve been using). Could it be that
the compiler couldn’t find the ogg libraries? From the SDL website
(www.libsdl.org):
SDL_mixer is a sample multi-channel audio mixer library.
It supports any number of simultaneously playing channels of 16 bit
stereo audio, plus a single channel of music, mixed by the popular
MikMod MOD, Timidity MIDI, Ogg Vorbis, and SMPEG MP3 libraries.

Try installing the libogg and libvorbis devel libraries and
recompiling your SDL_mixer.

SDL_mixer @ libsdl.org:
http://www.libsdl.org/projects/SDL_mixer/

How to load an ogg file with SDL_mixer @ gpwiki:
http://gpwiki.org/index.php/C:Using_SDL_mixer_to_play_an_Ogg_music_file

Hope that helps.
-Elden

Martin Storsj? wrote:

On Sat, 24 Sep 2005, Gabriel wrote:

A quick look at the sources shows that almost everything is in place,
for ogg files at least. I also found a patch (see this old thread -
http://www.devolution.com/pipermail/sdl/2004-March/060537.html ) but I
wonder why it didn’t make it to CVS (or 1.2.6 at least)

I submitted a patch which does this in August 2004, which got merged
in. This should be in 1.2.6, but IIRC at least the prebuilt osx
binaries didn’t have the Mix_LoadMUS_RW symbol exported. This might
be the case for the windows prebuilt binaries, too.

// Martin


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

My mistake, I misread the original post. (Work tends to make one skim
more than usual…sorry about that)
As for Mix_LoadMUS_RW: You won’t notice any difference (in reality)
between using a standard channel, and using the pre-allocated Music
channel from SDL_mixer.

Oh yes I do! Instead of decompressing a 1:45 ogg file to memory (25 MB)
and play it as a sample, I have the 1.7 MB ogg in memory and the mixer
decompresses it as needed.

--Gabriel-- 

Gabriel Gambetta
Mystery Studio - http://www.mysterystudio.com
Gabriel on Graphics - http://gabrielongraphics.blogspot.com

Hehe, nono…I meant you won’t see a difference as far as performance
(not memory usage). Using the standard SDL_mixer functions you’ll
definitely see a memory usage difference. I still suggest checking into
the link I posted along with that message. While the implementation
will differ slightly (due to it being about OpenAL) the loading should
be nearly identicle, if not exactly the same.
-Elden

Gabriel wrote:>>My mistake, I misread the original post. (Work tends to make one skim

more than usual…sorry about that)
As for Mix_LoadMUS_RW: You won’t notice any difference (in reality)
between using a standard channel, and using the pre-allocated Music
channel from SDL_mixer.

Oh yes I do! Instead of decompressing a 1:45 ogg file to memory (25 MB)
and play it as a sample, I have the 1.7 MB ogg in memory and the mixer
decompresses it as needed.

–Gabriel

You’re right. It’s available in Linux but not in Windows (I didn’t check
OSX yet). It seems to work fine in Linux. Anyone knows why isn’t it
exported by default?

It seems like USE_RWOPS isn’t defined by default in the Visual C build
files.

Could whoever maintains the windows builds update this?

// MartinOn Sat, 24 Sep 2005, Gabriel wrote:

Any authoritative figure (Ryan?) can comment on this? Would a patch to
stream ogg music from a RWOps be useful, even if it doesn’t support
other formats?

I’m really nervous about adding APIs to SDL_mixer at this point,
especially in large patches like this. If Sam says it’s cool, I’ll
commit it, but unlike SDL, I don’t spend any time thinking about
SDL_mixer, and I would feel really irresponsible to commit that and
forget about it.

–ryan.

I’m really nervous about adding APIs to SDL_mixer at this point,
especially in large patches like this. If Sam says it’s cool, I’ll
commit it, but unlike SDL, I don’t spend any time thinking about
SDL_mixer, and I would feel really irresponsible to commit that and
forget about it.

Wait, this or something like it is already in CVS. Disregard me.

–ryan.

Hello

I try to load an ogg file from memory

I use this code:

Code:
SDL_RWops rw = SDL_RWFromMem(pBuffer, FileLenght);
Mix_Music
music = Mix_LoadMUS_RW(rw);

it seems that the file is loaded but the application crashes when I try to play it!

can Mix_LoadMUS_RW work with mp3 and wav?

thanks

MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng

It should do the same like: http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC55 http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC55

So: WAVE, MOD, MIDI, OGG, MP3, FLAC

Cheers, Tobias_____

Von: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] Im Auftrag von mandarx
Gesendet: Samstag, 13. M?rz 2010 19:17
An: sdl at lists.libsdl.org
Betreff: [SDL] Mix_LoadMUS_RW

Hello

I try to load an ogg file from memory

I use this code:

Code:

SDL_RWops rw = SDL_RWFromMem(pBuffer, FileLenght);
Mix_Music
music = Mix_LoadMUS_RW(rw);

it seems that the file is loaded but the application crashes when I try to play it!

can Mix_LoadMUS_RW work with mp3 and wav?

thanks

MandarX


http://mandarx.xoom.it/index.php?lang=eng http://mandarx.xoom.it/index.php?lang=eng

Tobias Leich wrote:

It should do the same like: http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC55 (http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC55)

thank you very much but I was talking about Mix_LoadMUS_RW not Mix_LoadMUS !!!

MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng

JeZ-l-Lee wrote:

Use OGG music format

is it good with loops?

I noticed that mp3s don’t work properly when you use loops------------------------
http://mandarx.xoom.it/index.php?lang=eng

Hi, i have noticed what you was talking about. And I thought that Mix_LoadMUS is just a wrapper around Mix_LoadMUS_RW like Mix_LoadWAV_RW is.

But if you read the SDL_mixer header file you will see:

extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);

/* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
Matt Campbell ( <mailto:matt at campbellhome.dhs.org> matt at campbellhome.dhs.org) April 2000 */
extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw);

BTW, you dont have to scream!!!

Cheers, Tobias_____

Von: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] Im Auftrag von mandarx
Gesendet: Samstag, 13. M?rz 2010 20:24
An: sdl at lists.libsdl.org
Betreff: Re: [SDL] Mix_LoadMUS_RW

Tobias Leich wrote:

It should do the same like: http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html#SEC55

thank you very much but I was talking about Mix_LoadMUS_RW not Mix_LoadMUS !!!

MandarX


http://mandarx.xoom.it/index.php?lang=eng

Tobias Leich wrote:

BTW, you dont have to scream!!!

sorry I didn’t want to scream :D------------------------
http://mandarx.xoom.it/index.php?lang=eng

Our experience on the Eternity Engine has been that the crashes
with MP3s are often related to the presence of tag metadata in the
MP3 file. If you have such data, (composer, album, track #, genre,
phase of the moon, etc.), try stripping it and see if that
improves the performance any.

We are also forced to recommend the use of OGG in preference to
MP3 to our end-users because of these problems.________________________________

From: mandarx at gmail.com
Date: Sat, 13 Mar 2010 10:17:06 -0800
To: sdl at lists.libsdl.org
Subject: [SDL] Mix_LoadMUS_RW

Hello

I try to load an ogg file from memory

I use this code:

Code:

SDL_RWops *rw = SDL_RWFromMem(pBuffer, FileLenght);

Mix_Music* music = Mix_LoadMUS_RW(rw);

it seems that the file is loaded but the application crashes when I try to play it!

can Mix_LoadMUS_RW work with mp3 and wav?

thanks

MandarX


http://mandarx.xoom.it/index.php?lang=eng


Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/210850553/direct/01/