#include #include #include #include "sound.h" #define VHADDR 0x801a0000 #define VBADDR 0x80160000 #define DNBVH 0x801a2000 #define DNBVB 0x801d9000 #define DNBSEQ 0x801a6000 #define TITLESEQ 0x801a4000 #define DEFAULTTEMPO 140 #define TEMPOINCREASE 8 int CSound::m_tempo; short int CSound::m_sequence; short int CSound::m_titlesequence; int CSound::m_vtime; void CSound::Setup() { SsVabTransfer((unsigned char *)VHADDR, (unsigned char *)VBADDR, 0, 1); SsVabTransfer((unsigned char *)DNBVH, (unsigned char *)DNBVB, 1, 1); } CSound::CSound() { m_tempo=DEFAULTTEMPO; m_vtime=128; } CSound::~CSound() { } void CSound::HoleSound() { SsUtKeyOn(0, 6, 0, 52, 64, 127, 127); } void CSound::DieSound() { SsUtKeyOn(0, 0, 0, 52, 64, 127, 127); } void CSound::AheadSound(int colour) { switch (colour) { case (0): SsUtKeyOn(0, 4, 0, 52, 64, 127, 127); break; case (1): SsUtKeyOn(0, 1, 0, 52, 64, 127, 127); break; case (2): SsUtKeyOn(0, 2, 0, 52, 64, 127, 127); break; case (3): SsUtKeyOn(0, 9, 0, 52, 64, 127, 127); break; case (4): SsUtKeyOn(0, 5, 0, 52, 64, 127, 127); break; case (5): SsUtKeyOn(0, 3, 0, 52, 64, 127, 127); break; }; } void CSound::SpeedingSound() { SsUtKeyOn(0, 7, 0, 52, 64, 127, 127); } void CSound::WinnerSound() { SsUtKeyOn(0, 8, 0, 52, 64, 127, 127); } void CSound::StartTune() { m_sequence=SsSeqOpen((long unsigned int *)DNBSEQ, 1); SsSeqPlay(m_sequence, SSPLAY_PLAY, SSPLAY_INFINITY); } void CSound::StopTune() { SsSeqStop(m_sequence); SsSeqClose(m_sequence); } void CSound::SpeedUp() { m_tempo+=TEMPOINCREASE; SsSeqSetAccelerando(m_sequence, m_tempo, m_vtime); } void CSound::ResetSpeed() { SsSeqSetAccelerando(m_sequence, DEFAULTTEMPO, 1); m_tempo=DEFAULTTEMPO; } void CSound::StartTitleTune() { m_titlesequence=SsSeqOpen((long unsigned int *)TITLESEQ, 1); SsSeqPlay(m_titlesequence, SSPLAY_PLAY, SSPLAY_INFINITY); } void CSound::StopTitleTune() { SsSeqStop(m_titlesequence); SsSeqClose(m_titlesequence); }