Archived

This topic is now archived and is closed to further replies.

SDL MP3 Play Back, How?

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

Recommended Posts

I am trying to work out how to play back a mp3 within a Windows C++ app (well a very simple game). I can play back a midi file without problems the same with a wav file. The problem begins when I ask it to play a mp3 file. I am not sure if I need extra libs and dll''s to perform the task and if I do how to use them. I set up here: Mix_OpenAudio(44100, AUDIO_S16SYS,2, 2048); load here: Music[MUSIC_INGAME] = Mix_LoadMUS("blue.mp3"); MUSIC_INGAME is defined as 1 and I call it to play like so : Mix_PlayMusic(Music[MUSIC_INGAME],-1); All the code compile and runs but with no music. I am told something about SMPEG but cannot find what out how to get it or use it. Anyone help out here??? Thanks for your time.

Share on other sites
What''s the exact error you are getting?

Share on other sites
I am not getting an error as such, I just get no sound at all. I am not sure what other files i need to include for mp3 support.

I include these files#include <stdlib.h>#include <time.h>#include <vector>#include <SDL.h>#include <SDL_ttf.h>#include <SDL_mixer.h>in my .h file and then in my main .cpp file#ifdef WIN32#pragma comment(lib, "SDL.lib")#pragma comment(lib, "SDLmain.lib")#pragma comment(lib, "SDL_ttf.lib")#pragma comment(lib, "SDL_mixer.lib")#endifI have these set up at the top.

I am sure there is something missing but i can find no information or tutorials about using SDL_mixer for mp3 play back.

Share on other sites
Have a look here and use the error handling code it gives, if it gives an error post it here.

Share on other sites
Personally id just use fmod

http://www.gamedev.net/reference/articles/article2098.asp

[edited by - shade13 on June 10, 2004 12:16:06 PM]