Created
January 26, 2023 06:51
-
-
Save mlauss2/8a7be0f6c8bc15693fdff6330b4c71bc to your computer and use it in GitHub Desktop.
Test RtAudio api and port counts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -lrtaudio -o rtatest rtatest.cpp | |
#include <rtaudio/RtAudio.h> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int a, char **b) | |
{ | |
std::vector<RtAudio::Api> apis; | |
RtAudio::getCompiledApi(apis); | |
for (auto m = apis.begin(); m != apis.end(); m++) { | |
std::cout << "trying " << (int)*m << ": " << RtAudio::getApiDisplayName(*m) << std::endl; | |
try { | |
RtAudio *rta = new RtAudio(*m); | |
if (rta) { | |
std::cout << "num ports: " << rta->getDeviceCount() << std::endl; | |
delete rta; | |
} | |
} | |
catch(...) { | |
std::cout << "caught exception" << std::endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment