-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSFMusicalShield.h
66 lines (48 loc) · 1.49 KB
/
SFMusicalShield.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
*/
#ifndef _SFMusicalShield_h_
#define _SFMusicalShield_h_
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <SoftwareSerial.h>
// ***************************************** //
// Constants for musical instrument options
#define ACOUSTIC_GRAND_PIANO 1
#define HARMONICA 23
#define ACOUSTIC_GUITAR_NYLON 25
#define TRUMPET 57
#define BAG_PIPE 110
#define WOODBLOCK 116
// ***************************************** //
// Constants for bank options
#define BASIC_INSTRUMENTS 0x00
#define PERCUSSION1 0x78
#define PERCUSSION2 0x7f
#define MELODIC 0x79
// ***************************************** //
class SFMusicalShield
{
public:
void begin();
void begin(int resetMIDIPin);
void begin(Stream &s);
void begin(int resetMIDIPin, Stream &s);
void noteOn(byte channel, byte note, byte attack_velocity);
void noteOff(byte channel, byte note, byte release_velocity);
void allOff(byte channel);
void setBank(byte channel, byte bank);
void setInstrument(byte channel, byte bank);
void setVolume(byte channel, byte volume);
/*
void setReverbLevel(byte channel, byte level);
void setReverbDecay(byte channel, byte decay);
*/
void talkMIDI(byte cmd, byte data1, byte data2);
private:
Stream* mySerial;
void resetMIDI(int resetMIDIPin);
};
#endif