//------------------------------------------------------------------------------ // File: sound.c // Description: Sound related routines // Copyright (C) 1997 Sony Computer Entertainment Inc., // All Rights Reserved //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // I N C L U D E S //------------------------------------------------------------------------------ #include // standard PlayStation library #include "sound.h" #include "gfx.h" //------------------------------------------------------------------------------ // G L O B A L S //------------------------------------------------------------------------------ short vab, seq; // sound related //------------------------------------------------------------------------------ // Function: InitSound() // Description: Setup the sound // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ void InitSound( void ) { // recognise and transmit sound source data to buffer vab = SsVabTransfer( (u_char *)VH_ADDR, (u_char *)VB_ADDR, -1, 1 ); // check if failed if ( vab < 0 ) { printf("ERROR: SsVabTransver failed (%d)\n" , vab ); return; } // open SEQ data seq = SsSeqOpen( (u_long *)SEQ_ONE_ADDR, vab ); // check if failed if ( seq < 0 ) printf("ERROR: SsSeqOpen failed (%)\n", seq ); }// end InitSound() //------------------------------------------------------------------------------ // Function: PlaySound() // Description: Playback sound // Parameters: none // Returns: void // Notes: Code added by George Bain for tempo, and reverberation. May 13, 1997 //------------------------------------------------------------------------------ void PlaySound( void ) { short reverb; // main volume value setting, Left and Right channels SsSetMVol( MVOL, MVOL ); // SEQ volume seting, Left and Right channels SsSeqSetVol( seq, SVOL, SVOL ); // SEQ data reading (musical performance) SsSeqPlay( seq, SSPLAY_PLAY, SSPLAY_INFINITY ); // Setup the tempo SsSetTempo( seq,0,107 ); // Setup the reverberation type to HALL reverb = SsUtSetReverbType( SS_REV_TYPE_HALL ); // check if failed if ( reverb < 0 ) printf("ERROR: SsUtSetReverbType failed (%)\n", reverb); // Turn the reverb on SsUtReverbOn(); // Setup the reverberation depth SsUtSetReverbDepth( 64,64 ); }// end PlaySound() //------------------------------------------------------------------------------ // Function: StopSound() // Description: Stop sound sequence // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ void StopSound( void ) { // stop SEQ data reading SsSeqStop( seq ); // turn the reverb off SsUtReverbOff(); // wait for vertical synchronisation VSync(0); VSync(0); // close SEQ data SsSeqClose( seq ); // close VAB data SsVabClose( vab ); }// end StopSound() //-----------------------------------EOF----------------------------------------