#include "SoundEffects.h" static int StandardsoundBank; static int EffectSoundBank; static int BackgroundMusic; static int NervousMusic; static int ScreenMusic; static int LastTime; // Te amount of frames since program activation static int LastStep; // Needed for step sound // Loads all the necesarry files void InitSound() { void *FileData; void *vhdata; void *vbdata; StandardsoundBank=LoadDefaultWaveTables(); // Standardwavetables FileData=LoadFile("SoundData/UpBeat.seq"); BackgroundMusic=SsSeqOpen(FileData,StandardsoundBank); FileData=LoadFile("SoundData/Indust.seq"); NervousMusic=SsSeqOpen(FileData,StandardsoundBank); // Backgoundmusic read FileData=LoadFile("SoundData/Mains.seq"); ScreenMusic=SsSeqOpen(FileData,StandardsoundBank); vbdata=LoadFile("SoundData/Effects.vb"); vhdata=LoadFile("SoundData/Effects.vh"); EffectSoundBank=SsVabTransfer(vhdata, vbdata, -1, 1); free(vbdata); // In SPU Sound Effects Loaded LastTime=VSync(-1); // New images since program activation needed for no result LastStep=VSync(-1); // Amount of images needed for step sound } // Plays the music for the main screen void PlayScreenMusic() { SsSeqPlay(ScreenMusic,SSPLAY_PLAY,SSPLAY_INFINITY); } // Plays the normal background music void PlayBackground() { SsSeqPlay(BackgroundMusic,SSPLAY_PLAY,SSPLAY_INFINITY); } // Switches to the more nervous music, when the time gets short void SwitchToNervous() { SsSeqStop(BackgroundMusic); SsSeqPlay(NervousMusic,SSPLAY_PLAY,SSPLAY_INFINITY); } // Stops all music void StopSound() { int i; for (i=100;i>0;i-=4) { SsSeqSetVol(BackgroundMusic,i,i); SsSeqSetVol(NervousMusic,i,i); SsSeqSetVol(ScreenMusic,i,i); VSync(0); } SsSeqStop(BackgroundMusic); SsSeqStop(NervousMusic); SsSeqStop(ScreenMusic); SsSeqSetVol(BackgroundMusic,127,127); SsSeqSetVol(NervousMusic,127,127); SsSeqSetVol(ScreenMusic,127,127); } // Play a step sound, when advanced ahaead void PlayStep() { int difference; int frames; frames=VSync(-1); difference=(frames-LastStep); if ((difference>15)||(difference<-15)) // ? wie wird gezaehlt { SsUtKeyOn(EffectSoundBank, 0, 0, 48, 0, 70, 70); LastStep=frames; } } void PlayLoudStep() { SsUtKeyOn(EffectSoundBank, 0, 0, 48, 0, 140, 140); } void DirectStep() { SsUtKeyOn(EffectSoundBank, 0, 0, 48, 0, 70, 70); } // Plays a Box Move Sound void PlayMoveBox() { SsUtKeyOn(EffectSoundBank, 1, 0, 40, 0, 100, 100); } void PlayYeah() { SsUtKeyOn(EffectSoundBank,3,0,48,0,128,128); } void PlayApplause() { SsUtKeyOn(EffectSoundBank,4,0,35,0,128,128); } void PlayBreath() { SsUtKeyOn(EffectSoundBank,5,0,48,0,90,90); } // Playd a no result Sound void PlayNoResult() { int difference; int frames; frames=VSync(-1); difference=(frames-LastTime); if ((difference>15)||(difference<-15)) // ? wie wird gezaehlt { SsUtKeyOn(EffectSoundBank, 2, 0, 40, 0, 90, 90); LastTime=frames; } }