You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.9KB

  1. /******************************************/
  2. /*
  3. info.cpp
  4. by Gary P. Scavone, 2001
  5. Prints audio system/device info.
  6. */
  7. /******************************************/
  8. #include "RtAudio.h"
  9. #include <iostream.h>
  10. int main(int argc, char *argv[])
  11. {
  12. RtAudio *audio;
  13. RtAudio::RTAUDIO_DEVICE my_info;
  14. try {
  15. audio = new RtAudio();
  16. }
  17. catch (RtError &m) {
  18. m.printMessage();
  19. exit(EXIT_FAILURE);
  20. }
  21. int devices = audio->getDeviceCount();
  22. cout << "\nFound " << devices << " devices ...\n";
  23. for (int i=1; i<=devices; i++) {
  24. try {
  25. audio->getDeviceInfo(i, &my_info);
  26. }
  27. catch (RtError &m) {
  28. m.printMessage();
  29. break;
  30. }
  31. cout << "\nname = " << my_info.name << '\n';
  32. if (my_info.probed == true) {
  33. cout << "probe successful\n";
  34. cout << "maxOutputChans = " << my_info.maxOutputChannels << '\n';
  35. cout << "minOutputChans = " << my_info.minOutputChannels << '\n';
  36. cout << "maxInputChans = " << my_info.maxInputChannels << '\n';
  37. cout << "minInputChans = " << my_info.minInputChannels << '\n';
  38. cout << "maxDuplexChans = " << my_info.maxDuplexChannels << '\n';
  39. cout << "minDuplexChans = " << my_info.minDuplexChannels << '\n';
  40. if (my_info.hasDuplexSupport) cout << "duplex support = true\n";
  41. else cout << "duplex support = false\n";
  42. if (my_info.isDefault) cout << "is default device = true\n";
  43. else cout << "is default device = false\n";
  44. cout << "format = " << my_info.nativeFormats << '\n';
  45. if (my_info.nSampleRates == -1) {
  46. cout << "min_srate = " << my_info.sampleRates[0];
  47. cout << ", max_srate = " << my_info.sampleRates[1] << '\n';
  48. }
  49. else {
  50. cout << "sample rates = ";
  51. for (int j=0; j<my_info.nSampleRates; j++)
  52. cout << my_info.sampleRates[j] << " ";
  53. cout << endl;
  54. }
  55. }
  56. else
  57. cout << "probe unsuccessful\n";
  58. }
  59. cout << endl;
  60. delete audio;
  61. return 0;
  62. }