Elements used in the Balls and Things games for the RETRO.
Dependents: RETRO_BallsAndPaddle RETRO_BallAndHoles
Diff: SoundFx.cpp
- Revision:
- 1:71185a0aadfc
- Parent:
- 0:3d0db4e183ee
- Child:
- 7:4fa3edaa1201
--- a/SoundFx.cpp Fri Feb 06 09:51:06 2015 +0000 +++ b/SoundFx.cpp Fri Feb 06 10:18:02 2015 +0000 @@ -1,49 +1,19 @@ #include "SoundFX.h" -SoundFX::SoundFX() : -// pwm(P0_18), - music(P0_18) +SoundFX::SoundFX() : music(P0_18) { -// this->pwmTicksLeft=0; this->fMute=false; music.setCompletionCallback(this, &SoundFX::musicCompleted); } -void SoundFX::checkPwm() -{ -/* - if(this->fMute || this->pwmTicksLeft == 0) - this->pwm.write(0.0); - else - { - this->pwmTicksLeft--; - this->pwm.write(0.5); - } -*/ -} - void SoundFX::musicCompleted(void) { -/* - PwmOut pwm(P0_18); - pwm = 0.0; - pwm.period(0.1); - pwm.write(0.00); -*/ + } void SoundFX::reset() { -/* - this->pwmTicksLeft=0; - this->pwm.period_ms(1); - this->pwm.write(0.00); -*/ -/* - PwmOut pwm(P0_18); - pwm.write(0.00); -*/ } void SoundFX::setMute(bool fMute) @@ -62,17 +32,14 @@ { if(this->fMute) return; -// this->pwmTicksLeft = nDuration; + music.play("T240 L16 O6 C"); } void SoundFX::beepShort() { if(this->fMute) return; -/* - this->pwm.period_ms(2); - this->pwmTicksLeft = SoundFX::BOUNCE1_SOUND_TICKS; -*/ + music.play("T240 L32 O6 C"); } @@ -80,11 +47,6 @@ { if(this->fMute) return; - -/* - this->pwm.period_ms(1); - this->pwmTicksLeft = SoundFX::BOUNCE2_SOUND_TICKS; -*/ music.play("T240 L8 O5 C"); } @@ -92,12 +54,6 @@ { if(this->fMute) return; -/* - this->pwm.period(1.0/220); - this->pwm.write(0.5); - wait_ms(150); - this->pwm.write(0.0); -*/ music.play("T180 L4 O3 C"); } @@ -112,22 +68,6 @@ { if(this->fMute) return; -/* - this->pwm.period(1.0/220); - this->pwm.write(0.5); - wait_ms(150); - this->pwm.write(0.0); - - this->pwm.period(1.0/196); - this->pwm.write(0.5); - wait_ms(150); - this->pwm.write(0.0); - - this->pwm.period(1.0/164.81); - this->pwm.write(0.5); - wait_ms(150); - this->pwm.write(0.0); -*/ // music.setCompletionCallback(this, &SoundFX::musicCompleted); //music.play("T224L8O5CL16>C<P16GP16L8EL16P16>C<GP16L8E.L16P16L8C#L16>C#<P16G#P16L8FL16P16>C#<G#P16L8F.L16P16L8CL16>C<P16GP16L8EL16P16>C<GP16L8E.L16P16D#EFP16FF#GP16GG#AP16L8>C<P8L4>C"); music.play("T120 O3 L16 F L4 C F L8 C");