-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrumList.cs
78 lines (65 loc) · 2.03 KB
/
DrumList.cs
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
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.IO;
namespace MidiChord
{
public class DrumList
{
private Dictionary<string, int> _drumNotes;
const string drumsFilename = @"drums.txt";
public DrumList()
{
bool loaded = false;
if (File.Exists(drumsFilename))
{
loaded = LoadDrums(drumsFilename);
}
if (!loaded)
{
_drumNotes = getNotesOfDrums();
}
}
private bool LoadDrums(string drumsFilename)
{
throw new NotImplementedException();
}
public int GetDrum(string drum)
{
if (ContainsDrum(drum))
{
return _drumNotes[drum];
}
return -1;
}
public bool ContainsDrum(string chord)
{
if (string.IsNullOrEmpty(chord)) return false;
return _drumNotes.ContainsKey(chord);
}
private Dictionary<string, int> getNotesOfDrums()
{
return new Dictionary<string, int>
{
["b"] = 35, // acoustic base drum
["B"] = 36, // base drum
["s"] = 38, // acoustic snare
["S"] = 40, // snare
["f"] = 41, // low floor tom
["F"] = 43, // high floor tom
["t"] = 45, // low tom
["T"] = 50, // high tom
["m"] = 47, // low mid tom
["M"] = 48, // hi mid tom
["C"] = 49, // Crash cymbal
["c"] = 51, // Ride cymbal
["SC"] = 51, // Splash cymbal
["h"] = 42, // close hi-hat
["H"] = 46, // open hi-hat
["w"] = 77, // low wood-block
["W"] = 76, // high wood-block
["st"] = 37, // side stick
["A"] = 54, // tambourine
};
}
}
}