fixed coreaudio buffersize errors
This commit is contained in:
parent
9c85eecb59
commit
10599ac826
|
@ -380,7 +380,7 @@ impl Device {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut audio_unit = audio_unit_from_device(self, true)?;
|
let audio_unit = audio_unit_from_device(self, true)?;
|
||||||
let buffer_size = get_io_buffer_frame_size_range(&audio_unit)?;
|
let buffer_size = get_io_buffer_frame_size_range(&audio_unit)?;
|
||||||
|
|
||||||
let config = SupportedStreamConfig {
|
let config = SupportedStreamConfig {
|
||||||
|
@ -688,15 +688,20 @@ impl Device {
|
||||||
match config.buffer_size {
|
match config.buffer_size {
|
||||||
BufferSize::Fixed(v) => {
|
BufferSize::Fixed(v) => {
|
||||||
let buffer_size_range = get_io_buffer_frame_size_range(&audio_unit)?;
|
let buffer_size_range = get_io_buffer_frame_size_range(&audio_unit)?;
|
||||||
if v >= buffer_size_range.min && v <= buffer_size_range.max {
|
match buffer_size_range {
|
||||||
audio_unit.set_property(
|
SupportedBufferSize::Range{min, max} => {
|
||||||
kAudioDevicePropertyBufferFrameSize,
|
if v >= min && v <= max {
|
||||||
scope,
|
audio_unit.set_property(
|
||||||
element,
|
kAudioDevicePropertyBufferFrameSize,
|
||||||
Some(&v),
|
scope,
|
||||||
)?
|
element,
|
||||||
} else {
|
Some(&v),
|
||||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
)?
|
||||||
|
} else {
|
||||||
|
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SupportedBufferSize::Unknown => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BufferSize::Default => (),
|
BufferSize::Default => (),
|
||||||
|
@ -777,15 +782,20 @@ impl Device {
|
||||||
match config.buffer_size {
|
match config.buffer_size {
|
||||||
BufferSize::Fixed(v) => {
|
BufferSize::Fixed(v) => {
|
||||||
let buffer_size_range = get_io_buffer_frame_size_range(&audio_unit)?;
|
let buffer_size_range = get_io_buffer_frame_size_range(&audio_unit)?;
|
||||||
if v >= buffer_size_range.min && v <= buffer_size_range.max {
|
match buffer_size_range {
|
||||||
audio_unit.set_property(
|
SupportedBufferSize::Range{min, max} => {
|
||||||
kAudioDevicePropertyBufferFrameSize,
|
if v >= min && v <= max {
|
||||||
scope,
|
audio_unit.set_property(
|
||||||
element,
|
kAudioDevicePropertyBufferFrameSize,
|
||||||
Some(&v),
|
scope,
|
||||||
)?
|
element,
|
||||||
} else {
|
Some(&v),
|
||||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
)?
|
||||||
|
} else {
|
||||||
|
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SupportedBufferSize::Unknown => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BufferSize::Default => (),
|
BufferSize::Default => (),
|
||||||
|
|
Loading…
Reference in New Issue