Simple fish eat program

Dependencies:   mbed mbed-rtos N5110 ShiftReg Tone

Revision:
13:183bd19f3d7d
Parent:
12:20ac766b3175
Child:
14:f1552b691274
diff -r 20ac766b3175 -r 183bd19f3d7d classes/Sound.cpp
--- a/classes/Sound.cpp	Wed Apr 21 15:24:31 2021 +0000
+++ b/classes/Sound.cpp	Wed Apr 21 16:26:26 2021 +0000
@@ -4,6 +4,7 @@
 //creates the main theme to be played
 void Sound::mainTheme(Tone &dac){
     
+    //create an array of notes to be played
     const int mainTheme_note_array[] = {
             NOTE_C3,
             
@@ -62,6 +63,7 @@
             NOTE_D3, NOTE_C3, 0,
     };
     
+    //create an array defining the duration of each note
     const int mainTheme_note_duration_array[] = {
         
         8, 
@@ -122,44 +124,7 @@
         
     };
     
-    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);
+    n = sizeof(mainTheme_note_array)/sizeof(int); //determine duration
+    dac.play_melody(n,mainTheme_note_array,mainTheme_note_duration_array,60.0,false); //play melody
+    wait_ms(100); //let melody fully play out
 }
\ No newline at end of file