Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef charlesMIDI.h
- #define charlesMIDI.h
- #include <arduino.h>
- const byte noteOn = 0x90;
- const byte noteOff = 0x80;
- const byte nullByte = 0x00;
- const byte middleC = 0x3C;
- const byte maxVelocity = 0x7F;
- const byte TOTAL_CHANNELS = 0x04;
- class MidiWord{
- private:
- byte command;
- byte pitch;
- byte velocity;
- public:
- MidiWord();
- MidiWord(byte inCommand, byte inPitch, byte inVelocity);
- void getWord();
- byte getCommand() const;
- byte getPitch() const;
- byte getVelocity() const;
- byte setAll(byte inCommand, byte inPitch, byte inVelocity);
- boolean isEqual(MidiWord inWord) const;
- void writeWord(byte snChannel = nullByte)const;
- };
- class MidiChannel{
- private:
- //byte channel;
- byte currentPitch;
- boolean playState;
- unsigned long startTime;
- public:
- MidiChannel();
- byte getCurrentPitch() const;
- boolean getPlayState() const;
- unsigned long getStartTime() const;
- void setCurrentPitch(const byte inCurrentPitch);
- void setPlayState(const byte inState);
- void setStartTime();
- };
- class MCArray{
- private:
- MidiChannel midiArray[TOTAL_CHANNELS];
- public:
- MCArray();
- byte nextNotePlayTime(MidiWord& killNote, byte numberOfChannels) const;
- byte nextNotePlayPitch(MidiWord& killNote, byte numberOfChannels) const;
- byte noteOffMatch(const byte inPitch) const;
- void updateStatus(const MidiWord& currentMessage, byte messageChannel);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement