Reputation: 1126
Is there a callback to know when the device list is updated?
If not, is there a way of detecting it ( ideally cross platform )?
At the moment the only way i found is to re-initialise PortAudio.
ps: I tried to find "callbacks" documentation on PortAudio documentation but i failed to find it.
Upvotes: 0
Views: 608
Reputation: 4173
Is there a callback to know when the device list is updated?
Not in the main line code. There is a branch supporting this functionality on some platforms. New contributors are always welcome to help out finish this. It is a much-needed feature.
Note that the device list is never updated between calls to Pa_Initialize()
and Pa_Terminate()
. This is a basic invariant of the API. The branch also supports a refresh
call.
The way to do it with the current version is to use platform-specific checks, then call Pa_Terminate();Pa_Initialize();
as you suggest.
Upvotes: 0
Reputation: 2505
If your OS is Linux, you can use the inotify() system call, and watch the /dev directory, or subdirectory. I don't know about Windows, though.
Upvotes: 1