fix: follow default output source on mac osx
When playing out on default output source, follow the default output source chosen in sound preferences in osx.
This commit is contained in:
parent
bf026fe082
commit
d50e0ecbac
2 changed files with 16 additions and 3 deletions
|
|
@ -138,6 +138,7 @@ impl DeviceTrait for Device {
|
|||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Device {
|
||||
pub(crate) audio_device_id: AudioDeviceID,
|
||||
is_default: bool,
|
||||
}
|
||||
|
||||
impl Device {
|
||||
|
|
@ -421,7 +422,12 @@ struct StreamInner {
|
|||
}
|
||||
|
||||
fn audio_unit_from_device(device: &Device, input: bool) -> Result<AudioUnit, coreaudio::Error> {
|
||||
let mut audio_unit = AudioUnit::new(coreaudio::audio_unit::IOType::HalOutput)?;
|
||||
let output_type = if device.is_default && !input {
|
||||
coreaudio::audio_unit::IOType::DefaultOutput
|
||||
} else {
|
||||
coreaudio::audio_unit::IOType::HalOutput
|
||||
};
|
||||
let mut audio_unit = AudioUnit::new(output_type)?;
|
||||
|
||||
if input {
|
||||
// Enable input processing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue