-
Notifications
You must be signed in to change notification settings - Fork 0
/
Instrument.h
48 lines (45 loc) · 1.08 KB
/
Instrument.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
//Peter Miller
//5-19-2016
#ifndef INSTRUMENT_H_
#define INSTRUMENT_H
#include "Channel.h"
#include "toString.h"
//Instrument
//Each instrument is a track on the MIDI file
//Pure Virtual
class instrument{
public:
instrument(int l);
virtual ~instrument();
friend ostream& operator<<(ostream& , const instrument& );
void addNote(int n, int t, int l, int v=0x7F, int c=0);
protected:
channel channels[2] = {channel(0,0,0,0), channel(0,0,0,0)}; //Initializes two channels
int length; //Length of song
int minNoteLength = 0x10; //This could theoretically change, but 0x10 works well
int voice; //0=Treble, 1=Alto, 2=Tenor, 3=Bass
int ID; //MIDI ID
int numChannels; //Number of channels
};
//Definitions of derived instruments
class violin : public instrument{
public:
violin( int l );
~violin(){};
};
class viola : public instrument{
public:
viola( int l );
~viola(){};
};
class cello : public instrument{
public:
cello( int l );
~cello(){};
};
class stringBass : public instrument{
public:
stringBass( int l );
~stringBass(){};
};
#endif