andrew@33: #ifndef _TEST_APP andrew@33: #define _TEST_APP andrew@33: andrew@33: andrew@33: //midieventholder - newMidiEvents() sent there andrew@33: //create cannamMidiLoader for cannamMainfunction andrew@33: andrew@33: andrew@33: //check new prior offset function - how is used? andrew@33: andrew@33: andrew@33: andrew@33: //check the widening function - adding decay noise andrew@33: //ticksperscreen could be better as millis per screen andrew@33: andrew@37: //uses ftmMidiPlay in max5 via osc to communicate notes in andrew@33: andrew@33: andrew@37: //other users would need to change root in testApp setup to point to their director for the RWC files andrew@33: andrew@48: andrew@48: andrew@33: #include "ofMain.h" andrew@33: andrew@33: #include "MIDIFileReader.h" andrew@33: #include "ofxFileDialogOSX.h" andrew@33: #include "drawMidiNotes.h" andrew@34: andrew@33: #include "CannamMidiFileLoader.h" andrew@33: #include andrew@33: #include "midiEventHolder.h" andrew@33: #include "ofxMidiIn.h" andrew@33: #include "ofxOsc.h" andrew@33: #include "MidiInputStream.h" andrew@33: #include "ofxArgs.h" andrew@36: #include "Annotations.h" andrew@34: andrew@34: // basic file operations for text file stuff andrew@34: #include andrew@34: #include andrew@34: using namespace std; andrew@34: andrew@33: #define PORT 12121 andrew@33: #define SEND_PORT 5282 andrew@33: #define HOST "localhost" andrew@33: andrew@33: using namespace MIDIConstants; andrew@33: andrew@33: class testApp : public ofBaseApp{ andrew@33: private: andrew@33: ofxArgs* args; andrew@33: string option1, option2; andrew@33: bool flag1; andrew@33: ofxOscReceiver receiver; andrew@33: ofxOscSender sender; andrew@33: andrew@33: public: andrew@33: testApp(ofxArgs* args); andrew@33: andrew@33: void setup(); andrew@33: void update(); andrew@33: void draw(); andrew@33: andrew@33: void keyPressed (int key); andrew@33: void keyReleased(int key); andrew@33: void mouseMoved(int x, int y ); andrew@33: void mouseDragged(int x, int y, int button); andrew@33: void mousePressed(int x, int y, int button); andrew@33: void mouseReleased(int x, int y, int button); andrew@33: void windowResized(int w, int h); andrew@33: andrew@48: void checkOSCmessages(); andrew@33: void startPlaying(); andrew@33: void stopPlaying(); andrew@33: bool getFilenameFromDialogBox(string* fileNameToSave); andrew@33: andrew@33: typedef std::vector IntVector; andrew@33: typedef std::vector DoubleVector; andrew@33: // typedef std::vector IntMatrix; andrew@33: IntVector v; andrew@33: andrew@33: midiEventHolder midiEvents; andrew@33: andrew@33: int cannamMainFunction(); andrew@33: string midiFileName; andrew@33: std::string museScoreFilename; andrew@33: andrew@33: bool playing; andrew@33: //drawMidiNotes drawer; andrew@33: andrew@33: // BayesianArrayStructure bayesStruct; andrew@33: andrew@33: int screenWidth, screenHeight; andrew@33: CannamMidiFileLoader fileLoader; andrew@33: andrew@33: //MIDI INPUT andrew@33: // vars andrew@33: int port; andrew@33: int id; andrew@33: int value; andrew@33: double timestamp; andrew@33: char msg[255]; andrew@33: string portName; andrew@33: andrew@33: void checkNewScoreNote(); andrew@33: void sendNoteToMuseScore(); andrew@33: void sendMeasureToMuseScore(); andrew@33: void sendBlackNotes(); andrew@33: void findMeasure(); andrew@33: andrew@33: // midi addon andrew@33: ofxMidiIn midiIn; andrew@33: // this is your listener function andrew@33: void newMessage(ofxMidiEventArgs &args); andrew@33: andrew@33: MidiInputStream noteInStream; andrew@33: andrew@33: double firstNoteTime; andrew@33: bool liveInputPlaying; andrew@33: double timePlayed; andrew@33: int transpose; andrew@33: int lastScoreIndexSent; andrew@33: int lastMeasureSent; andrew@33: double performanceRating; andrew@33: void sendNoteDataByOsc(const int& pitch, const int& ticks); andrew@33: andrew@33: ofTrueTypeFont verdana30; andrew@33: int midiPort; andrew@33: std::string midiPortName; andrew@33: void loadRecordedMidiFile(); andrew@33: andrew@33: bool readyToStart; andrew@33: void prepareToStartOnNextNote(); andrew@34: void drawMuseScoreText(); andrew@36: void readInSomeValues(); andrew@34: andrew@34: andrew@34: andrew@34: //file output andrew@34: ofstream myfile; andrew@37: ofstream diffFile; andrew@37: string root, outputFileRoot; andrew@37: int midiFileNumber; andrew@37: void loadRWCfileNumber(const int& i); andrew@37: void openOutputFile(const int& i); andrew@38: std::string makeRWCfilename(std::string& root, const int& fileID, std::string& endPart); andrew@38: void loadAnnotation(const int& fileID); andrew@41: andrew@41: vector rwcFileNameStrings; andrew@41: void createRWCfilenameStrings(); andrew@49: string annotationRoot ;//eg = "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C0"; andrew@33: }; andrew@33: andrew@33: #endif