"Audio device hasn't been opened" - Not clear how to open the device.
billyninja opened this issue · comments
I'm a noob with SDL2, but I've tried several ways to init audio/open device and then play a .mp3, none worked. The sinewave example works fine.
Is this working? Can someone provide a minimum example?
I added some missing functions to the package. Could you try the audio_mp3
example I added? If it doesn't work, try the C version with gcc audio_mp3.c -lSDL2 -lSDL2_mixer
if you're on Unix system.
In both, C and Go, I'm getting "Mixer not built with MP3 support" when it tries to init the mixer with INIT_MP3.
Thanks for the feedback!
Ah, in that case you need to install SDL2 from source. Not sure if this is a problem on Mac and Windows.
- Download the source code for SDL2 and SDL2_mixer at http://libsdl.org/download-2.0.php and https://www.libsdl.org/projects/SDL_mixer/ and unpack them.
- Go to SDL_mixer's folder and inside external/smpeg2-2.0.0/ folder, run
./autogen.sh
then./configure
followed bymake
and finallysudo make install
. This is to enable MP3 support when you're compiling SDL_mixer. - Run the same command for SDL2 and SDL2_mixer folder. You might want to use
make -j8
instead ofmake
to make compilation faster (the -j number is usually double the number of your processor cores). - Remove SDL2 and SDL2_mixer if you installed from package manager.
I am use win10.
Do you know where to get the run time lib of SDL2 & SDL_Mixer to support MP3 directly? Thanks.