SLD_LoadMUS hangs with OGG files !!

Started by
2 comments, last by samuraicrow 16 years, 10 months ago
Hi, i have a very annoying problem with SDL Audio & the Mix_LoadMUS() procedure. To tell it shortly : when trying to load an OGG file, the program hangs (not if i use a WAV file instead !!). I'm using MS VisualC++ 2005 and the latest version of SDL (downloaded a few days ago from the official site). The code i'm testing comes from various examples found here in GameDEV; i started to think i was missing some initialization routines, so i found a short and simple C++ program on the Game Programming Wiki, i downloaded and compiled it (with no compiler warnings at all), and i got exactly the same problem (the program, with an explanation article & related OGG file, can be found and downloaded at the address http://gpwiki.org/index.php/C:Using_SDL_mixer_to_play_an_Ogg_music_file). When i run it, Visual Studio gives me an error related to a Win32 exception, saying "Unhandled exception at 0x...... in testy2.exe: 0xC0000005: Access Violation in writing at location 0x000000010" (translated from Italian, on english-language versions of VS it may appear actually slighty different, but you should get the picture). ('testy2.exe' is my program's name, for those that didn't figure out that ;) If i ask for debugging, the interrupted instruction is at the following row : if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) (the calling procedure stack shows 'ntdll.dll' as the first linked module in the list) Note that i can play any OGG file with a standard music player, even the one supplied with the above example program. WAV files work fine (even long ones), OGGs don't : my programs simply hang. But i CAN play any OGG file from a multimedia player. Any suggestions, please ? Thank you !!
Advertisement
Are you linking in all of the correct linker libraries? If you're playing .OGGs under SDL_mixer, make sure you're linking with SDL_mixer, libogg, and libvorbis. (I think those are the ones that are needed anyway.) If that's not the problem post back here.
I'm a bit confused about the library to use. Actually, i'm linking the source code with the SDL.LIB & SDL_MIXER.LIB files; compiling it won't give errors (so all the required routines implementation is found in these libs, am i right ?). Anyway, i tried to link the LIBVORBIS.LIB & LIBOGG.LIB too, altogether with the above mentioned LIBs. Still no compiler errors, but the program hangs anyway.
I did a little research on the net, and i found a couple of sites where other people said to have the same, identical problem as me, but the solution wasn't there.
I'm VERY frustrated about this, because i found the SDL library simple to use...Moreover, it is free...
Other infos : i link the program with the VORBIS.DLL, VORBISFILE.DLL, SDL_MIXER.DLL, OGG.DLL & SMPEG.DLL files (maybe this one is used by MP3s, so it doesn't matter really...). To get more informations about the error, i looked for the implementation code of these DLLs in Internet, but unsuccessfully (i can get the source code to compile the LIBS from official sites, but not the DLLS). I'm using SDL_MIXER version 1.2.7, the latest i guess; this version uses dynamic linking, that's it loads DLLs modules as they're required...
I was thinking about using OpenAL instead, although i have to check if it can play OGGs, if it is free, if it has complications to mix multiple playing sounds/music and, very important to me, if it can stream OGGs instead of loading them fully into memory (mix_loadmus DOES this, this is why i'd like to use it !!! ;( ).
Can you load OGGs file from your sdl_mixer implementation ? On the next days, i could put the source code, executable file and used DLLS/LIBS somewhere on the net available to download; if somebody could just try to run the executable and report to me if it hangs with his/her computer too, it would be very appreciated...
Thank you and good bye !!
What order are you linking the libraries in? If it were a linker error, I'd think it would give an error message but I'm not sure about that. Order is significant in linker libraries, though, and the ones with the most dependencies should be linked first.

libsdl, sdl_mixer, libogg, and libvorbis should be all you need. (...In that order.)

Also, the latest versions of Visual Studio are known to have problems with SDL. You might have to reconfigure Visual Studio not to use .NET or use Tao Framework with managed code.

If all else fails with Visual Studio, you could download the Code::Blocks editor and MinGW compiler for free and use that instead.

-edit-
Before you ditch the compiler, why not try loading your .OGG file into an editor and re-saving it as a stereo or non-stereo file (whichever one it wasn't to start with). I've heard that SDL_mixer can sometimes be picky about the TYPES of .OGG files it will play.

This topic is closed to new replies.

Advertisement