-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson.cpp
More file actions
89 lines (72 loc) · 2.78 KB
/
Copy pathLesson.cpp
File metadata and controls
89 lines (72 loc) · 2.78 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* File: Lesson.cpp
* Author: astral
*
* Created on 22 Август 2012 г., 21:52
*/
#include "Lesson.h"
// TEST only
#define BC 3
#define BL 4
Lesson::Lesson() {
track = NULL;
bpm = 0;
/*
// TEST
Bar *tmpbar1, *tmpbar2, *tmpbar3, *tmpbar4, *tmpbar5;
track = new Track(treble, BC, BL);
SetBPM(80);
tmpbar1 = new Bar(CalculateBarLength(BC, BL));
//tmpbar1->SetRepeatEnd(2);
tmpbar2 = new Bar(CalculateBarLength(BC, BL));
//tmpbar2->SetRepeatEnd(2);
//tmpbar2->SetNextRepeatEndingId(3);
tmpbar3 = new Bar(CalculateBarLength(BC, BL), "Am"); // empty bar
tmpbar3->SetRepeatStart(true);
tmpbar4 = new Bar(CalculateBarLength(BC, BL)); // empty bar
tmpbar4->SetRepeatEnd(2);
tmpbar4->SetNextRepeatEndingId(5);
tmpbar5 = new Bar(CalculateBarLength(BC, BL)); // empty bar
tmpbar5->SetRepeatEnd(2);
track->AddBarBack(tmpbar2); // just to mix things up :)
track->AddBarAt(tmpbar1, 0);
track->AddBarBack(tmpbar3);
track->AddBarBack(tmpbar4);
track->AddBarBack(tmpbar5);
tmpbar1->AddNoteBack(new SingleNote(nl2, 0, 261.626)); // C
tmpbar1->AddNoteBack(new SingleNote(nl4, 0, 293.665)); // D
tmpbar2->AddNoteBack(new SingleNote(nl8, 0, 329.628)); // E
tmpbar2->AddNoteBack(new SingleNote(nl8, 0, 349.228)); // F
tmpbar2->AddNoteBack(new SingleNote(nl8, 0, 391.995)); // G
tmpbar2->AddNoteBack(new SingleNote(nl8, 0, 440.000)); // A
tmpbar2->AddNoteBack(new SingleNote(nl4, 0, 493.883)); // B
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 220.000)); // Am
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 261.626));
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 329.628));
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 261.626));
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 220.000));
tmpbar3->AddNoteBack(new SingleNote(nl16, 0, 0)); // Rest
tmpbar3->AddNoteBack(new SingleNote(nl8, 0, 0));
tmpbar3->AddNoteBack(new SingleNote(nl4, 0, 0));
tmpbar4->AddNoteBack(new SingleNote(nl8, 0, 466.164)); // A#
tmpbar4->AddNoteBack(new SingleNote(nl2, 0, 415.305)); // G#
tmpbar4->AddNoteBack(new SingleNote(nl8, 0, 369.994)); // F#
tmpbar5->AddNoteBack(new SingleNote(nl4, 1, 311.127)); // D#
tmpbar5->AddNoteBack(new SingleNote(nl4, 1, 277.183)); // C#
*/
}
Lesson::~Lesson() {
}
std::vector<QGraphicsItem*> Lesson::GetVisualParts() {
std::vector<QGraphicsItem*> ret;
if (track) {
ret.push_back(track);
std::vector<QGraphicsItem*> visuals = track->GetVisualParts();
ret.insert(ret.end(), visuals.begin(), visuals.end());
}
return ret;
}
void Lesson::LoadLesson(QFile f) {
// TODO
return;
}