comparison jnmr/testApp.cpp @ 40:776694bcbd02

removed text and fixed key commands for tempo
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 19 Dec 2011 23:28:21 +0000
parents c3d32207565f
children 60c1f0fbc8f4
comparison
equal deleted inserted replaced
39:5685ef75550c 40:776694bcbd02
73 73
74 screenWidth = ofGetWidth(); 74 screenWidth = ofGetWidth();
75 screenHeight = ofGetHeight(); 75 screenHeight = ofGetHeight();
76 midiEvents.screenWidth = &screenWidth; 76 midiEvents.screenWidth = &screenWidth;
77 midiEvents.screenHeight = &screenHeight; 77 midiEvents.screenHeight = &screenHeight;
78 midiEvents.drawTempoMode = true; 78 //midiEvents.drawTempoMode = true;
79 ofSetFrameRate(30); 79 ofSetFrameRate(30);
80 80
81 midiEvents.ticksPerScreen += 4000; 81 midiEvents.ticksPerScreen += 4000;
82 lastScoreIndexSent = 0; 82 lastScoreIndexSent = 0;
83 performanceRating = 0.0; 83 performanceRating = 0.0;
256 m.addStringArg( noteString); 256 m.addStringArg( noteString);
257 sender.sendMessage( m ); 257 sender.sendMessage( m );
258 } 258 }
259 259
260 void testApp::sendNoteToMuseScore(){ 260 void testApp::sendNoteToMuseScore(){
261 if (midiEvents.recordedNoteOnMatrix.size() > 0){ 261 int noteToSendIndex = lastScoreIndexSent;
262 int ticks = midiEvents.recordedNoteOnMatrix[midiEvents.bestMatchIndex][0]; 262 while (noteToSendIndex < midiEvents.bestMatchIndex){
263 int pitch = midiEvents.recordedNoteOnMatrix[midiEvents.bestMatchIndex][1]; 263 noteToSendIndex++;
264 // printf("sending to muse score %i, %i \n", ticks, pitch); 264 if (midiEvents.recordedNoteOnMatrix.size() > 0 && noteToSendIndex < midiEvents.recordedNoteOnMatrix.size()){
265 sendNoteDataByOsc(pitch, ticks); 265 int ticks = midiEvents.recordedNoteOnMatrix[noteToSendIndex][0];//midiEvents.bestMatchIndex
266 int pitch = midiEvents.recordedNoteOnMatrix[noteToSendIndex][1];
267 // printf("sending to muse score %i, %i \n", ticks, pitch);
268 sendNoteDataByOsc(pitch, ticks);
269 }
266 } 270 }
267 /* 271 /*
268 ofxOscMessage m; 272 ofxOscMessage m;
269 m.setAddress( "/plugin" ); 273 m.setAddress( "/plugin" );
270 string noteString; 274 string noteString;
360 ofSetHexColor(0xFF0000); 364 ofSetHexColor(0xFF0000);
361 // ofDrawBitmapString(info, 20, 20); 365 // ofDrawBitmapString(info, 20, 20);
362 366
363 midiEvents.drawMidiFile(noteInStream.midiInputEvents); 367 midiEvents.drawMidiFile(noteInStream.midiInputEvents);
364 368
365 drawMuseScoreText(); 369 //drawMuseScoreText();
366 370
367 ofSetHexColor(0x000000); 371 ofSetHexColor(0x000000);
368 ofDrawBitmapString(midiPortName, 20, ofGetHeight() - 20); 372 ofDrawBitmapString(midiPortName, 20, ofGetHeight() - 20);
369 373
370 } 374 }
462 if (key == 'p'){ 466 if (key == 'p'){
463 midiEvents.printNotes(); 467 midiEvents.printNotes();
464 } 468 }
465 469
466 if (key == 'l') 470 if (key == 'l')
467 471 midiEvents.bayesStruct.decaySpeedDistribution(100);
468 472
469 //midiEvents.bayesStruct.decaySpeedDistribution(100); 473 if (key == 'f'){
470 474 //flip
471 if (key == 't')
472 midiEvents.drawTempoMode = !midiEvents.drawTempoMode; 475 midiEvents.drawTempoMode = !midiEvents.drawTempoMode;
476 midiEvents.drawPhaseMode = !midiEvents.drawPhaseMode;
477 }
478
479
480 if (key == 't'){
481 midiEvents.drawTempoMode = !midiEvents.drawTempoMode;
482 }
473 483
474 if (key == 'y') 484 if (key == 'y')
475 midiEvents.drawPhaseMode = !midiEvents.drawPhaseMode; 485 midiEvents.drawPhaseMode = !midiEvents.drawPhaseMode;
476 486
477 if (key == 'r'){ 487 if (key == 'r'){