feat: add resonance compressor and Windows CI
This commit is contained in:
1 parent
3281535a04
commit
3c5b05fdec
31 files changed
+6340
-57
No files matched your search
@@ -4,6 +4,49 @@ pub use egui;
|
||||
mod editor;
|
||||
use std::sync::Arc;
|
||||
fn main() {
|
||||
let resonance = std::env::args().any(|arg| arg == "--resonance");
|
||||
let compact = std::env::args().any(|arg| arg == "--compact");
|
||||
let (width, height) = if resonance {
|
||||
if compact {
|
||||
(1040, 700)
|
||||
} else {
|
||||
(1180, 760)
|
||||
}
|
||||
} else {
|
||||
(1100, 850)
|
||||
};
|
||||
let mut resonance_settings = resonance_core::Settings::preset(1);
|
||||
resonance_settings.focus[0] = resonance_core::Focus {
|
||||
enabled: true,
|
||||
frequency: 380.,
|
||||
width: 0.5,
|
||||
sensitivity: -12.,
|
||||
};
|
||||
resonance_settings.focus[1] = resonance_core::Focus {
|
||||
enabled: true,
|
||||
frequency: 3000.,
|
||||
width: 0.3,
|
||||
sensitivity: 6.,
|
||||
};
|
||||
let mut resonance_state = resonance_ui::State::default();
|
||||
resonance_state.selected = Some(1);
|
||||
resonance_state.preset = 1;
|
||||
resonance_state.delta = std::env::args().any(|arg| arg == "--delta");
|
||||
resonance_settings.bypass = std::env::args().any(|arg| arg == "--bypass");
|
||||
if resonance && !std::env::args().any(|arg| arg == "--silent") {
|
||||
let mut engine = resonance_core::Engine::new(48000., 2).unwrap();
|
||||
engine.set_settings(resonance_settings).unwrap();
|
||||
for i in 0..24000 {
|
||||
let t = i as f32 / 48000.;
|
||||
let x = (std::f32::consts::TAU * 3000. * t).sin() * 0.28
|
||||
+ (std::f32::consts::TAU * 240. * t).sin() * 0.15
|
||||
+ (std::f32::consts::TAU * 1200. * t).sin() * 0.08;
|
||||
engine.process_sample([x, x * 0.85], resonance_core::Monitor::default());
|
||||
if let Some(frame) = engine.take_analyzer() {
|
||||
resonance_state.accept_frame(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
let shared = Arc::new(story_app::Shared::default());
|
||||
let mut session = story_core::Session {
|
||||
source: Some(story_core::demo_motif()),
|
||||
@@ -30,7 +73,11 @@ fn main() {
|
||||
}
|
||||
shared.replace(session).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
editor::style(&ctx);
|
||||
if resonance {
|
||||
resonance_ui::style(&ctx);
|
||||
} else {
|
||||
editor::style(&ctx);
|
||||
}
|
||||
let mut state = editor::EditorState::default();
|
||||
let mut textures = std::collections::HashMap::new();
|
||||
let mut output = None;
|
||||
@@ -39,12 +86,18 @@ fn main() {
|
||||
egui::RawInput {
|
||||
screen_rect: Some(egui::Rect::from_min_size(
|
||||
egui::Pos2::ZERO,
|
||||
egui::vec2(1100., 850.),
|
||||
egui::vec2(width as f32, height as f32),
|
||||
)),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| editor::show(ui, &shared, &mut state));
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
if resonance {
|
||||
resonance_ui::show(ui, &mut resonance_settings, &mut resonance_state);
|
||||
} else {
|
||||
editor::show(ui, &shared, &mut state);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
for (id, delta) in &frame.textures_delta.set {
|
||||
@@ -72,7 +125,7 @@ fn main() {
|
||||
}
|
||||
let output = output.unwrap();
|
||||
let meshes = ctx.tessellate(output.shapes, 1.);
|
||||
let mut image = image::RgbaImage::from_pixel(1100, 850, image::Rgba([23, 34, 51, 255]));
|
||||
let mut image = image::RgbaImage::from_pixel(width, height, image::Rgba([23, 34, 51, 255]));
|
||||
for clipped in meshes {
|
||||
let egui::epaint::Primitive::Mesh(mesh) = clipped.primitive else {
|
||||
continue;
|
||||
@@ -106,14 +159,14 @@ fn main() {
|
||||
.max(b.pos.x)
|
||||
.max(c.pos.x)
|
||||
.min(clipped.clip_rect.right())
|
||||
.min(1099.) as u32;
|
||||
.min((width - 1) as f32) as u32;
|
||||
let max_y = a
|
||||
.pos
|
||||
.y
|
||||
.max(b.pos.y)
|
||||
.max(c.pos.y)
|
||||
.min(clipped.clip_rect.bottom())
|
||||
.min(849.) as u32;
|
||||
.min((height - 1) as f32) as u32;
|
||||
let cross = |u: egui::Vec2, v: egui::Vec2| u.x * v.y - u.y * v.x;
|
||||
let area = cross(b.pos - a.pos, c.pos - a.pos);
|
||||
if area.abs() < 0.0001 {
|
||||
|
||||
Reference in new issue
Block a user