Display UID and allow setting by a substring of UID #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeAppleGFXHDAEngineOutputDP:30001:0:{AD19-43B2-5257260B}
. In the second case, the same device may appear asAppleGFXHDAEngineOutputDP: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.