I'd like some clarification on defining sound effects in a .res file.
The docs explain the format like this:
Code: Select all
WAV name wav_file [driver [outrate]]
Code: Select all
XGM track1 "Casino Funk Zone.vgm"
XGM comix_zone_dfm_export "comix_zone_dfm_export.vgm"
WAV explode_16k "explode.wav" 2
WAV snare1_14k "snare1.wav" 5
WAV cri_14k "cri.wav" XGM
Code: Select all
#include <genesis.h>
#include "music.h"
static u16 joyState;
static u16 buttonsPressed;
static void joyEvent(u16 joy, u16 changed, u16 state)
{
u16 pressed = changed & state;
joyState = state;
// keep buttons state
if (buttonsPressed != state)
{
buttonsPressed = state;
// reset press time
}
// PCM 1
if (pressed & BUTTON_X)
{
XGM_startPlayPCM(64, 1, SOUND_PCM_CH2);
}
// PCM 2
if (pressed & BUTTON_Y)
{
XGM_startPlayPCM(65, 1, SOUND_PCM_CH3);
}
// PCM 3
if (pressed & BUTTON_Z)
{
XGM_startPlayPCM(66, 1, SOUND_PCM_CH4);
}
}
int main()
{
buttonsPressed = 0;
XGM_setLoopNumber(-1);
XGM_setPCM(64, explode_16k, sizeof(explode_16k));
XGM_setPCM(65, snare1_14k, sizeof(snare1_14k));
XGM_setPCM(66, cri_14k, sizeof(cri_14k));
JOY_setEventHandler(joyEvent);
XGM_startPlay(&track1);
while(1)
{
VDP_waitVSync();
}
return (0);
}
I wonder if it has something to do with playing sounds in mono/stereo.
Can you clear this up for me?
Thanks!
djcc