gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > play a sound with Krawall

#79628 - Jau - Fri Apr 14, 2006 6:52 pm

If I have a file called secondpm.s3m and I get the output secondpm.s with the conversion tool, what do I have to do to play it?

kragInit( KRAG_INIT_STEREO );
krapPlay( /* what comes here? */, KRAP_MODE_LOOP, 0 );

#79863 - gauauu - Sun Apr 16, 2006 4:41 pm

Once you use the conversion tool, it should create a header file (samples.h or modules.h) that define variables for each song or sound effect. use the defined name for the song you want to play.

Code:

#include "modules.h"
krapPlay(mod_my_song, KRAP_MODE_LOOP, 0 );

#79876 - sumiguchi - Sun Apr 16, 2006 6:37 pm

I think that should be...
Code:

#include "modules.h"
krapPlay(&mod_my_song, KRAP_MODE_LOOP, 0 );
[/quote]

#79911 - gauauu - Mon Apr 17, 2006 1:55 am

Oh yeah, you're probably right.....

#79980 - Jau - Mon Apr 17, 2006 10:10 pm

ok thank you

#84777 - Toby - Wed May 24, 2006 6:31 pm

Hi,
do anybody know how to get a valid pointer to samples within a S3M-file? I have a modules.h and playing the music works fine, but now I want to play some samples seperatly which are included in the mod. Unfortuantely I only get a samples.h with some defines:
e.g.
#define SAMPLE_SMPBEATADDED 12
#define SAMPLE_OPTIONSHORTORGAN2 36
#define SAMPLE_OPTIONSHORTORGAN3 37

Thanks in advance...
Toby

#84867 - gauauu - Thu May 25, 2006 2:37 am

I don't have the computer with all my code handy (I'm in the process of moving), but if I remember right, you do:

Code:

kramPlay((Sample *)samples[SAMPLE_SMPBEATADDED] , 1 ,0);


where samples is defines in the samples.h that krawall gives you.

#84870 - sumiguchi - Thu May 25, 2006 2:45 am

If you don't see your samples in your samples.h - then the converter program may have stripped them out.
removed unused sample "name" or something like that.

I think this happens when you have a sample that is not a part of the song. To get around this, I generally create 1 mod just for effects. I do create a track and use each one of each of the effects just so converter doesn't strip them out.

Hope it helps....

#85036 - Toby - Fri May 26, 2006 5:44 pm

Thanks for the fast help guys. It works fine now. The converter produces an empty header-file, but this is okay...