diff options
Diffstat (limited to 'TRSS_02_rec/src/testApp.cpp')
| -rw-r--r-- | TRSS_02_rec/src/testApp.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/TRSS_02_rec/src/testApp.cpp b/TRSS_02_rec/src/testApp.cpp index 5aad050..376d357 100644 --- a/TRSS_02_rec/src/testApp.cpp +++ b/TRSS_02_rec/src/testApp.cpp @@ -9,14 +9,14 @@ void testApp::setup() { for (int deviceID = 0; deviceID < numDevices; deviceID++){ //openNIRecorders[deviceID].setLogLevel(OF_LOG_VERBOSE); - openNIRecorders[deviceID].setup(); + openNIRecorders[deviceID].setup(false); openNIRecorders[deviceID].addDepthGenerator(); openNIRecorders[deviceID].addImageGenerator(); openNIRecorders[deviceID].setRegister(true); // this registers all the image pixels to the depth pixels openNIRecorders[deviceID].setMirror(true); // flips the image and depth sensors openNIRecorders[deviceID].start(); - openNIPlayers[deviceID].setup(); + openNIPlayers[deviceID].setup(false); openNIPlayers[deviceID].start(); filenames[deviceID]=""; @@ -25,7 +25,10 @@ void testApp::setup() { isLive=true; isRecording=false; - verdana.loadFont(ofToDataPath("verdana.ttf"), 24); + verdana.loadFont(ofToDataPath("verdana.ttf"), 10); + + startSound.loadSound("tone1.wav"); + stopSound.loadSound("tone0.wav");; } @@ -51,6 +54,9 @@ void testApp::update(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ if (isLive) { openNIRecorders[deviceID].update(); + if (isRecording){ + recorded++; + } } else { openNIPlayers[deviceID].update(); @@ -60,33 +66,43 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ + ofBackground(0, 0, 0); ofSetColor(255, 255, 255); ofPushMatrix(); for (int deviceID = 0; deviceID < numDevices; deviceID++){ - ofTranslate(0, deviceID * 480); + ofTranslate(0, deviceID * 450); if (isLive) { - openNIRecorders[deviceID].drawDebug(); // draws all generators - //openNIRecorders[deviceID].drawDepth(0, 0); - //openNIRecorders[deviceID].drawImage(640, 0); + //openNIRecorders[deviceID].drawDebug(); // draws all generators + openNIRecorders[deviceID].drawDepth(200, 0,600,450); + openNIRecorders[deviceID].drawImage(800, 0,600,450); } else { - openNIPlayers[deviceID].drawDebug(); + //openNIPlayers[deviceID].drawDebug(); + openNIPlayers[deviceID].drawDepth(200, 0,600,450); + openNIPlayers[deviceID].drawImage(800, 0,600,450); } } ofPopMatrix(); - ofSetColor(0, 255, 0); - string msg = " MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + " FPS: " + ofToString(ofGetFrameRate()); - verdana.drawString(msg, 20, numDevices * 480 - 20); + ofSetColor(255, 255, 255); + string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + "\nFPS: " + ofToString(ofGetFrameRate()); + if (isRecording) { + msg +="\nrecorded "+ofToString(recorded); + } + if (!isLive) { + msg +="\n"+filenames[0]; + } + verdana.drawString(msg, 10, 10); } //-------------------------------------------------------------- void testApp::exit(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ openNIRecorders[deviceID].stop(); + openNIPlayers[deviceID].stop(); } } @@ -98,6 +114,7 @@ void testApp::keyPressed(int key){ if (isRecording) { for (int deviceID = 0; deviceID < numDevices; deviceID++){ openNIRecorders[deviceID].stopRecording(); + stopSound.play(); } isRecording = false; break; @@ -105,8 +122,10 @@ void testApp::keyPressed(int key){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ filenames[deviceID]=generateFileName(deviceID); openNIRecorders[deviceID].startRecording(generateFileName(deviceID)); + startSound.play(); } isRecording = true; + recorded=0; break; } break; |
