-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add callback API for detecting connection/removal of devices (aka "hotplug") #11
Comments
Comment by @RossBencina Robert Bielik adds: As it is now, the available audio devices are discovered during Pa_Initialize(). I'd like to have it possible to check if any new devices have been added (such as a headset), while still playing a stream with connected devices. Would that be possible? |
Comment by @RossBencina Erik Bunce submitted a patch for this in October 2007: There were a number of issues raised, see discussion in October: All under the subject "Plug-and-play patch for portaudio" From memory one of the issues was concerned with dealing with concurrency issues. This issue needs to revisited and a decision reached. |
Comment by @RossBencina r1663:
Open questions:
r1664 includes a cleaned up version of pa_win_ds.c where the scanning code is also used by Initialize() |
Comment by @RossBencina For the open issues about the notification mechanism mentioned in comment 2 above see: |
Comment by @RossBencina TRAC migration: propagating ticket status from TRAC |
Comment by @RossBencina portaudio-deviceschanged.patch.txt portaudio-deviceschanged.patch (44.7 KB) - added by rossb 4 years ago. [Portaudio] Plug-and-play patch for portaudio Highlights includes the following:
Thank you for your consideration. Thanks and Enjoy, |
Comment by @RossBencina Patches from Ingo Bauersachs of jitsi: This is the source we're currently using: The should be the diff from SVN-1677 to what is in the above .zip: And the wmme-patch is on our list archives: There are useful commit messages with details about the patches here: This is now in PortAudio GIT as a sequence of commits here: |
Comment by @RossBencina Here is my review of the jitsi patch from here: Also available in PortAudio GIT: (Note: the MME mailing list patch seems redundant. It is slightly different from 5ca6fed, but doesn't appear to contain any functional differences. http://lists.jitsi.org/pipermail/dev/2012-July/004183.html) The changes seem to fall into the following categories:
Broken down by file. I've marked changes that we won't accept with WONTFIX Routine Changes Makefile.in
configure
Major Changes Incl. Hotplug src/hostapi/alsa/pa_linux_alsa.c
src/hostapi/coreaudio/pa_mac_core.c
src/hostapi/coreaudio/pa_mac_core_blocking.c
src/hostapi/coreaudio/pa_mac_core_blocking.h
src/os/win/pa_win_hotplug.c
src/hostapi/wmme/pa_win_wmme.c
New Files Incl. Hotplug src/os/mac_osx/pa_osx_hotplug.c
src/os/unix/pa_linux_hotplug.c
Non-Hotplug Tweaks We Might Want (or not) include/pa_mac_core.h
src/hostapi/wdmks/pa_win_wdmks.c
Changes Already In PA/hotplug src/hostapi/asio/pa_asio.cpp
WONTFIX include/portaudio.h
src/common/pa_front.c
src/hostapi/dsound/pa_win_ds.c
test/patest_update_available_device_list.c
|
Comment by @RossBencina Here's a breakdown of the separated Jitsi commits that are available in PortAudio GIT here:
|
checking in whats the status for connectionId and identifying sound cards (if many) by the raw usb-descriptor serial number |
@raveslave status is that connectionId iss part of hotplug spec, there is partial implementation in the stale branch. I don't think most USB devices have serial numbers. |
any plans on merging? I've tried a bunch of various sound cards and they all have serial-nos in the main descriptor. |
@raveslave: out of interest, can you give examples of the devices with unique serial numbers? |
Here is the top level descriptor for a Motu M2:
would be great if portaudio exposes pid, vid, version, serial, mfg as well as usb port related when used with sounddevice,
|
The USB Serial Number is not a good identifier for this purpose:
Instead you should use the unique device identifiers, which the operating systems assigned at runtime. These are:
|
I still think the usb descriptor serial should be exposed as this is the only identifier (available on most pro-sumer / professional sound cards) to allow calibration, i.e. measured setups, needing to know which exact soundcard is connected. The location-id is good to but changes upon each reconnect or reboot. How about offer both and let the application choose how to use them? |
The location-id will always work, it's a guranteed unique identifier. Using this unique identifier as reference, you can gather any additional information, like the USB serial number. |
how about offering both, with location-id being the primary? its important you can move a soundcard from one machine to another and still knowing which one it is |
Well, you can build a hash from a few known values that are guaranteed to
be the same, no matter where you plug, and use this hash to map to your
calibration signal.
This method also delivers the freedom to not depend on PA providing such
identifier.
And still, you can use these IDs you are looking for to build such hash.
I've built a python library that uses PA as "audio engine" for room
acoustics measurements (PyTTa), and our lab's technique to keep the
calibration between measurements and even between measurement sessions, for
any reason, was exactly a hash map like this.
Em seg, 9 de jan de 2023 17:46, david eriksson ***@***.***>
escreveu:
… how about offering both, with location-id being the primary?
its important you can move a soundcard from one machine to another and
still knowing which one it is
afaik, location-id will not be same in that use-case
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJPYUKCPFIPUHAHNSNF34WLWRR2MHANCNFSM6AAAAAASYGPLUI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
What's the status on the hotplug branch ? It looks like it is stale for almost 7 years now; How far is it to be usable ? |
Issue created by @RossBencina
Add an API to allow clients to be notified (or to poll) for whether audio devices have been connected or disconnected.
The text was updated successfully, but these errors were encountered: