[SDL] problems loading ogg and wav music.

James Barrett xucaen at gmail.com
Sun Dec 23 00:16:33 PST 2007


Update: I downloaded souce, built and installed SDL_mixer v1.2.8. I
don't know if there are conflicts with this version and the version of
SDL I have installed.

I read in SDL_mixer.h that this method /Mix_LoadMUS_RW() / loads "Ogg
and MikMod specific currently" So I tried loading the ogg music file
with these two lines. I do not know if I have this correct:
    SDL_RWops* rw = SDL_RWFromFile(p.resourceName.c_str(), "rb");
    m = Mix_LoadMUS_RW( rw );

I don't get an error (m is not null) so I assume that the file is being
load ok.

Both  Mix_FadeInMusic() and Mix_PlayMusic() crash without returning.


Then, when attempting to load a wav music file with the above two lines
of code, Mix_GetError() returns "Module format not recognized"

I don't know what that means. I can't find any documentation on it.

Jim


James Barrett wrote:
> Hi, I am trying to open an ogg file with Mix_FadeInMusic().  I could not
> find an entry at http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fmixer for
> this function, so I looked in the SDL_mixer.h file. I see  Mix_MusicType
> enum with a MUS_OGG type so I assume that SDL_mixer does support ogg
> music files. But the program crashes as soon as the call to
> Mix_FadeInMusic() is made, and nothing after it. It never even gets to
> the next line that prints the Mix_GetError() to stderr. So I'm not sure
> what I did wrong. No error is produced when I load the file with
> Mix_LoadMUS() so I assume it is reading the file ok.
>
> Then another problem occured. I exported the  ogg file (with audacity)
> as a wav file, and now Mix_LoadMUS() can't load the file. Output from
> Mix_GetError() is "Unable to load WAV file".
>
> I am running Debian Linux (Etch) with stable deb packages fro SDL and
> SDL_mixer.
> SDL 1.2.11-8
> SDL_mixer 1.2.6-1.1+b2
>
> I am able to load and play ogg sound effects with Mix_LoadWAV and
> Mix_PlayChannel()
>
>
> Jim
>
>
>
>
>   

-- 
I am RETRO Sci Fi
Geeky Tech Guy
http://www.geekytechguy.net
Ham it up! kb1odg



More information about the SDL mailing list