diff --git a/README.md b/README.md index 74898cd3..8abe1b12 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ No config options. | Variable | Description | Return type | Supported OS | | ------------------- | ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `defaultDevice` | Default audio output device. | `AudioDevice \| null` | microsoft icon | -| `devices` | All devices. | `AudioDevice[]` | microsoft icon | +| `defaultPlaybackDevice` | Default audio playback device. | `AudioDevice \| null` | microsoft icon | +| `playbackDevices` | All audio playback devices. | `AudioDevice[]` | microsoft icon | #### Return types @@ -93,9 +93,9 @@ No config options. | Variable | Description | Return type | | ------------------ | ----------------------------- | ----------------------- | | `deviceId` | Device ID. | `string` | -| `name` | Friendly display name. | `string` | +| `name` | Friendly display name of device. | `string` | | `volume` | Volume as a % of maximum volume. Returned value is between `0` and `100`. | `number` | -| `isDefault` | `true` if the device is selected as the default output device.| `boolean` | +| `isDefault` | `true` if the device is selected as the default playback device.| `boolean` | ### Battery diff --git a/examples/boilerplate-solid-ts/src/index.tsx b/examples/boilerplate-solid-ts/src/index.tsx index bdbc228c..1a6ce453 100644 --- a/examples/boilerplate-solid-ts/src/index.tsx +++ b/examples/boilerplate-solid-ts/src/index.tsx @@ -23,8 +23,8 @@ function App() { return (
- {output.audio?.defaultDevice?.name} - - {output.audio?.defaultDevice?.volume} + {output.audio?.defaultPlaybackDevice?.name} - + {output.audio?.defaultPlaybackDevice?.volume}
Media: {output.media?.session?.title} - diff --git a/packages/client-api/src/providers/audio/audio-provider-types.ts b/packages/client-api/src/providers/audio/audio-provider-types.ts index bfccac52..dab6d41d 100644 --- a/packages/client-api/src/providers/audio/audio-provider-types.ts +++ b/packages/client-api/src/providers/audio/audio-provider-types.ts @@ -7,8 +7,8 @@ export interface AudioProviderConfig { export type AudioProvider = Provider; export interface AudioOutput { - defaultDevice: AudioDevice; - devices: AudioDevice[]; + defaultPlaybackDevice: AudioDevice; + playbackDevices: AudioDevice[]; } export interface AudioDevice { diff --git a/packages/desktop/src/providers/audio/audio_provider.rs b/packages/desktop/src/providers/audio/audio_provider.rs index af760c75..3c71e1c4 100644 --- a/packages/desktop/src/providers/audio/audio_provider.rs +++ b/packages/desktop/src/providers/audio/audio_provider.rs @@ -56,15 +56,15 @@ pub struct AudioDevice { #[derive(Debug, Clone, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AudioOutput { - pub devices: Vec, - pub default_device: Option, + pub playback_devices: Vec, + pub default_playback_device: Option, } impl AudioOutput { fn new() -> Self { Self { - devices: Vec::new(), - default_device: None, + playback_devices: Vec::new(), + default_playback_device: None, } } } @@ -196,8 +196,8 @@ impl MediaDeviceEventHandler { if let Some(state) = AUDIO_STATE.get() { let mut audio_state = state.lock().unwrap(); - audio_state.devices = devices; - audio_state.default_device = default_device; + audio_state.playback_devices = devices; + audio_state.default_playback_device = default_device; } AudioProvider::emit_volume(); @@ -320,14 +320,18 @@ impl AudioProvider { ); // Update device in the devices list. - if let Some(device) = - output.devices.iter_mut().find(|d| d.device_id == device_id) + if let Some(device) = output + .playback_devices + .iter_mut() + .find(|d| d.device_id == device_id) { device.volume = volume; } // Update default device if it matches. - if let Some(default_device) = &mut output.default_device { + if let Some(default_device) = + &mut output.default_playback_device + { if default_device.device_id == device_id { default_device.volume = volume; }