User talk:Titmouse

From WiiBrew
Jump to navigation Jump to search

Hi. I saw a post you made last year on the forum (,65351,65408#msg-65408 ) where you said you were able to get gcmodplay to work with asndlib instead of aesndlib.

Well, I've hit a similar annoying problem as the one you experienced.... I can't use MOD files and MP3 or OGG files in the same game, because gcmodplay was changed to use aesnd but everything else uses asnd (why in the world did they do that?). At least I was able to use chris's example code to get sound effects working with aesnd, but it sucks that any music file not in MOD format has to be converted to RAW to be used with aesndlib!

How hard is it to get gcmodplay to use asndlib again? I really don't know about rebuilding anything.... I don't suppose it's as easy as replacing certain files with the rebuilt ones? --Mr. Reaper 05:44, 24 July 2012 (CEST)

Hi Reaper, Just spotted your post

However I stopped using that mod player some time back as I found a new one called GRRMOD (its playback is far better) here's my code that uses it , it includes the GRRMOD lib I’ve tweaked. This new Lib is under “Extra_libs_needed.Source”

I posted this about it…,69350,69350#msg-69350 Note: My project's a Mercurial repository; source tab says what to do to get code (TortoiseHg works well for me)

If you still need to use gcmodplay drop me another line and I’ll post up a working example or something.

GRRMOD looks good... I could use the ability to play MOD, MP3, and XM files, but I really am lost as far as knowing how to implement it.... I got Devkitpro and GRRlib installed of course -- I can use them, but I don't really understand how it all works, heh. Is it difficult to install your modified GRRMOD (and modified aesnd) on top of that (if it's not too much trouble)?
Would it be easier to get gcmodplay to co-exist with the ability to play MP3 files? --Mr. Reaper 21:48, 28 July 2012 (CEST)

Probably easier to use GRRMOD - I’ve compile the grrmod lib without MP3 support as the MP3 stuff was said not to be completed by the chaps developing it. For mp3 type technology I use Ogg vorbis, take a look at tremor for playing oggs. I tend to stay away from mp3 as things like oggs are far better quality while taking up less disk space. Have a look at tremor for the wii (example oggplayer.cpp/h in my Bolt Thrower code) *** But leave this to last, get grrmod working first **

GRRMOD comes with a working demo, I’ve changed a bit, now just plays music with a blank screen as it had dependences on graphics stuff I did not want to use, see: \Extra_libs_needed.Source\Source\GRRMOD\Source\main.c, in my bolt thrower google code To install GRRMOD just copy the files, grrmod.h & libgrrmod.a (from GRRMOD dir, make sure to use my updated grrmod lib from Google code, not the official one!!!) to C:\devkitPro\libogc\include\grrmod.h C:\devkitPro\libogc\lib\wii\libgrrmod.a (example is default path)

Use the main.c demo as starting point (I’ve just upload a fix to this demo as this did not compile, download a fresh version if need be)

your makefile should look something like this ...

LIBS := -lfat -lvorbisidec -lpng -lz -lgrrmod -lwiiuse -lbte -laesnd -logc -lm

Let me know how you get on :) --Titmouse 17:04, 29 July 2012 (CEST)

Thanks for the instructions. I downloaded the two files and put them in place, and got the main.c, then set up the makefile as above, but it won't compile. I get:

c:/projects/grrmod/source/main.c:19:23: fatal error: music_mp3.h: No such file or directory

I must still be missing something.

I found I didn't have the lvorbisidec you said should be in the makefile, so I went ahead and got that from Extra_libs_needed.libs/libogc/lib/wii/libvorbisidec.a and copied to my lib/wii folder too.

EDIT: Oh! I realised that the error I'm getting is because I need to have some song files (mp3/mod/xm/etc.) in a data directory to be converted to header files for inclusion in the compiled DOL.

So to compile this GRRMOD test, you also need the files in a "data" directory:

music.mp3 music.xm music.mod music.s3m

Or comment out both lines in main.c (one will be the #include, the other is in the PLAYLIST) that refer to each file format you don't need (like mp3), and then you only need the above files in the formats you want.

Also, did you update something in aesnd? Do I need to update that too?

Ok, I got the example main.c compiling and working correctly. Thanks! Unfortunately for me, it won't play the XM file that I wanted to use! It just freezes up and makes a loud noise.... It works with a different XM file though... so there must be some issues with certain files.

I will have to convert that XM to an OGG I guess (massive increase in file size, but still better than having to convert it to RAW as I'm currently doing!)... so my next question is... How do I implement the OGG playback? I'll try to look at the Tremor thing in your google code, but if you have any more helpful tips and easy instructions, you could post them here for the benefit of anyone else who wants to use these things. Thanks! --Mr. Reaper 01:27, 30 July 2012 (CEST)

Hi Reaper, take a look in the devkitpro examples.

devkitPro\examples\wii\audio\oggplayer + working demo as template.c (I rewrote that oggplayer.c since the code was on the fudged side, it works just fine as it is - I just rewrote it so I could understand how the whole thing worked)

As for aesndlib you probably don't need my changes to aesndlib.c, see,68659,68659. I find AESND_AllocateNextFreeVoice(...) very useful in my games, since it will give you a free voice something the old sound lib use to provide, I prefer to dynamical pop off my sounds as it simplifies everything no end.

BTW what was the name of the XM file it could not play, I'll give it a go here to see if anything can be done.

The problem is that the OGG player that comes with Devkitpro still uses asnd, and of course asnd won't work in the same game along with aesnd (which is used by either gcmodplay or grrmod). I haven't looked at it in detail, other than noticing that it's using -lasnd and asndlib.h ... Is there a way to get it to work with aesnd?
Or... do I need to install Tremor ?
Hm, in my game I am just using some statically assigned sound channels, as sometimes I want to interrupt a long sound with another sound... although sometimes it glitches out, and the long sound refises to stop playing when I tell it to..... I've found a similar problem with MOD files using either gcmodplay or grrmod.... Like in the grrmod example, it has buttons 1 and 2 for "start" and "stop" playing the sound. If you keep pressing 1,2... 1,2... 1,2.... eventually the sound will glitch out when you press "stop" and repeat a note over and over, and will refuse to stop playing (whether by Stop or Pause) until you start it over or start a new song.... I know you don't usually start and stop a sound 50 times in a game, but after playing my game many times, I'd randomly get that sound glitch. The way I work around it now it to never actually "stop" a MOD file from playing until I am ready to start up a new one, and instead I turn the volume of the music down to 0 and let it keep playing! That avoids having the sound glitch out anyway... But I'm getting off topic :)
Here is the XM file that glitches out grrmod (haunted.xm):
I'm using it as the intro music for my game. Looks like I'll probably have to convert it to OGG (once I get that working too), but if you can figure out why it doesnt work, that would be even better (I don't have high hopes though -- probbly just grrmod can't handle something weird about the file).... --Mr. Reaper 01:14, 31 July 2012 (CEST)

Ahh yes that was probably another reason why a rewrote oggplayer.c, my version of oggplayer.cpp uses aesndlib, so it’s in c++ and it does need tremor for it to work. Do you need it in plain c?

I suspect the sound issues are a result of calling something like AESND_AllocateVoice, you will run out of voices if you never free them. For example Tower Defense has this type of bug when picking tunes as it just allocates and never free the voices playing the music.

For the xm - Not sure but maybe you could try loading the XM into a music editor or something and save it out again, might have something like a 'make it very compatible' option in the save, but I’m guessing such a thing exists. --Titmouse 21:23, 31 July 2012 (CEST)