Skip to content
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

feat: implement getDeviceByUID method #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lbdremy
Copy link

@lbdremy lbdremy commented Jan 16, 2023

Hi,

This PR includes a new method getDeviceByUID which does exactly that ^^ get a device using its UID instead of id, it can be useful as the UID is known ahead of creation of the device, as well that the only way to find an hidden device (as explained here https://gist.github.com/kdepp/46c812b05cda6e44a292328b31d0784c#file-audiohardwarebase-h-L696-L700).
That's my first time I'm writing some Swift so it works but it is probably not optimal, feedbacks really welcome.

Thanks for your time

@@ -91,7 +91,7 @@ export const getDevice: {
const device = await getDevice(73);
```
*/
(): Promise<Device>;
(deviceId: number): Promise<Device>;
Copy link
Author

Choose a reason for hiding this comment

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

typescript definition fix, not related to the main purpose of this PR, sorry.

@@ -265,7 +306,7 @@ final class SetVolumeCommand: Command {
@Param var volume: Double

func execute() throws {
var device = try getDevice(deviceId: deviceId)
let device = try getDevice(deviceId: deviceId)
Copy link
Author

Choose a reason for hiding this comment

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

small fix for warning during compilation.

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