Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Audio device hasn't been opened" - Not clear how to open the device. #148

Closed
billyninja opened this issue Aug 3, 2015 · 4 comments
Closed

Comments

@billyninja
Copy link

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?

@aqiank
Copy link

aqiank commented Aug 4, 2015

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.

@billyninja
Copy link
Author

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!

@aqiank
Copy link

aqiank commented Aug 4, 2015

Ah, in that case you need to install SDL2 from source. Not sure if this is a problem on Mac and Windows.

  1. 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.
  2. Go to SDL_mixer's folder and inside external/smpeg2-2.0.0/ folder, run ./autogen.sh then ./configure followed by make and finally sudo make install. This is to enable MP3 support when you're compiling SDL_mixer.
  3. Run the same command for SDL2 and SDL2_mixer folder. You might want to use make -j8 instead of make to make compilation faster (the -j number is usually double the number of your processor cores).
  4. Remove SDL2 and SDL2_mixer if you installed from package manager.

@aqiank aqiank closed this as completed Aug 7, 2015
@ScottHuangZL
Copy link

I am use win10.
Do you know where to get the run time lib of SDL2 & SDL_Mixer to support MP3 directly? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants