Gemphet8 ; 8-polyphonic synthesizer control application

Dependencies:   MIDI REnc button mbed

MIDI_Proc/midi_proc.h

Committer:
ChuckTimber
Date:
2014-08-11
Revision:
5:7d7be4c72d21
Child:
9:a86ad099f24d

File content as of revision 5:7d7be4c72d21:

#ifndef __C_MIDI_PROC_H__
#define __C_MIDI_PROC_H__ 1

#include "mbed.h"
#include "MIDI.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

    /** MIDI System message */
#define MIDI_ALL_NOTE_OFF             0x7B
#define MIDI_RESET_ALL_CONTROLLERS    0x79

#define POLYPHONICE_NOTES 8

    typedef unsigned char uint8_t;
    typedef unsigned short uint16_t;
    typedef uint8_t byte;
    typedef uint16_t word;
    
    /** @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;

    extern MN_t NoteEnd;
    extern MN_t NoteStart;
    extern MN_t MidiNotes[];
    extern uint16_t MidiNotesTag;
    extern uint8_t NumOfNotes;

    /** @brief Prototypes related to MIDI
     *
     */
    extern void midi_init(void);
    extern MN_p allocN(void);
    extern void freeN(MN_p addr);
    extern void midi_allnoteoff(void);
    extern void midi_resetcontrol(void);
    extern void midi_sysreset(void);
    extern void midi_noteoff(byte channel, byte note, byte velocity);
    extern void midi_noteon(byte channel, byte note, byte velocity);
    extern void midi_cc(byte channel, byte number, byte value);
    extern void midi_pc(byte channel, byte number);
    extern void midi_pbend(byte channel, int bend);

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __C_MIDI_PROC_H__ */