diff options
Diffstat (limited to 'sound_detector/main.cpp')
-rw-r--r-- | sound_detector/main.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound_detector/main.cpp b/sound_detector/main.cpp index 9cb67e7..2e576c8 100644 --- a/sound_detector/main.cpp +++ b/sound_detector/main.cpp @@ -143,7 +143,7 @@ void handle_data() level += abs(buffer[i]); level /= buffer.size(); if(debug) - printf("level detected %lu, level required %d\n", level, thresold); + printf("level detected %f, level required %f\n", ((float)level/(float)INT16_MAX)*100, thresold_percent); if(level > thresold) { printf("write started\n"); @@ -174,7 +174,7 @@ void handle_data() level /= buffer.size(); encode_data(vparams); if(debug) - printf("level detected %lu, level lower than %d required to stop\n", level, stop_thresold); + printf("level detected %f, level lower than %f required to stop\n", ((float)level/(float)INT16_MAX)*100, stop_thresold_percent); lock.unlock(); if(level < stop_thresold) { @@ -238,7 +238,6 @@ int main(int argc, char **argv) return 1; } bool _fork = false; - //const unsigned int pecapture = 3, postcapture = 7, min_length = 1, thresold_percent = 5; while((opt = getopt(argc, argv, "hlfvp:P:m:s:S:d:o:")) != -1) { switch(opt) @@ -250,6 +249,7 @@ int main(int argc, char **argv) const PaDeviceInfo *info = Pa_GetDeviceInfo(i); printf("%d. %s, input channels %d, output channels %d, default sample rate %f, lowest input latency %f, highest input latency %f\n", i, info->name, info->maxInputChannels, info->maxOutputChannels, info->defaultSampleRate, info->defaultLowInputLatency, info->defaultHighInputLatency); + exit(0); } break; case 'v': |