thestk / rtaudio

A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
Other
1.49k stars 318 forks source link

WARNING errors dificult to catch on C #285

Closed sonoro1234 closed 2 years ago

sonoro1234 commented 3 years ago

https://github.com/thestk/rtaudio/blob/master/RtAudio.cpp#L2900

sets the error type to WARNING and then https://github.com/thestk/rtaudio/blob/master/RtAudio.cpp#L10265 (and errorCallback is not set in C)

So that an error is printed and nothing else happens. (Althought it is a severe error: device not present)

I would be necessary for C interface making WARNING errors to throw (may be a variable throwWarnings similar to showWarnings)

A workaround for this case is testing info.probed being true.

garyscavone commented 3 years ago

There is definitely room for improvement in “error” reporting and I repeat that I think the changes made in the noexceptions branch are an improvement. But with regard to this specific case, the problem happens inside the getDeviceInfo() function. If there is a problem initializing the ASIO driver, I don’t see the point of throwing an exception. Instead, the function should return an empty info structure indicating no device available. Then the user can perhaps query a different API to try to find a working device.

On Mar 24, 2021, at 7:36 AM, Victor Bombi @.**@.>> wrote:

https://github.com/thestk/rtaudio/blob/master/RtAudio.cpp#L2900

sets the error type to WARNING and then https://github.com/thestk/rtaudio/blob/master/RtAudio.cpp#L10265 (and errorCallback is not set in C)

So that an error is printed and nothing else happens. (Althought it is a severe error: device not present)

I would be necessary for C interface making WARNING error to throw (may be a variable throwWarnings similar to showWarnings)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/thestk/rtaudio/issues/285, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABJYDJJ4SCDZWDMUYA6UHVLTFHFCFANCNFSM4ZXCKVVQ.

sonoro1234 commented 3 years ago

Instead, the function should return an empty info structure indicating no device available.

checking info.probed != 0 is enough for me.

garyscavone commented 2 years ago

Stale issue and not sure it is still relevant given all the changes since it was posted.