Feat: background head-preload for sample libraries
This commit is contained in:
@@ -251,7 +251,15 @@ pub fn build_stream(
|
||||
metrics: Arc<EngineMetrics>,
|
||||
initial_samples: Vec<doux::sampling::SampleEntry>,
|
||||
audio_sample_pos: Arc<AtomicU64>,
|
||||
) -> Result<(Stream, AudioStreamInfo, AnalysisHandle), String> {
|
||||
) -> Result<
|
||||
(
|
||||
Stream,
|
||||
AudioStreamInfo,
|
||||
AnalysisHandle,
|
||||
Arc<doux::SampleRegistry>,
|
||||
),
|
||||
String,
|
||||
> {
|
||||
let device = match &config.output_device {
|
||||
Some(name) => doux::audio::find_output_device(name)
|
||||
.ok_or_else(|| format!("Device not found: {name}"))?,
|
||||
@@ -287,6 +295,7 @@ pub fn build_stream(
|
||||
let mut engine =
|
||||
Engine::new_with_metrics(sample_rate, channels, max_voices, Arc::clone(&metrics));
|
||||
engine.sample_index = initial_samples;
|
||||
let registry = Arc::clone(&engine.sample_registry);
|
||||
|
||||
let (mut fft_producer, analysis_handle) = spawn_analysis_thread(sample_rate, spectrum_buffer);
|
||||
|
||||
@@ -356,5 +365,5 @@ pub fn build_stream(
|
||||
host_name,
|
||||
channels: effective_channels,
|
||||
};
|
||||
Ok((stream, info, analysis_handle))
|
||||
Ok((stream, info, analysis_handle, registry))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user