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.

79 lines
2.3KB

  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>
  10. int main(int argc, char *argv[])
  11. {
  12. RtAudio *audio;
  13. RtAudioDeviceInfo info;
  14. try {
  15. audio = new RtAudio();
  16. }
  17. catch (RtError &error) {
  18. error.printMessage();
  19. exit(EXIT_FAILURE);
  20. }
  21. int devices = audio->getDeviceCount();
  22. std::cout << "\nFound " << devices << " device(s) ...\n";
  23. for (int i=1; i<=devices; i++) {
  24. try {
  25. info = audio->getDeviceInfo(i);
  26. }
  27. catch (RtError &error) {
  28. error.printMessage();
  29. break;
  30. }
  31. std::cout << "\nDevice Name = " << info.name << '\n';
  32. if (info.probed == false)
  33. std::cout << "Probe Status = UNsuccessful\n";
  34. else {
  35. std::cout << "Probe Status = Successful\n";
  36. std::cout << "Output Channels = " << info.outputChannels << '\n';
  37. std::cout << "Input Channels = " << info.inputChannels << '\n';
  38. std::cout << "Duplex Channels = " << info.duplexChannels << '\n';
  39. if (info.isDefault) std::cout << "This is the default device.\n";
  40. else std::cout << "This is NOT the default device.\n";
  41. if ( info.nativeFormats == 0 )
  42. std::cout << "No natively supported data formats(?)!";
  43. else {
  44. std::cout << "Natively supported data formats:\n";
  45. if ( info.nativeFormats & RTAUDIO_SINT8 )
  46. std::cout << " 8-bit int\n";
  47. if ( info.nativeFormats & RTAUDIO_SINT16 )
  48. std::cout << " 16-bit int\n";
  49. if ( info.nativeFormats & RTAUDIO_SINT24 )
  50. std::cout << " 24-bit int\n";
  51. if ( info.nativeFormats & RTAUDIO_SINT32 )
  52. std::cout << " 32-bit int\n";
  53. if ( info.nativeFormats & RTAUDIO_FLOAT32 )
  54. std::cout << " 32-bit float\n";
  55. if ( info.nativeFormats & RTAUDIO_FLOAT64 )
  56. std::cout << " 64-bit float\n";
  57. }
  58. if ( info.sampleRates.size() < 1 )
  59. std::cout << "No supported sample rates found!";
  60. else {
  61. std::cout << "Supported sample rates = ";
  62. for (unsigned int j=0; j<info.sampleRates.size(); j++)
  63. std::cout << info.sampleRates[j] << " ";
  64. }
  65. std::cout << std::endl;
  66. }
  67. }
  68. std::cout << std::endl;
  69. delete audio;
  70. return 0;
  71. }