This commit is contained in:
11
src/init.rs
11
src/init.rs
@@ -40,6 +40,7 @@ pub struct Init {
|
||||
pub audio_sample_pos: Arc<AtomicU64>,
|
||||
pub sample_rate_shared: Arc<AtomicU32>,
|
||||
pub stream: Option<cpal::Stream>,
|
||||
pub input_stream: Option<cpal::Stream>,
|
||||
pub analysis_handle: Option<AnalysisHandle>,
|
||||
pub midi_rx: Receiver<MidiCommand>,
|
||||
pub stream_error_rx: crossbeam_channel::Receiver<String>,
|
||||
@@ -200,12 +201,13 @@ pub fn init(args: InitArgs) -> Init {
|
||||
|
||||
let stream_config = AudioStreamConfig {
|
||||
output_device: app.audio.config.output_device.clone(),
|
||||
input_device: app.audio.config.input_device.clone(),
|
||||
channels: app.audio.config.channels,
|
||||
buffer_size: app.audio.config.buffer_size,
|
||||
max_voices: app.audio.config.max_voices,
|
||||
};
|
||||
|
||||
let (stream, analysis_handle) = match build_stream(
|
||||
let (stream, input_stream, analysis_handle) = match build_stream(
|
||||
&stream_config,
|
||||
initial_audio_rx,
|
||||
Arc::clone(&scope_buffer),
|
||||
@@ -216,7 +218,7 @@ pub fn init(args: InitArgs) -> Init {
|
||||
stream_error_tx,
|
||||
&app.audio.config.sample_paths,
|
||||
) {
|
||||
Ok((s, info, analysis, registry)) => {
|
||||
Ok((s, input, info, analysis, registry)) => {
|
||||
app.audio.config.sample_rate = info.sample_rate;
|
||||
app.audio.config.host_name = info.host_name;
|
||||
app.audio.config.channels = info.channels;
|
||||
@@ -233,12 +235,12 @@ pub fn init(args: InitArgs) -> Init {
|
||||
.expect("failed to spawn preload thread");
|
||||
}
|
||||
|
||||
(Some(s), Some(analysis))
|
||||
(Some(s), input, Some(analysis))
|
||||
}
|
||||
Err(e) => {
|
||||
app.ui.set_status(format!("Audio failed: {e}"));
|
||||
app.audio.error = Some(e);
|
||||
(None, None)
|
||||
(None, None, None)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -257,6 +259,7 @@ pub fn init(args: InitArgs) -> Init {
|
||||
audio_sample_pos,
|
||||
sample_rate_shared,
|
||||
stream,
|
||||
input_stream,
|
||||
analysis_handle,
|
||||
midi_rx,
|
||||
stream_error_rx,
|
||||
|
||||
Reference in New Issue
Block a user