Skip to content

Instantly share code, notes, and snippets.

@mlauss2
Created January 26, 2023 06:51
Show Gist options
  • Save mlauss2/8a7be0f6c8bc15693fdff6330b4c71bc to your computer and use it in GitHub Desktop.
Save mlauss2/8a7be0f6c8bc15693fdff6330b4c71bc to your computer and use it in GitHub Desktop.
Test RtAudio api and port counts
// 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