Gemphet8 ; 8-polyphonic synthesizer control application

Dependencies:   MIDI REnc button mbed

Revision:
4:c18cfcad2c48
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MIDI_Proc/midi_proc.h	Mon Aug 11 07:14:46 2014 +0000
@@ -0,0 +1,64 @@
+#ifndef SUB_MIDI_PROC_H
+#define SUB_MIDI_PROC_H
+
+#include "mbed.h"
+#include "MIDI.h"
+
+/** MIDI System message */
+#define MIDI_ALL_NOTE_OFF             0x7B
+#define MIDI_RESET_ALL_CONTROLLERS    0x79
+
+#define POLYPHONICE_NOTES 8
+
+namespace mbed
+{
+
+/** @structure MIDI Note management structure
+ *
+ */
+typedef struct _MidiNote {
+    /// MIDI Note number
+    uint8_t Note;
+    /// MIDI Note velocity
+    uint8_t Velocity;
+    /// MIDI Note channel
+    uint8_t Channel;
+    /// pointer to the next _MidiNote object
+    struct _MidiNote *next;
+} MN_t, *MN_p;
+
+class MIDI_P
+{
+
+private:
+    MIDI _midi;
+
+    MN_t NoteEnd;
+    MN_t NoteStart;
+    MN_t MidiNotes[POLYPHONICE_NOTES];
+    uint16_t MidiNotesTag;
+    uint8_t NumOfNotes;
+
+    /** @brief Prototypes related to MIDI
+     *
+     */
+    MN_p allocN(void);
+    void freeN(MN_p addr);
+    void midi_allnoteoff(void);
+    void midi_resetcontrol(void);
+    void midi_sysreset(void);
+    void midi_noteoff(byte channel, byte note, byte velocity);
+    void midi_noteon(byte channel, byte note, byte velocity);
+    void midi_cc(byte channel, byte number, byte value);
+    void midi_pc(byte channel, byte number);
+    void midi_pbend(byte channel, int bend);
+
+public:
+    MIDI_P(PinName tx, PinName rx);
+    ~MIDI_P() { };
+    void Init(void);
+
+}; // end of class MIDI_P definition
+
+}  // end of namespace mbed
+#endif
\ No newline at end of file