RFC: Duplicate in/out device naming

Andrew Eikum aeikum at codeweavers.com
Tue Mar 27 11:04:08 CDT 2012


I'm working on Bug 14559 and have run into an interesting UI problem.

In WinMM, there are three "classes" of devices: waveIn, waveOut, and
mixer.  Windows 7's WinMM implementation provides one mixer for each
waveIn and waveOut device. The "WCHAR caps.szPname[32]" field for the
matching mixer and waveIn/Out device are the same. Some applications,
in this case Rosetta Stone 3, use the matching szPname fields to
determine which mixer to associate with which device.

The problem turns up when we have duplicate input and output device
names. Consider:

waveOut:
0: default
1: HDA Intel Analog
2: HDA Intel Digital

waveIn:
0: default
1: HDA Intel Analog

mixer:
0: default
1: HDA Intel Analog
2: HDA Intel Digital
3: default
4: HDA Intel Analog

Rosetta Stone chooses waveIn[0] and starts iterating over the mixers'
szPname fields, finding that mixer[0] matches. But, mixer[0] is
actually associated with the waveOut default, not the waveIn default.
Bad things happen.

Windows 7 solves this problem implicitly by providing unique device
names at the MMDevAPI level. For instance, the input device is
Microphone and the output devices are Stereo and Headphones. Hacking
the registry to force duplicate MMDevAPI device names actually does
result in duplicate mixer names. But Wine's backends don't provide
this kind of information, so we simply provide the ALSA device name as
the device's name.

As an attempt to solve this in Wine, I added a prefix to each MMDevice
indicating its flow direction.  The unique identifier must be a
prefix, as WinMM's szPname field truncates at 31 characters. This
gives WinMM device names like:

waveOut:
0: Out: default
1: Out: HDA Intel Analog
2: Out: HDA Intel Digital

This solves the Rosetta Stone issue, as you can see in the bug. But
when testing this in other applications, it quickly becomes silly.
Audacity 1.3 adds its own "Out: " prefix to WinMM device names,
creating "Out: Out: default" in the UI.

Dynamically adding prefixes only if a duplicate device is present
causes issues with duplicates appearing/disappearing. Trying to
remember if a duplicate has ever been present is quite "ugly" in code,
requiring storing that kind of information in the registry.

So I don't know what to do. Have ugly, redundant device names? Leave
Rosetta Stone broken, as it is arguably an application bug? Try to
guess at the device type, and insert names like "Speakers" and
"Microphone" into the MMDevAPI device name, even if that might be
wrong?

Thoughts?

Andrew



More information about the wine-devel mailing list