Fix: MIDI precision
This commit is contained in:
@@ -282,6 +282,7 @@ pub struct AudioStreamInfo {
|
||||
pub sample_rate: f32,
|
||||
pub host_name: String,
|
||||
pub channels: u16,
|
||||
pub input_sample_rate: Option<f32>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
@@ -367,10 +368,16 @@ pub fn build_stream(
|
||||
dev
|
||||
});
|
||||
|
||||
let input_channels: usize = input_device
|
||||
let input_config = input_device
|
||||
.as_ref()
|
||||
.and_then(|dev| dev.default_input_config().ok());
|
||||
let input_channels: usize = input_config
|
||||
.as_ref()
|
||||
.and_then(|dev| dev.default_input_config().ok())
|
||||
.map_or(0, |cfg| cfg.channels() as usize);
|
||||
let input_sample_rate = input_config.and_then(|cfg| {
|
||||
let rate = cfg.sample_rate() as f32;
|
||||
(rate != sample_rate).then_some(rate)
|
||||
});
|
||||
|
||||
engine.input_channels = input_channels;
|
||||
|
||||
@@ -519,6 +526,7 @@ pub fn build_stream(
|
||||
sample_rate,
|
||||
host_name,
|
||||
channels: effective_channels,
|
||||
input_sample_rate,
|
||||
};
|
||||
Ok((stream, input_stream, info, analysis_handle, registry))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user