SDL_Mixer NOT WORKING??

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

SDL_Mixer NOT WORKING??

Post 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
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: SDL_Mixer NOT WORKING??

Post by dandymcgee »

Did you call SDL_Init(), is the library linked properly, can you hear sounds form other sources?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: SDL_Mixer NOT WORKING??

Post by tappatekie »

Suck if you realised your speakers weren't plugged in :L
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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??
Image
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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:
Image
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: SDL_Mixer NOT WORKING??

Post 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?
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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
Image
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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!!!
Image
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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.
User avatar
lalacomun
VS Setup Wizard
VS Setup Wizard
Posts: 114
Joined: Wed Dec 28, 2011 10:18 pm
Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
Programming Language of Choice: C++
Location: Argentina
Contact:

Re: SDL_Mixer NOT WORKING??

Post 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:
Image
Post Reply