Simple fish eat program
Dependencies: mbed mbed-rtos N5110 ShiftReg Tone
Diff: classes/Sound.cpp
- Revision:
- 12:20ac766b3175
- Parent:
- 7:6f951d175df6
- Child:
- 13:183bd19f3d7d
diff -r 7c1e2a9303d3 -r 20ac766b3175 classes/Sound.cpp --- a/classes/Sound.cpp Wed Apr 21 11:08:02 2021 +0000 +++ b/classes/Sound.cpp Wed Apr 21 15:24:31 2021 +0000 @@ -1,9 +1,9 @@ #include "Sound.h" #include "Tone.h" +//creates the main theme to be played void Sound::mainTheme(Tone &dac){ - // const int mainTheme_note_array[] = { NOTE_C3, @@ -122,7 +122,44 @@ }; - int n = sizeof(mainTheme_note_array)/sizeof(int); + n = sizeof(mainTheme_note_array)/sizeof(int); dac.play_melody(n,mainTheme_note_array,mainTheme_note_duration_array,60.0,false); wait_ms(100); +} + +void Sound::pointScore(Tone &dac){ + + const int pointScore_note_array[] = { + + NOTE_C3, 0, NOTE_C3, NOTE_D3, + NOTE_C3, + }; + + const int pointScore_note_duration_array[] = { + + 8,8,8,8, + 4, + + }; + + n = sizeof(pointScore_note_array)/sizeof(int); + dac.play_melody(n,pointScore_note_array,pointScore_note_duration_array,60.0,false); + wait_ms(100); +} + +void Sound::lifeLoss(Tone &dac){ + const int lifeLoss_note_array[] = { + + NOTE_D4, 0, NOTE_D4, + }; + + const int lifeLoss_note_duration_array[] = { + + 8,8,4, + + }; + + n = sizeof(lifeLoss_note_array)/sizeof(int); + dac.play_melody(n,lifeLoss_note_array,lifeLoss_note_duration_array,60.0,false); + wait_ms(100); } \ No newline at end of file