Loading an MP3 using SDL_mixer
Hwo can I load an MP3 using SDL_mixer, I can't figure it out because unlike SDL_image, teher isn't one big functions for loading all sounds.
Here's what I have audio-wise.
what am i doing wrong?
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO );//...Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);//...Mix_VolumeMusic(50);Mix_Music *tap = Mix_LoadMUS("click.mp3");//...Mix_PlayMusic(tap, 1);
what am i doing wrong?
Quote:
The mixer can currently load Microsoft WAVE files and Creative Labs VOC files as audio samples, and can load MIDI files via Timidity and the following music formats via MikMod: .MOD .S3M .IT .XM. It can load Ogg Vorbis streams as music if built with the Ogg Vorbis libraries, and finally it can load MP3 music using the SMPEG library.
I found that statement in the docs - I too tried to load a .mp3 and it didn't work right. If I find a fix I will let you know.
- Drew
[edit] From what I have read, it is better to use FMOD or SDL_Sound (as mentioned here for mp3 playback). I hope this helps! [/edit]
[Edited by - Drew_Benton on December 22, 2004 11:48:17 AM]
Instead of meddling with SDL_Mixer, I'd suggest checking out FMod. It's very easy to use and very powerful.
Here's a tutorial that uses SDL_mixer to load an Ogg file:
http://gpwiki.org/index.php/C:Using_SDL_mixer_to_Play_an_OGG_Music_File
Loading an MP3 file is analogous. Let me know if you have any trouble!
Ryan
http://gpwiki.org/index.php/C:Using_SDL_mixer_to_Play_an_OGG_Music_File
Loading an MP3 file is analogous. Let me know if you have any trouble!
Ryan
--Visit the Game Programming Wiki!
I had trouble with MP3s as well when using SDL_Mixer so I just switched to OGG files. I used GoldWave to convert them, its a free audio utility found at http://www.goldwave.com/.
Quote:
Original post by Rob Loach
Instead of meddling with SDL_Mixer, I'd suggest checking out FMod. It's very easy to use and very powerful.
I agree.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
I just decided to convert the MP3s to WAVs becaus SDL supports those by default =P.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement