/******************************************/ /* audioprobe.cpp by Gary P. Scavone, 2001 Probe audio system and prints device info. */ /******************************************/ #include "RtAudio.h" #include #include void usage( void ) { // Error function in case of incorrect command-line // argument specifications std::cout << "\nuseage: audioprobe \n"; std::cout << " where apiname = an optional api (ex., 'core', default = all compiled),\n"; std::cout << " and nRepeats = an optional number of times to repeat the device query (default = 0),\n"; std::cout << " which can be used to test device (dis)connections.\n\n"; exit( 0 ); } std::vector< RtAudio::Api > listApis() { std::vector< RtAudio::Api > apis; RtAudio :: getCompiledApi( apis ); std::cout << "\nCompiled APIs:\n"; for ( size_t i=0; i devices = audio.getDeviceIds(); std::cout << "\nFound " << devices.size() << " device(s) ...\n"; for (unsigned int i=0; i apis = listApis(); // minimal command-line checking if (argc > 3 ) usage(); unsigned int nRepeats = 0; if ( argc > 2 ) nRepeats = (unsigned int) atoi( argv[2] ); char input; for ( size_t api=0; api < apis.size(); api++ ) { if (argc < 2 || apis[api] == RtAudio::getCompiledApiByName(argv[1]) ) { RtAudio audio(apis[api]); for ( size_t n=0; n <= nRepeats; n++ ) { listDevices(audio); if ( n < nRepeats ) { std::cout << std::endl; std::cout << "\nWaiting ... press to repeat.\n"; std::cin.get(input); } } } } return 0; }