-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHarpNoteChoice.cpp
More file actions
57 lines (49 loc) · 1.21 KB
/
HarpNoteChoice.cpp
File metadata and controls
57 lines (49 loc) · 1.21 KB
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
#include "HarpNoteChoice.h"
HarpNoteChoice::HarpNoteChoice()
{
}
HarpNoteChoice::~HarpNoteChoice()
{
}
void HarpNoteChoice::pickNotes(int& ginsingNote0, int& ginsingNote1, const int& firstNote, const int& secondNote) {
//Not playing any notes? Stop and done.
if (firstNote == -1 && secondNote == -1) {
ginsingNote0 = -1;
ginsingNote1 = -1;
return;
}
//Double check that it's being called correctly ...
//If only one note is being passed in, it MUST be the first!
if (firstNote == -1) {
ginsingNote0 = -1;
ginsingNote1 = -1;
return;
}
//Are we playing one note or two?
if (secondNote == -1) {
//is someone already playing this note? If so, they keep it.
if (ginsingNote0 == firstNote) {
ginsingNote1 = -1;
}
else if (ginsingNote1 == firstNote) {
ginsingNote0 = -1;
}
else {
ginsingNote0 = firstNote;
ginsingNote1 = -1;
}
}
else {
//Two notes. it's either a direct assignment or a switch.
if (ginsingNote0 == firstNote || ginsingNote1 == secondNote) {
//At least one matched. Make sure they both do.
ginsingNote0 = firstNote;
ginsingNote1 = secondNote;
}
else {
//The didn't match. Reverse them.
ginsingNote1 = firstNote;
ginsingNote0 = secondNote;
}
}
}