This method can be modified to control the behavior of error message printing.
| 10504 | // This method can be modified to control the behavior of error |
| 10505 | // message printing. |
| 10506 | void RtApi ::error(RtAudioError::Type type) |
| 10507 | { |
| 10508 | errorStream_.str(""); // clear the ostringstream |
| 10509 | |
| 10510 | RtAudioErrorCallback errorCallback = (RtAudioErrorCallback)stream_.callbackInfo.errorCallback; |
| 10511 | if (errorCallback) |
| 10512 | { |
| 10513 | // abortStream() can generate new error messages. Ignore them. Just keep original one. |
| 10514 | |
| 10515 | if (firstErrorOccurred_) |
| 10516 | return; |
| 10517 | |
| 10518 | firstErrorOccurred_ = true; |
| 10519 | const std::string errorMessage = errorText_; |
| 10520 | |
| 10521 | if (type != RtAudioError::WARNING && stream_.state != STREAM_STOPPED) |
| 10522 | { |
| 10523 | stream_.callbackInfo.isRunning = false; // exit from the thread |
| 10524 | abortStream(); |
| 10525 | } |
| 10526 | |
| 10527 | errorCallback(type, errorMessage); |
| 10528 | firstErrorOccurred_ = false; |
| 10529 | return; |
| 10530 | } |
| 10531 | |
| 10532 | if (type == RtAudioError::WARNING && showWarnings_ == true) |
| 10533 | std::cerr << '\n' |
| 10534 | << errorText_ << "\n\n"; |
| 10535 | else if (type != RtAudioError::WARNING) |
| 10536 | throw(RtAudioError(errorText_, type)); |
| 10537 | } |
| 10538 | |
| 10539 | void RtApi ::verifyStream() |
| 10540 | { |