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@24
|
35
|
andrew@24
|
36 using namespace std;
|
andrew@24
|
37 using namespace MIDIConstants;
|
andrew@24
|
38
|
andrew@24
|
39 class testApp : public ofBaseApp{
|
andrew@24
|
40
|
andrew@24
|
41 public:
|
andrew@24
|
42 void setup();
|
andrew@24
|
43 void update();
|
andrew@24
|
44 void draw();
|
andrew@24
|
45
|
andrew@24
|
46 void keyPressed (int key);
|
andrew@24
|
47 void keyReleased(int key);
|
andrew@24
|
48 void mouseMoved(int x, int y );
|
andrew@24
|
49 void mouseDragged(int x, int y, int button);
|
andrew@24
|
50 void mousePressed(int x, int y, int button);
|
andrew@24
|
51 void mouseReleased(int x, int y, int button);
|
andrew@24
|
52 void windowResized(int w, int h);
|
andrew@24
|
53
|
andrew@24
|
54 void startPlaying();
|
andrew@24
|
55 void stopPlaying();
|
andrew@24
|
56 bool getFilenameFromDialogBox(string* fileNameToSave);
|
andrew@24
|
57
|
andrew@24
|
58 typedef std::vector<int> IntVector;
|
andrew@24
|
59 typedef std::vector<double> DoubleVector;
|
andrew@24
|
60 // typedef std::vector<IntVector> IntMatrix;
|
andrew@24
|
61 IntVector v;
|
andrew@24
|
62
|
andrew@24
|
63 midiEventHolder midiEvents;
|
andrew@24
|
64
|
andrew@24
|
65 int cannamMainFunction();
|
andrew@24
|
66 string midiFileName;
|
andrew@24
|
67
|
andrew@24
|
68 bool playing;
|
andrew@24
|
69 //drawMidiNotes drawer;
|
andrew@24
|
70
|
andrew@24
|
71 // BayesianArrayStructure bayesStruct;
|
andrew@24
|
72
|
andrew@24
|
73 int screenWidth, screenHeight;
|
andrew@24
|
74 CannamMidiFileLoader fileLoader;
|
andrew@24
|
75
|
andrew@24
|
76 //MIDI INPUT
|
andrew@24
|
77 // vars
|
andrew@24
|
78 int port;
|
andrew@24
|
79 int id;
|
andrew@24
|
80 int value;
|
andrew@24
|
81 double timestamp;
|
andrew@24
|
82 char msg[255];
|
andrew@24
|
83 string portName;
|
andrew@24
|
84
|
andrew@24
|
85 // midi addon
|
andrew@24
|
86 ofxMidiIn midiIn;
|
andrew@24
|
87 // this is your listener function
|
andrew@24
|
88 void newMessage(ofxMidiEventArgs &args);
|
andrew@24
|
89
|
andrew@24
|
90 MidiInputStream noteInStream;
|
andrew@24
|
91
|
andrew@24
|
92 double firstNoteTime;
|
andrew@24
|
93 bool liveInputPlaying;
|
andrew@24
|
94 double timePlayed;
|
andrew@24
|
95 int transpose;
|
andrew@24
|
96 private:
|
andrew@24
|
97 ofxOscReceiver receiver;
|
andrew@24
|
98
|
andrew@24
|
99
|
andrew@24
|
100
|
andrew@24
|
101 };
|
andrew@24
|
102
|
andrew@24
|
103 #endif
|