Skip to content

Uniquely identify sound devices on Windows#1160

Open
bear101 wants to merge 2 commits into
PortAudio:masterfrom
bear101:win-unique-id
Open

Uniquely identify sound devices on Windows#1160
bear101 wants to merge 2 commits into
PortAudio:masterfrom
bear101:win-unique-id

Conversation

@bear101

@bear101 bear101 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

If a user unplugs a USB headset and plugs it into another USB port then the sound device may get a new PaDeviceIndex, i.e. we cannot use PaDeviceIndex to identify a sound device.

With this change a sound device (PaDeviceInfo) can be uniquely identified after a Pa_Terminate()/Pa_Initialize().

So far only Windows is supported (using the sound device's GUID).

If a user unplugs a USB headset and plugs it into another USB port
then the sound device may get a new PaDeviceIndex, i.e. we cannot use
PaDeviceIndex to identify a sound device.

With this change a sound device (PaDeviceInfo) can be uniquely
identified after a Pa_Terminate()/Pa_Initialize().

So far only Windows is supported (using the sound device's GUID).
Comment thread include/portaudio.h
PaTime defaultHighOutputLatency;

double defaultSampleRate;
const char* uniqueID;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an API change so it cannot go into V19.
We can discuss this for V20.

Changing structure sizes can break code, even with the structure version. Adding an additional function might be safer.

@philburk

philburk commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

CI is failing with:

D:/a/_temp/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/16.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/hostapi/wmme/.libs/pa_win_wmme.o:pa_win_wmme.c:(.rdata$.refptr.GUID_NULL[.refptr.GUID_NULL]+0x0): undefined reference to `GUID_NULL'

I recommend creating an Issue. We need to discuss the problem before we can consider the possible solutions.

@philburk philburk added the enhancement New feature or request label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants