Welcome! Log In Create A New Profile

Advanced

SDL_mixer problem

Posted by Jaklub 
SDL_mixer problem
November 24, 2010 04:31PM
Hello. Sound in Wii homebrew is a tough nut to crack. I got Asndlib working few months ago, but it certainly isn't a comfortable solution. Looking for a way to load and play wav sounds from SD card, I stumbled across SDL_mixer. Now I'm trying to implement it into my project. However, just after
adding
#include SDL/SDL.h
#include SDL/SDL_mixer.h
^ I know there should be < and > signs, but adding them makes the text not show up in browser
to my wrapper's header and compiling it, the boot.dol file is only 600KB size (instead of over 1600KB like it was before) and starting it on console results in return to Homebrew Channel menu.
What could be the cause of this problem? Thanks in advance.



Edited 1 time(s). Last edit at 11/24/2010 04:32PM by Jaklub.
Re: SDL_mixer problem
November 24, 2010 06:05PM
SDL replaces the main function with it's own version. That might be causing problems for you.

SDL can only playback 48khz or 32khz. As most audio is stored 44100khz this might cause problems for you. Just a warning.


After not even getting ASND to work I just build my own software only mixer. Which seems to function quite well on the Wii.
Re: SDL_mixer problem
November 24, 2010 06:38PM
Oh my, it is more complicated than it looked like. Changing main to SDL_main does nothing. And SDL just doesn't work with GRRLIB (I tried not to initialize SDL itself, that's why I didn't have those errors before).
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiivideo.o): In function `WII_VideoInit':
c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiivideo.c:279: multiple definition of `xfb'
c:/devkitPro/libogc/lib/wii\libgrrlib.a(GRRLIB_core.o):(.sbss.xfb+0x0): first defined here
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main':
c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:53: multiple definition of `main'
c:/devkitPro/libogc/lib/wii\libjpeg.a(cjpeg.o):cjpeg.c:(.text.main+0x0): first defined here
I guess I'll have to stick to Asndlib. If anyone knows a better/simplier way to play sounds, please let me know.

Thanks for help.
Re: SDL_mixer problem
November 24, 2010 07:39PM
Can you post some code on what you're trying to do / what formats you are playing?

ASND is very easy to use and I'm interested in the SDL errors, you should not be seeing those.

For SDL examples check out SuperTux :- [code.google.com]

If you want to go with asnd let use know I can post some examples. If you're just trying to play PCM's then go with asndlib.
Re: SDL_mixer problem
November 24, 2010 07:51PM
I have just entirely got rid of SDL in my project trying to get Asndlib playing sounds from files, but above you have all the errors I had.
I want to play wav files on Wii, but with Asndlib it seems like a hard task and I have to use raw files.
Anyway, some details about what I've tried to do with SDL (I still would like to use it instead of Asndlib, but I think it may be not possible because of errors).
Library section in makefile:
LIBS	:= -lgrrlib -lfreetype -lpngu -lpng -ljpeg -lz -lfat
LIBS	+= -lwiiuse
LIBS	+= -libSDL_mixer -libSDL
LIBS	+= -lbte -logc -lm
In two files (dumb.cpp and dumb.h) that are included in every other source files I've included
#include SDL/SDL.h
#include SDL/SDL_mixer.h
(like before no < and > in code above because it doesn't show up in browser)
Initialization code:
SDL_Init(SDL_INIT_AUDIO); // without this line it spits out 600KB dol file, with this line there are errors mentioned above
Mix_OpenAudio(22050,AUDIO_S16,2,4096);
End code:
Mix_CloseAudio();
SDL_Quit();
When it didn't give any errors, boot.dol didn't do anything when started on console and had 600KB size, like I mentioned.

yet another edit: Been browsing SuperTux code and I think Makefile correction might fix this. Not sure, though
edit 4: Moved SDL libs to the top:
LIBS	:= -lSDL_mixer -lSDL
LIBS	+= -lgrrlib -lfreetype -lpngu -lpng -ljpeg -lz -lfat
LIBS	+= -lwiiuse
LIBS	+= -lbte -logc -lm
Still not working.
c:/devkitPro/libogc/lib/wii\libgrrlib.a(GRRLIB_core.o):(.sbss.xfb+0x0): multiple definition of `xfb'
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiivideo.o):c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiivideo.c:279: first defined here
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main':
SDL_wii_main.c:(.text.main+0x98): undefined reference to `KEYBOARD_Init'
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiievents.o): In function `PumpEvents':
c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:60: undefined reference to `KEYBOARD_GetEvent'



Edited 5 time(s). Last edit at 11/24/2010 08:02PM by Jaklub.
Re: SDL_mixer problem
November 24, 2010 09:17PM
Yes there's a conflict :-

SDL - SDL_wiivideo.c

unsigned int *xfb[2] = { NULL, NULL }; // Double buffered

I guess that's already defined in GRRLIB.

As for the others you need to add

LIBS += -lwiikeyboard

That should take care of "SDL_wii_main.c:(.text.main+0x98): undefined reference to `KEYBOARD_Init'"

If you are compiling SDL yourself you can easily modify it to work. Also you will probably get a bunch of other linker errors once you solve this issue.... I believe SDL mixer requires linking -lsmpeg and -lvorbisidec.

If this is a Wii specific project then and you are not interested in Ogg or MP3 don't use SDL_mixer. The other option would be to use SDL for the graphics and remove GRRLIB. I personally use SDL for ports and in projects so I can cross compile.

GRRLIB is a far better/faster way to render on Wii and does not eat memory like WiiSDL but the project is then Wii only.
Re: SDL_mixer problem
November 24, 2010 10:46PM
Thanks for your help. All I have is GRRLIB source (it's delivered in package). I replaced every single xfb there with grr_xfb.
After some fixes and researching, it works.
Sorry, only registered users may post in this forum.

Click here to login