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 317 forks source link

Asio probe infinite-loop fix. #393

Closed dbadb closed 1 year ago

dbadb commented 1 year ago

The problem: when my ASIO device is unplugged (driver still installed), deviceProbe finds no devices which results in an infinite loop when RtApiAsio :: probeDevices invokes getDefaultInputDevice() - which re-invokes RtApiAsio :: probeDevices. This problem can be reproduced by running the standard audioprobe test.

In this condition probeDeviceInfo( info ) == false around line 3406.

I'm not claiming that my fix is the best fix but have verified that it unclogs the logjam.

garyscavone commented 1 year ago

I see extraneous code and comments (not currently in the master branch) from an earlier attempt to fix the issue. I understand the fix to the problem is to only call the "getDefaultXXDevice()" functions if the size of deviceList_ > 0?

dbadb commented 1 year ago

indeed, this is the heart of it:

if(deviceList_.size() > 0)
  {
    getDefaultInputDevice();
    getDefaultOutputDevice();
  }
dbadb commented 1 year ago

This was an attempt to squash the multi-step revision to reduce noise of extraneous changes. (git rebase newbie here)

marcelblum commented 1 year ago

thank you so much for this, was driving me nuts 🥲