| 176 | } |
| 177 | |
| 178 | RtAudio ::RtAudio(RtAudio::Api api) |
| 179 | { |
| 180 | rtapi_ = 0; |
| 181 | |
| 182 | if (api != UNSPECIFIED) |
| 183 | { |
| 184 | // Attempt to open the specified API. |
| 185 | openRtApi(api); |
| 186 | if (rtapi_) return; |
| 187 | |
| 188 | // No compiled support for specified API value. Issue a debug |
| 189 | // warning and continue as if no API was specified. |
| 190 | std::cerr << "\nRtAudio: no compiled support for specified API argument!\n" |
| 191 | << std::endl; |
| 192 | } |
| 193 | |
| 194 | // Iterate through the compiled APIs and return as soon as we find |
| 195 | // one with at least one device or we reach the end of the list. |
| 196 | std::vector<RtAudio::Api> apis; |
| 197 | getCompiledApi(apis); |
| 198 | for (unsigned int i = 0; i < apis.size(); i++) |
| 199 | { |
| 200 | openRtApi(apis[i]); |
| 201 | if (rtapi_ && rtapi_->getDeviceCount()) break; |
| 202 | } |
| 203 | |
| 204 | if (rtapi_) return; |
| 205 | |
| 206 | // It should not be possible to get here because the preprocessor |
| 207 | // definition __RTAUDIO_DUMMY__ is automatically defined if no |
| 208 | // API-specific definitions are passed to the compiler. But just in |
| 209 | // case something weird happens, we'll thow an error. |
| 210 | std::string errorText = "\nRtAudio: no compiled API support found ... critical error!!\n\n"; |
| 211 | throw(RtAudioError(errorText, RtAudioError::UNSPECIFIED)); |
| 212 | } |
| 213 | |
| 214 | RtAudio ::~RtAudio() throw() |
| 215 | { |
nothing calls this directly
no test coverage detected