Commit 0b0eddf5 authored by Dan Wilcox's avatar Dan Wilcox
Browse files

added auto stop commandline arg, don't enable recording on start

parent 11e5df61
......@@ -30,6 +30,7 @@ bool Commandline::parse(int argc, char **argv) {
int inputChannel = 0;
int sampleRate = 0;
bool nolisten = false;
bool autostop = false;
bool verbose = false;
bool version = false;
......@@ -48,6 +49,7 @@ bool Commandline::parse(int argc, char **argv) {
parser.add_option("-r,--samplerate", sampleRate, "audio input device samplerate, can be 441000 or a multiple of " +
ofToString(ofApp::modelSampleRate) + ", default " + ofToString(app->sampleRate));
parser.add_flag( "--nolisten", nolisten, "do not listen on start");
parser.add_flag( "--autostop", autostop, "stop listening automatically after detection");
parser.add_flag( "-v,--verbose", verbose, "verbose printing");
parser.add_flag( "--version", version, "print version and exit");
......@@ -192,6 +194,11 @@ bool Commandline::parse(int argc, char **argv) {
app->stopListening();
}
// auto stop
if(autostop) {
app->autostop = true;
}
return true;
}
......
......@@ -96,17 +96,25 @@ void ofApp::setup() {
output = model.runModel(test);
// osc
ofLogNotice(PACKAGE) << hosts.size() << " sender host(s)";
ofLogNotice(PACKAGE) << hosts.size() << " osc sender host(s)";
for(auto host : hosts) {
ofxOscSender *sender = new ofxOscSender;
if(sender->setup(host.address, host.port)) {
senders.push_back(sender);
ofLogNotice(PACKAGE) << " " << host.address << " " << host.port;
ofLogNotice(PACKAGE) << " " << host.address << " " << host.port;
}
}
ofLogNotice(PACKAGE) << "receiver port " << port;
ofLogNotice(PACKAGE) << "osc receiver port " << port;
receiver.setup(port);
// behavior
if(!listening) {
ofLogNotice(PACKAGE) << "no listen: true";
}
if(autostop) {
ofLogNotice(PACKAGE) << "auto stop: true";
}
ofLogVerbose(PACKAGE) << "Setup done";
ofLogVerbose(PACKAGE) << "============================";
}
......@@ -165,6 +173,11 @@ void ofApp::update() {
message.setAddress("/detecting");
message.addIntArg(0);
for(auto sender: senders) {sender->sendMessage(message);}
// stop after detection?
if(autostop) {
stopListening();
}
}
if(recordingStarted) {
......
......@@ -106,7 +106,8 @@ class ofApp : public ofBaseApp {
std::size_t recordingCounter = 0;
bool trigger = false;
bool enable = true;
bool recording = true;
bool autostop = false;
bool recording = false;
bool blink = true; // recording blink state
float blinkTimestamp = 0; // blink timestamp
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment