PWM出力によって圧電スピーカーで容易に音を鳴らすことができるライブラリです。

Dependents:   kiokuryoku_game escapeFromYou junirobo_sample001 ROBOX_Sample_IRcon ... more

Revision:
3:86238dba1529
Parent:
2:259899b723ab
Child:
4:237b642c2ffa
diff -r 259899b723ab -r 86238dba1529 beep_sound.h
--- a/beep_sound.h	Sat Jun 04 17:50:58 2016 +0000
+++ b/beep_sound.h	Tue Jun 28 09:47:46 2016 +0000
@@ -1,6 +1,12 @@
 #ifndef BEEP_SOUND_H
 #define BEEP_SOUND_H
 #include "mbed.h"
+#include <queue>
+struct gakuhu{
+    int octave;
+    int note;
+    float time_s;
+};
 
 const int frequencyTable[] = {261, 277, 294, 311, 330, 349,
                                 370, 392, 415, 440, 466, 494};
@@ -21,8 +27,19 @@
         void beep_konbini(int nTimes);
         void beep_readyGo(int nTimes);
         void beep_encount(int nTimes);
+        // 以下並列で鳴らすための関数
+        void stop();
+        void setGakuhu(int argOc, int argNo, float argTi);
+        void setKyuhu(float argTi);
+        void playGakuhu();
+        void NoteOn(int octave, int note);
     private:
         PwmOut* m_pwm;
+        int frequency;
+        // 以下並列で鳴らすための宣言
+        queue<gakuhu> otoQue;
+        gakuhu buf;
+        Timeout interruptStop;
 };
 
 #endif