Skip to content

Conversation

nbolender
Copy link

The device ID is not consistent when unplugging and re-plugging an external audio source (it is some sort of counter). So this presents a problem when you want to choose a specific device.

macOS exposes a UID string for each audio device. The format of this string is a black box. For example, for built-in devices it is a simple string like BuiltInSpeakerDevice, but for a DisplayPort device it may be something like AppleGFXHDAEngineOutputDP:30001:0:{AD19-43B2-5257260B}. In the second case, the same device may appear as AppleGFXHDAEngineOutputDP:30001:1:{AD19-43B2-5257260B} if it is the second DisplayPort device currently plugged in.

So to support switching inputs by UID, this PR checks against a substring and it is left to the user to find the unique portion of the string. For the above example, running SwitchAudioSource -u AD19-43B2-5257260B always selects the appropriate device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant