[SDL] problems loading ogg and wav music.

James Barrett xucaen at gmail.com
Sun Dec 23 17:47:32 PST 2007


I tried loading my ogg music file along with my other sound effects.
The program no longer crashes, but the music does not play. Sound
effects play just fine. Is there some reason why SDL_mixer will play
one ogg file and not  another? Am I doing something wrong or is there
a bug in SDL_mixer?


James Barrett wrote:
> 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
>>
>>
>>
>>
>>  




More information about the SDL mailing list