-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
111 lines (85 loc) · 2.66 KB
/
main.cpp
File metadata and controls
111 lines (85 loc) · 2.66 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// std lib
#include <pthread.h>
#include <unistd.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <cmath>
#include <vector>
#include <mutex>
// SourceNote
#include "Toolkit.h"
#include "Tempo.h"
#include "NoteTone.h"
#include "ToneCreator.h"
#include "NoteTrack.h"
#include "SNCore.h"
// STK
#include "Instrmnt.h"
#include "JCRev.h"
#include "Sitar.h"
#include "Messager.h"
#include "RtAudio.h"
// This is a main file for the algorithm team's tests.
// It should not be implemented in the final release.
int main(void) {
/*** GameMessage testing ***/
/*
std::mutex mutex;
SNCore core = SNCore(mutex);
GameMessage *gm = new GameMessage();
gm->eventType = std::string("PLAYER_CHANGECLASS");
gm->info = new std::map<std::string, std::string>();
gm->info->insert( std::pair<std::string, std::string>("PlayerName", "JoeMaag"));
gm->info->insert( std::pair<std::string, std::string>("PlayerClass", "Scout"));
core.start(gm);
sleep(6);
// GameMessage *gm2 = new GameMessage();
// gm2->eventType = std::string("PLAYER_DEATH");
// gm2->info = new std::map<std::string, std::string>();
// std::cout << "death\n";
// core.decodeMessage(gm2);
// sleep(20);
// std::cout << "death\n";
// core.decodeMessage(gm2);
// sleep(15);
// GameMessage *gm5 = new GameMessage();
// gm5->eventType = std::string("PLAYER_SPAWN");
// gm5->info = new std::map<std::string, std::string>();
// gm5->info->insert( std::pair<std::string, std::string>("PlayerClass", "Scout"));
// std::cout << "spawn\n";
// core.decodeMessage(gm5);
// sleep(20);
GameMessage *gm3 = new GameMessage();
gm3->eventType = std::string("PLAYER_CHANGECLASS");
gm3->info = new std::map<std::string, std::string>();
gm3->info->insert( std::pair<std::string, std::string>("PlayerName", "JoeMaag"));
gm3->info->insert( std::pair<std::string, std::string>("PlayerClass", "Heavy"));
core.decodeMessage(gm3);
sleep(6);
*/
std::mutex mutex;
Tempo t = Tempo(120, mutex);
ToneCreator tc = ToneCreator();
NoteTrack nt = tc.makeRandomMelodyNotesInRandomKeyWithOctave(1,true); //octave 1, main melody
nt.continous = false;
nt.repeatCount = 1;
// Uncomment for percussion testing
// PercussionTrack pt = tc.makeRandomBeatWithPercussionType(kSnare);
// pt.addPercussionTrack(pt, false);
t.addNoteTrack(nt);
t.start();
sleep(5);
NoteTrack nt2 = tc.makeRandomMelodyNotesInRandomKeyWithOctave(1,false);
nt2.continous = true;
t.addNoteTrack(nt2);
sleep(5);
NoteTrack nt3 = tc.makeRandomMelodyNotesInRandomKeyWithOctave(2,false);
nt3.continous = true;
t.addNoteTrack(nt3);
sleep(20);
// tk.playTone(0, 2, "sine", 440.0);
// tk.playNoteTone(a);
// tk.playPercussionTone(b);
return 0;
}