andrew@24
|
1 #ifndef _TEST_APP
|
andrew@24
|
2 #define _TEST_APP
|
andrew@24
|
3
|
andrew@24
|
4
|
andrew@24
|
5 //midieventholder - newMidiEvents() sent there
|
andrew@24
|
6 //create cannamMidiLoader for cannamMainfunction
|
andrew@24
|
7
|
andrew@24
|
8
|
andrew@24
|
9 //check new prior offset function - how is used?
|
andrew@24
|
10
|
andrew@24
|
11
|
andrew@24
|
12
|
andrew@24
|
13 //check the widening function - adding decay noise
|
andrew@24
|
14 //ticksperscreen could be better as millis per screen
|
andrew@24
|
15
|
andrew@24
|
16
|
andrew@24
|
17
|
andrew@24
|
18 //uses ftmMidiPlay in max5 via osc to communicate notes in
|
andrew@24
|
19
|
andrew@24
|
20 #include "ofMain.h"
|
andrew@24
|
21
|
andrew@24
|
22 #include "MIDIFileReader.h"
|
andrew@24
|
23 #include "ofxFileDialogOSX.h"
|
andrew@24
|
24 #include "drawMidiNotes.h"
|
andrew@24
|
25 #include "DynamicBayesianArray.h"
|
andrew@24
|
26 #include "CannamMidiFileLoader.h"
|
andrew@24
|
27 #include <iostream>
|
andrew@24
|
28 #include "midiEventHolder.h"
|
andrew@24
|
29 #include "ofxMidiIn.h"
|
andrew@24
|
30 #include "ofxOsc.h"
|
andrew@24
|
31 #include "MidiInputStream.h"
|
andrew@24
|
32
|
andrew@24
|
33
|
andrew@24
|
34 #define PORT 12121
|
andrew@25
|
35 #define SEND_PORT 5282
|
andrew@25
|
36 #define HOST "localhost"
|
andrew@25
|
37
|
andrew@24
|
38
|
andrew@24
|
39 using namespace std;
|
andrew@24
|
40 using namespace MIDIConstants;
|
andrew@24
|
41
|
andrew@24
|
42 class testApp : public ofBaseApp{
|
andrew@24
|
43
|
andrew@24
|
44 public:
|
andrew@24
|
45 void setup();
|
andrew@24
|
46 void update();
|
andrew@24
|
47 void draw();
|
andrew@24
|
48
|
andrew@24
|
49 void keyPressed (int key);
|
andrew@24
|
50 void keyReleased(int key);
|
andrew@24
|
51 void mouseMoved(int x, int y );
|
andrew@24
|
52 void mouseDragged(int x, int y, int button);
|
andrew@24
|
53 void mousePressed(int x, int y, int button);
|
andrew@24
|
54 void mouseReleased(int x, int y, int button);
|
andrew@24
|
55 void windowResized(int w, int h);
|
andrew@24
|
56
|
andrew@24
|
57 void startPlaying();
|
andrew@24
|
58 void stopPlaying();
|
andrew@24
|
59 bool getFilenameFromDialogBox(string* fileNameToSave);
|
andrew@24
|
60
|
andrew@24
|
61 typedef std::vector<int> IntVector;
|
andrew@24
|
62 typedef std::vector<double> DoubleVector;
|
andrew@24
|
63 // typedef std::vector<IntVector> IntMatrix;
|
andrew@24
|
64 IntVector v;
|
andrew@24
|
65
|
andrew@24
|
66 midiEventHolder midiEvents;
|
andrew@24
|
67
|
andrew@24
|
68 int cannamMainFunction();
|
andrew@24
|
69 string midiFileName;
|
andrew@24
|
70
|
andrew@24
|
71 bool playing;
|
andrew@24
|
72 //drawMidiNotes drawer;
|
andrew@24
|
73
|
andrew@24
|
74 // BayesianArrayStructure bayesStruct;
|
andrew@24
|
75
|
andrew@24
|
76 int screenWidth, screenHeight;
|
andrew@24
|
77 CannamMidiFileLoader fileLoader;
|
andrew@24
|
78
|
andrew@24
|
79 //MIDI INPUT
|
andrew@24
|
80 // vars
|
andrew@24
|
81 int port;
|
andrew@24
|
82 int id;
|
andrew@24
|
83 int value;
|
andrew@24
|
84 double timestamp;
|
andrew@24
|
85 char msg[255];
|
andrew@24
|
86 string portName;
|
andrew@24
|
87
|
andrew@25
|
88 void checkNewScoreNote();
|
andrew@25
|
89 void sendNoteToMuseScore();
|
andrew@25
|
90 void sendMeasureToMuseScore();
|
andrew@26
|
91 void sendBlackNotes();
|
andrew@25
|
92 void findMeasure();
|
andrew@26
|
93
|
andrew@24
|
94 // midi addon
|
andrew@24
|
95 ofxMidiIn midiIn;
|
andrew@24
|
96 // this is your listener function
|
andrew@24
|
97 void newMessage(ofxMidiEventArgs &args);
|
andrew@24
|
98
|
andrew@24
|
99 MidiInputStream noteInStream;
|
andrew@24
|
100
|
andrew@24
|
101 double firstNoteTime;
|
andrew@24
|
102 bool liveInputPlaying;
|
andrew@24
|
103 double timePlayed;
|
andrew@24
|
104 int transpose;
|
andrew@25
|
105 int lastScoreIndexSent;
|
andrew@25
|
106 int lastMeasureSent;
|
andrew@26
|
107 double performanceRating;
|
andrew@24
|
108 private:
|
andrew@24
|
109 ofxOscReceiver receiver;
|
andrew@25
|
110 ofxOscSender sender;
|
andrew@24
|
111
|
andrew@24
|
112
|
andrew@24
|
113 };
|
andrew@24
|
114
|
andrew@24
|
115 #endif
|