annotate hackday/testApp.h @ 52:13194a9dca77 tip

Added exporting of image and text data
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 17 Jul 2012 22:13:10 +0100
parents be2e779d76b5
children
rev   line source
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@27 32 #include "ofxArgs.h"
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@27 43 private:
andrew@27 44 ofxArgs* args;
andrew@27 45 string option1, option2;
andrew@27 46 bool flag1;
andrew@27 47 ofxOscReceiver receiver;
andrew@27 48 ofxOscSender sender;
andrew@27 49
andrew@27 50 public:
andrew@27 51 testApp(ofxArgs* args);
andrew@24 52
andrew@24 53 void setup();
andrew@24 54 void update();
andrew@24 55 void draw();
andrew@24 56
andrew@24 57 void keyPressed (int key);
andrew@24 58 void keyReleased(int key);
andrew@24 59 void mouseMoved(int x, int y );
andrew@24 60 void mouseDragged(int x, int y, int button);
andrew@24 61 void mousePressed(int x, int y, int button);
andrew@24 62 void mouseReleased(int x, int y, int button);
andrew@24 63 void windowResized(int w, int h);
andrew@24 64
andrew@24 65 void startPlaying();
andrew@24 66 void stopPlaying();
andrew@24 67 bool getFilenameFromDialogBox(string* fileNameToSave);
andrew@24 68
andrew@24 69 typedef std::vector<int> IntVector;
andrew@24 70 typedef std::vector<double> DoubleVector;
andrew@24 71 // typedef std::vector<IntVector> IntMatrix;
andrew@24 72 IntVector v;
andrew@24 73
andrew@24 74 midiEventHolder midiEvents;
andrew@24 75
andrew@24 76 int cannamMainFunction();
andrew@24 77 string midiFileName;
andrew@27 78 std::string museScoreFilename;
andrew@27 79
andrew@24 80 bool playing;
andrew@24 81 //drawMidiNotes drawer;
andrew@24 82
andrew@24 83 // BayesianArrayStructure bayesStruct;
andrew@24 84
andrew@24 85 int screenWidth, screenHeight;
andrew@24 86 CannamMidiFileLoader fileLoader;
andrew@24 87
andrew@24 88 //MIDI INPUT
andrew@24 89 // vars
andrew@24 90 int port;
andrew@24 91 int id;
andrew@24 92 int value;
andrew@24 93 double timestamp;
andrew@24 94 char msg[255];
andrew@24 95 string portName;
andrew@24 96
andrew@25 97 void checkNewScoreNote();
andrew@25 98 void sendNoteToMuseScore();
andrew@25 99 void sendMeasureToMuseScore();
andrew@26 100 void sendBlackNotes();
andrew@25 101 void findMeasure();
andrew@26 102
andrew@24 103 // midi addon
andrew@24 104 ofxMidiIn midiIn;
andrew@24 105 // this is your listener function
andrew@24 106 void newMessage(ofxMidiEventArgs &args);
andrew@24 107
andrew@24 108 MidiInputStream noteInStream;
andrew@24 109
andrew@24 110 double firstNoteTime;
andrew@24 111 bool liveInputPlaying;
andrew@24 112 double timePlayed;
andrew@24 113 int transpose;
andrew@25 114 int lastScoreIndexSent;
andrew@25 115 int lastMeasureSent;
andrew@26 116 double performanceRating;
andrew@27 117 void sendNoteDataByOsc(const int& pitch, const int& ticks);
andrew@24 118
andrew@27 119 ofTrueTypeFont verdana30;
andrew@27 120 int midiPort;
andrew@27 121 std::string midiPortName;
andrew@30 122 void loadRecordedMidiFile();
andrew@24 123
andrew@30 124 bool readyToStart;
andrew@30 125 void prepareToStartOnNextNote();
andrew@24 126 };
andrew@24 127
andrew@24 128 #endif