21 #include "audio_capture_manager.h"
27 std::cout<<
"\n--- audio capture test application menu ---\n";
28 std::cout<<
"1. q_mgr start (non-essential step)\n";
29 std::cout<<
"2. q_mgr stop (non-essential step)\n";
30 std::cout<<
"3. dump precaptured sample\n";
31 std::cout<<
"4. set precapture length\n";
32 std::cout<<
"5. capture next N seconds\n";
33 std::cout<<
"6. Start client\n";
34 std::cout<<
"7. Stop client\n";
35 std::cout<<
"9. Quit.\n";
38 static std::string callback_payload =
"Uninitialized";
39 static unsigned int ticker = 0;
40 static std::string get_suffix()
42 std::ostringstream stream;
45 std::string outstring = stream.str();
51 bool keep_running =
true;
54 client.enable_wav_header(
true);
62 std::cout<<
"Enter command:\n";
63 if(!(std::cin >> choice))
67 std::cin.ignore(10000,
'\n');
79 filename =
"/tmp/precap-"+ get_suffix();
80 client.grab_precaptured_sample(filename);
81 std::cout<<
"Output file "<<filename<<std::endl;
85 std::cout<<
"Enter precapture duration in seconds:\n";
86 if(!(std::cin>>duration))
88 std::cout<<
"Whoops! Bad input.\n";
90 std::cin.ignore(10000,
'\n');
94 client.set_precapture_duration(duration);
100 std::cout<<
"Enter capture duration in seconds:\n";
101 if(!(std::cin>>duration))
103 std::cout<<
"Whoops! Bad input.\n";
105 std::cin.ignore(10000,
'\n');
109 filename =
"/tmp/freshcap-"+ get_suffix();
110 client.grab_fresh_sample(duration, filename);
111 std::cout<<
"Output file "<<filename<<std::endl;
127 keep_running =
false;
128 std::cout<<
"Quitting.\n";
132 std::cout<<
"Unknown input!\n";
138 int main(
int argc,
char *argv[])