Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Gamepad N5110 mbed-rtos
Diff: Music/Music.cpp
- Revision:
- 0:d9cf94b41df3
diff -r 000000000000 -r d9cf94b41df3 Music/Music.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Music/Music.cpp Thu May 09 09:49:35 2019 +0000
@@ -0,0 +1,67 @@
+#include "Music.h"
+
+Music::Music()
+{
+
+}
+
+Music::~Music()
+{
+
+}
+
+void Music::intro_song(Gamepad &pad) // introduction song for the game
+{
+ while(pad.check_event(Gamepad::START_PRESSED) == false){
+ pad.tone(293.665, 2);
+ wait(0.8); // thread wait so that two loops can simulatneously run
+ if(pad.check_event(Gamepad::START_PRESSED) == true){break;} // break if start button has been pressed
+ pad.tone(311.127, 2);
+ wait(0.8);
+ if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
+ pad.tone(329.628, 2);
+ wait(0.8);
+ if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
+ pad.tone(349.228, 2);
+ wait(0.8);
+ if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
+ }
+}
+
+void Music::mission_success(Gamepad &pad) // success song
+{
+ //triplets
+ pad.tone(207.65,0.18);
+ wait(0.2);
+ pad.tone(207.65,0.18);
+ wait(0.2);
+ pad.tone(207.65,0.18);
+ wait(0.2);
+ // 3 beats
+ pad.tone(261.63,0.28);
+ wait(0.3);
+ pad.tone(207.65,0.28);
+ wait(0.3);
+ pad.tone(261.63,0.28);
+ wait(0.3);
+ pad.tone(261.63,0.28);
+ wait(0.30);
+ pad.tone(207.65,0.28);
+ wait(0.30);
+ pad.tone(261.63,0.28);
+ wait(0.30);
+ pad.tone(311.13,1.2);
+ wait(1.2);
+ wait(2.4);
+};
+
+void Music::mission_fail(Gamepad &pad) // failure song
+{
+ pad.tone(233.0,0.5);
+ wait(0.5);
+ pad.tone(184.0,0.5);
+ wait(0.5);
+ pad.tone(174.0,2.0);
+ wait(1.0);
+
+};
\ No newline at end of file