Page 1 of 1

SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 5:33 pm
by lalacomun
Hi all its just that i am testing music on my engine but it wont play anything, the files are in the same folder, allready checked the Mix_GetError() and i dont have any, i tryed both .mp3 and .ogg and both of them didnt work. i tried making a basic program that just play music and it didnt worked either, but the mysterious thing is that i found a pen drive with old projects with SDL_Mixer and they worked! WTF??

PD: I have al dlls in the folder and i use code::blocks as IDE

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 7:17 pm
by dandymcgee
Did you call SDL_Init(), is the library linked properly, can you hear sounds form other sources?

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 7:19 pm
by tappatekie
Suck if you realised your speakers weren't plugged in :L

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 7:32 pm
by lalacomun
dandymcgee wrote:Did you call SDL_Init(), is the library linked properly, can you hear sounds form other sources?
Yes, SDL is initialized, and yes its linked properly, and as i said before, i tried making a new project that just loads and play music and it didnt worked, but then i open a old file with a program that played music and it worked, i copy the exact same code innto a new project file but it didnt worked and by the way the old proyects(the ones that worked) were imported from devc++ to code::blocks, any suggestions??

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 7:33 pm
by lalacomun
tappatekie wrote:Suck if you realised your speakers weren't plugged in :L
LOL but for my disgrace i have a laptop :evil:

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 7:59 pm
by Ginto8
If you copied the same exact source, recompiled it, and it didn't work, it's almost definitely a linkage error. Are the .dll's in the correct place for runtime?

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 8:28 pm
by dandymcgee
lalacomun wrote:any suggestions??
Are you checking the return value of the function? Does it return a success value as if nothing went wrong?

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 8:31 pm
by lalacomun
Ginto8 wrote:If you copied the same exact source, recompiled it, and it didn't work, it's almost definitely a linkage error. Are the .dll's in the correct place for runtime?
yes i think so :p

these are the dlls i have:

libfreetype-6.dll
libogg-0.dll
libvorbisfile-3.dll
libvorbis-0.dll
SDL.dll
SDL_mixer.dll
SDL_ttf.dll
smpeg.dll
zlib1.dll
libfreetype-6.dll

hehehe correct me if there is some missing

and in the linkers i have -lSDL_mixer for the mixer, and the lib folder of SDL where i have the libs of mixer, ttf, and image

but the programs where the mixer worked are imported from devc++ to code::blocks i dont know if that make any difference but just saing

Re: SDL_Mixer NOT WORKING??

Posted: Thu May 03, 2012 8:34 pm
by lalacomun
dandymcgee wrote:
lalacomun wrote:any suggestions??
Are you checking the return value of the function? Does it return a success value as if nothing went wrong?
actually yes, i use the following code

Code: Select all

 if (music1 == NULL)
    {
        fprintf(stderr, "Unable to load audio: %s\n", Mix_GetError());
    }  

Code: Select all

if(Mix_PlayMusic(music1, -1) == -1) {
    printf("Unable to play music file: %s\n", Mix_GetError());
    return 1;
  } 
and the same thing with the Mix_OpenAudio and guess i have no errors!!!

Re: SDL_Mixer NOT WORKING??

Posted: Fri May 04, 2012 10:08 am
by TheBuzzSaw
I gave up on SDL_Mixer. I reached a point where it flat out would not work in either Linux or Windows. Plus, even when it was working, the program added like 3 full seconds to both startup and shutdown of the program. I moved to OpenAL, which turned out to be much simpler to setup than I originally thought. The Internet is simply devoid of decent OpenAL tutorials.

Re: SDL_Mixer NOT WORKING??

Posted: Fri May 04, 2012 11:19 am
by lalacomun
TheBuzzSaw wrote:I gave up on SDL_Mixer. I reached a point where it flat out would not work in either Linux or Windows. Plus, even when it was working, the program added like 3 full seconds to both startup and shutdown of the program. I moved to OpenAL, which turned out to be much simpler to setup than I originally thought. The Internet is simply devoid of decent OpenAL tutorials.
yes, in my first program with SDL_Mixer i remember i needed to wait like 5 secs until the music started playing :shock: :shock:

i think i am going to start with OpenAL :mrgreen: