Merge branch 'worktree-agent-aba044eaf08eded94'
# Conflicts: # crates/render/src/three_d/compose.rs
This commit is contained in:
@@ -47,7 +47,15 @@ fn device(name: &str) -> Option<cpal::Device> {
|
||||
pub fn open(out: &AudioOutput) -> Option<Box<dyn AudioDevice>> {
|
||||
let dev = device(&out.device)?;
|
||||
let cfg = dev.default_output_config().ok()?;
|
||||
Some(Box::new(CpalOut { out: out.clone(), rate: cfg.sample_rate().0, latency: Arc::new(AtomicU64::new(0)), stop: None, thread: None }))
|
||||
// Settings ▸ Audio ▸ Preview Sample Rate: open the device at that rate when it supports it
|
||||
// (otherwise the preview is mixed at that rate and resampled to the device's).
|
||||
let supports = |r: u32| {
|
||||
dev.supported_output_configs()
|
||||
.map(|mut c| c.any(|c| c.channels() == cfg.channels() && c.min_sample_rate().0 <= r && r <= c.max_sample_rate().0))
|
||||
.unwrap_or(false)
|
||||
};
|
||||
let rate = if out.rate > 0 && supports(out.rate) { out.rate } else { cfg.sample_rate().0 };
|
||||
Some(Box::new(CpalOut { out: out.clone(), rate, latency: Arc::new(AtomicU64::new(0)), stop: None, thread: None }))
|
||||
}
|
||||
|
||||
fn run<T: SizedSample + FromSample<f32>>(
|
||||
|
||||
@@ -24,6 +24,8 @@ fn app_icon() -> egui::IconData {
|
||||
}
|
||||
|
||||
fn main() -> eframe::Result {
|
||||
// Help ▸ Enable Logging writes through this logger; warnings feed the compatibility report.
|
||||
effectcraft_engine::logging::install();
|
||||
let mut control_port: Option<u16> = std::env::var("EFFECTCRAFT_CONTROL_PORT").ok().and_then(|p| p.parse().ok());
|
||||
let mut files = Vec::new();
|
||||
let mut demo = true;
|
||||
@@ -94,8 +96,9 @@ fn main() -> eframe::Result {
|
||||
app.hooks.pick_save = Some(Box::new(|name: &str| {
|
||||
rfd::FileDialog::new().add_filter("EffectCraft Project", &["ecproj"]).set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string())
|
||||
}));
|
||||
app.hooks.pick_open_project =
|
||||
Some(Box::new(|| rfd::FileDialog::new().add_filter("EffectCraft Project", &["ecproj"]).pick_file().map(|p| p.to_string_lossy().to_string())));
|
||||
app.hooks.pick_open_project = Some(Box::new(|| {
|
||||
rfd::FileDialog::new().add_filter("EffectCraft Project", &["ecproj", "ecprojx"]).pick_file().map(|p| p.to_string_lossy().to_string())
|
||||
}));
|
||||
app.hooks.audio_device = Some(Box::new(audio_out::open));
|
||||
app.hooks.audio_devices = Some(Box::new(audio_out::devices));
|
||||
app.hooks.pick_folder = Some(Box::new(|| rfd::FileDialog::new().pick_folder().map(|p| p.to_string_lossy().to_string())));
|
||||
|
||||
Reference in New Issue
Block a user