# SMPEG, SDL_mixer, and MP3s

This topic is 4877 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

okay, I'm trying to get SDL_mixer to play MP3s. I got smpeg and built it and added it's lib to my linker and included "smpeg.h". SI teher anything more I need to do to play MP3s on SDL_mixer? Plus, in the SDL_mixer header, there is a MIX_LoadMUS_RW() but for soem reason I'm having problems usign it. CAN I GET HELP!!!

##### Share on other sites
If you want to use MP3's you will have to use SDL_Sound. If you still want to use SDL_Mixer, you must use OGG Voribs files. It's just a matter of re-encoding the files to go from mp3->ogg. Using OGG files are as simple as looking at Lesson 6 from Cone3D and replacing:
// Load in the musicmusic = Mix_LoadMUS("data/sound/(sblu)moon6.xm");// With //// Load in the musicmusic = Mix_LoadMUS("Your file.OGG");

As for SMPEG, to the best of my knowldege, I do not know anyone that has gotten it to work correctly on the Windows platform. As for SDL_SOund, I've never used it before, but I'd say go with OGG + SDL_Mixer. OGG files are license free, compared to MP3s and are of the the same quality if not better than them. They just have not caught on yet since MP3 has been around for so long.

##### Share on other sites
someone said rebuld SDL_mixer and go to
the project settings and add MP3_MUSIC to the defines and add smpeg.lib to
the libraries. I don't knwo how to add defines though in vc7. I think this is a similar problem with Mix_LoadMUS_RW because around that function it says
#ifdef USE_RWOPS /* This hasn't been hooked into music.c yet */
and for the MP3 syuff, it:
#ifdef MP3_MUSIC
#include "smpeg.h"

static SDL_AudioSpec used_mixer;
#endif

so how do I add these defines?

##### Share on other sites
has anyone built SMPEG and SDL_Mixer with MP3 and Mix_LoadMUS_RW support? It'd be great if you just sent me your premade stuff.

##### Share on other sites
Quote:
 Original post by YamianI don't knwo how to add defines though in vc7. So how do I add these defines?

I don't have my VS7 right now, but I think it's Project->Settings->C/C++ Tab->Preprocessor then in the Preprocessor Definitions box add in the define you need to add, so it might end up looking like: WIN32;_DEBUG;_CONSOLE;MP3_MUSIC

##### Share on other sites
yes you were correct, thx Drew.

Adding it to the project's defines did nothing, but adding it to music.c is making all sorts of things happen. If I just add smpeg.lib to the project libraries and MP3_MUSIC, then I can play MP3s with SDL_mixer!! But Now I have to get SDL_LoadMUS_RW to work here si what I have so far that is diffrent from default.

All the defaults of VisualC in SDL_mixer 1.2.6
-Added mikmod.lib, native_midi.lib, timidity.lib, ogg_static.lib, vorbis_static.lib, vorbisfile_static.lib, and smpeg.lib.
-added MP3_MUSIC, USE_RWOPS, and LIBMIKMOD_MUSIC to the defines
and I'm getting

------ Build started: Project: SDL_mixer, Configuration: Release Win32 ------Linking...mikmod.lib(mplayer.obj) : error LNK2005: _Player_SetSynchroValue already defined in music.objmikmod.lib(mplayer.obj) : error LNK2005: _Player_GetSynchroValue already defined in music.objmikmod.lib(mplayer.obj) : warning LNK4006: _Player_SetSynchroValue already defined in music.obj; second definition ignoredmikmod.lib(mplayer.obj) : warning LNK4006: _Player_GetSynchroValue already defined in music.obj; second definition ignored   Creating library .\Release/SDL_mixer.lib and object .\Release/SDL_mixer.expLINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library.\Release/SDL_mixer.dll : fatal error LNK1169: one or more multiply defined symbols foundBuild log was saved at "file://c:\Documents and Settings\Joe\My Documents\SDL_mixer-1.2.6\VisualC\Release\BuildLog.htm"SDL_mixer - 3 error(s), 3 warning(s)---------------------- Done ----------------------

anyone want to try this themselves? I'll try to put in a link to my project.

##### Share on other sites
http://home.comcast.net/~joobot/SDL_mixer_project.rar

##### Share on other sites
Quote:
 Original post by Drew_BentonIf you want to use MP3's you will have to use SDL_Sound. If you still want to use SDL_Mixer, you must use OGG Voribs files.

I'm sorry but this is absolutely not true. From the Official SDL_mixer documentation:

Quote:
 SDL_mixer supports playing music and sound samples from the following formats:- WAVE/RIFF (.wav)- AIFF (.aiff)- VOC (.voc)- MOD (.mod .xm .s3m .669 .it .med and more) using included mikmod- MIDI (.mid) using timidity or native midi hardware- OggVorbis (.ogg) requiring ogg/vorbis libraries on system- MP3 (.mp3) requiring SMPEG library on system- also any command-line player, which is not mixed by SDL_mixer...

I have personally played both .ogg and .mp3 files in my game with the audio engine I wrote using SDL_mixer and there were absolutely no problems playing either. If you'd like I can help (although I haven't touched audio code in a while), or if you want to see how my audio engine is constructed you can view the source here and the header here. It's a bit much if you are only trying to write simple "load & play" demo code, but (I think) it's a good example.

##### Share on other sites
Okay I'm not sure but I think the problem is Player_SetSynchroValue is defined in mikmod but is beign redefined in SDL_mixer. Here ar the two definitions in mikmod

void Player_SetSynchroValue(int i)
{
_pl_synchro_value = i;
}

and here it is in SDL_mixer:

void Player_SetSynchroValue(int i)
{
fprintf(stderr,"SDL_mixer: Player_SetSynchroValue is not supported.\n");
_pl_synchro_value = i;
}

what should I do? remove it from SDL_mixer or is teher a way to have it override the first one without an error?

##### Share on other sites
OMG I GOT IT!!! There was a Player_GetSynchroValue(with GET) and a Player_SetSynchroValue(with a SET) and I just remove dtheir definition from SDL_mxier and IT WORKS!!! I CAN NOW LOAD MP3s FROM ARCHIVES!!!

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009489
• ### Who's Online (See full list)

There are no registered users currently online

×