//init.h typedef struct voice_tag { short vabid; short program; short tone; short note; short fine; short vol_l; short vol_r; }voice_data, *voice_ptr; voice_data sound; void InitSound( void ); void InitSFX( voice_ptr sound_effect, short vab_id, short program, short tone, short note, short fine, short vol_l, short vol_r ); void PlaySFX( voice_ptr sound_effect ); void StopSound( void ); //voice_data past1; //voice_data past; // sound effects //-------------------------------------------------------------------------- // Function: InitSound() // Description: Init sound system. Load in vab and set the main volume // Parameters: none // Returns: none // Notes: N/A //-------------------------------------------------------------------------- void InitSound( void ) { // return vab_id (0-15), open VAB and transfer to sound buffer vab_id = SsVabTransfer((u_char*)SOUND_VH, (u_char*)SOUND_VB,-1,1); // set main volume SsSetMVol(127,127); }// end InitSound //-------------------------------------------------------------------------- // Function: InitSFX() // Description: Setup our sound effects structure // Parameters: Lots...see Library Reference Manual // Returns: none // Notes: See Library Reference Manual //-------------------------------------------------------------------------- void InitSFX( voice_ptr sound_effect, short vab_id, short program, short tone, short note, short fine, short vol_l, short vol_r ) { sound_effect->vabid = vab_id; sound_effect->program = program; sound_effect->tone = tone; sound_effect->note = note; sound_effect->fine = fine; sound_effect->vol_l = vol_l; sound_effect->vol_r = vol_r; }// end InitSFX //-------------------------------------------------------------------------- // Function: PlaySFX() // Description: Play the sound effect // Parameters: voice_ptr sound_effect: address of sndfx variable // Returns: none // Notes: See Library Reference Manual //-------------------------------------------------------------------------- void PlaySFX( voice_ptr sound_effect ) { SsUtKeyOn(sound_effect->vabid, sound_effect->program, sound_effect->tone, sound_effect->note, sound_effect->fine, sound_effect->vol_l, sound_effect->vol_r); }// end PlaySFX //-------------------------------------------------------------------------- // Function: StopSound() // Description: Close down the sound system // Parameters: none // Returns: none // Notes: Look at the Library Reference Manual //-------------------------------------------------------------------------- void StopSound( void ) { // close vab SsVabClose(vab_id); }// end StopSound