-
Notifications
You must be signed in to change notification settings - Fork 469
properly detect is_default in Device::new() for MacOS
#996
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
Changes from 6 commits
cbdbfc5
7e6ca1b
5d7fcb2
4b2b638
05fe95e
e20b7b1
337516e
c55a6ce
b3c6011
dc047ec
6cccbc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,9 +22,9 @@ use objc2_core_audio::{ | |||||
| kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyStreamConfiguration, | ||||||
| kAudioDevicePropertyStreamFormat, kAudioObjectPropertyElementMaster, | ||||||
| kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput, | ||||||
| kAudioObjectPropertyScopeOutput, AudioDeviceID, AudioObjectGetPropertyData, | ||||||
| AudioObjectGetPropertyDataSize, AudioObjectID, AudioObjectPropertyAddress, | ||||||
| AudioObjectPropertyScope, AudioObjectSetPropertyData, | ||||||
| kAudioObjectPropertyScopeOutput, AudioDeviceID, | ||||||
| AudioObjectGetPropertyData, AudioObjectGetPropertyDataSize, AudioObjectID, | ||||||
| AudioObjectPropertyAddress, AudioObjectPropertyScope, AudioObjectSetPropertyData, | ||||||
| }; | ||||||
| use objc2_core_audio_types::{ | ||||||
| AudioBuffer, AudioBufferList, AudioStreamBasicDescription, AudioValueRange, | ||||||
|
|
@@ -159,17 +159,25 @@ impl DeviceTrait for Device { | |||||
| #[derive(Clone, PartialEq, Eq)] | ||||||
| pub struct Device { | ||||||
| pub(crate) audio_device_id: AudioDeviceID, | ||||||
| is_default: bool, | ||||||
| } | ||||||
|
|
||||||
| fn is_default_device(device: Device) -> bool { | ||||||
|
||||||
| fn is_default_device(device: Device) -> bool { | |
| fn is_default_device(device: &Device) -> bool { |
Outdated
Copilot
AI
Aug 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary clone operation. Consider passing a reference to is_default_device() instead of cloning the device, or modify the function to accept &Device.
Outdated
Copilot
AI
Aug 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary clone operation. Consider passing a reference to is_default_device() instead of cloning the device, or modify the function to accept &Device.
Outdated
Copilot
AI
Aug 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary clone operation. Consider passing a reference to is_default_device() instead of cloning the device, or modify the function to accept &Device.
| if !is_default_device(self.clone()) { | |
| if !is_default_device(&self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you take a
&Devicehere so we don't need to clone inaudio_unit_from_device?