Skip to content

Commit 2b77607

Browse files
committed
rustfmt, going for big update
1 parent e83af0f commit 2b77607

38 files changed

Lines changed: 16276 additions & 6493 deletions

Cargo.lock

Lines changed: 310 additions & 152 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "Actuate"
3-
version = "1.4.5"
4-
edition = "2021"
3+
version = "1.4.6"
4+
edition = "2024"
55
authors = ["Ardura <azviscarra@gmail.com>"]
66
license = "GPL-3.0-or-later"
77
homepage = "https://github.com/ardura"
88
description = "Sampler + Synth"
9+
publish = false
910

1011
[workspace]
1112
members = ["xtask"]
@@ -17,18 +18,18 @@ crate-type = ["cdylib","lib"]
1718
hound = "3.5.0"
1819
lazy_static = "1.4.0"
1920

20-
# Nih plug fork for actuate
21-
nice-plug = { git = "https://codeberg.org/BillyDM/nice-plug.git", rev = "63fe31591220d71a0481534cbc4f0dc1be9ebf7b", features = ["assert_process_allocs"] }
22-
nice-plug-egui = { git = "https://codeberg.org/BillyDM/nice-plug.git", rev = "63fe31591220d71a0481534cbc4f0dc1be9ebf7b" }
21+
# egui is now independent
22+
egui = { git = "https://github.com/emilk/egui.git", version = "0.34.1", default-features = false, features = ["default_fonts","bytemuck"] }
2323

24-
#nih_plug = { git = "https://github.com/Ardura/nih-plug.git", rev = "ce77d8c6daeebcdcc15e84a178ddce617ee6a3d3", features = ["assert_process_allocs"] }
25-
#nih_plug_egui = { git = "https://github.com/Ardura/nih-plug.git", rev = "ce77d8c6daeebcdcc15e84a178ddce617ee6a3d3" }
24+
# Nih plug fork for actuate
25+
nice-plug = { git = "https://codeberg.org/BillyDM/nice-plug.git", rev = "9590b34061e4df280e9b0ea0e4ff0083b3eedc44", features = ["assert_process_allocs"] }
26+
nice-plug-egui = { git = "https://codeberg.org/BillyDM/nice-plug.git", rev = "9590b34061e4df280e9b0ea0e4ff0083b3eedc44" }
2627

2728
num-complex = "0.4.4"
2829
num-traits = "0.2.17"
2930
once_cell = "1.18.0"
3031
parking_lot = "0.12.1"
31-
pitch_shift = "2.1.0"
32+
pitch_shift = "1.0.0"
3233
rand = "0.10.1"
3334
rand_pcg = "0.10.2"
3435
serde = "1.0.188"
@@ -51,6 +52,7 @@ panic = 'unwind'
5152
incremental = false
5253
codegen-units = 1
5354
rpath = false
55+
strip = "symbols"
5456

5557
[profile.profiling]
5658
inherits = "release"

src/CustomWidgets.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
pub(crate) mod BeizerButton;
22
pub(crate) mod BoolButton;
3+
pub(crate) mod ComboBoxParam;
34
pub(crate) mod CustomParamSlider;
45
pub(crate) mod CustomVerticalSlider;
6+
pub(crate) mod slim_checkbox;
57
pub(crate) mod toggle_switch;
68
pub(crate) mod ui_knob;
7-
pub(crate) mod slim_checkbox;
8-
pub(crate) mod ComboBoxParam;
9-

src/CustomWidgets/BeizerButton.rs

Lines changed: 188 additions & 202 deletions
Large diffs are not rendered by default.

src/CustomWidgets/BoolButton.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a, P: Param> SliderRegion<'a, P> {
7575
self.background_color
7676
},
7777
visuals.bg_stroke,
78-
egui::StrokeKind::Middle
78+
egui::StrokeKind::Middle,
7979
);
8080
// Paint the circle, animating it from left to right with `how_on`:
8181
ui.painter().rect_stroke(
@@ -88,7 +88,7 @@ impl<'a, P: Param> SliderRegion<'a, P> {
8888
.color
8989
.linear_multiply((how_on + 0.2).clamp(0.2, 1.2)),
9090
),
91-
egui::StrokeKind::Middle
91+
egui::StrokeKind::Middle,
9292
);
9393
let center = egui::pos2(rect.center().x, rect.center().y);
9494
ui.painter().text(

src/CustomWidgets/ComboBoxParam.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ pub struct ParamComboBox<'a, P: Param> {
1515
}
1616

1717
impl<'a, P: Param> ParamComboBox<'a, P> {
18-
pub fn for_param(param: &'a P, setter: &'a ParamSetter<'a>, options: Vec<String>, id_name: String) -> Self {
19-
Self { param, setter, options, id_name }
18+
pub fn for_param(
19+
param: &'a P,
20+
setter: &'a ParamSetter<'a>,
21+
options: Vec<String>,
22+
id_name: String,
23+
) -> Self {
24+
Self {
25+
param,
26+
setter,
27+
options,
28+
id_name,
29+
}
2030
}
2131

2232
fn set_selected_value(&self, selected_value: String) {
@@ -45,7 +55,10 @@ impl<'a, P: Param> Widget for ParamComboBox<'a, P> {
4555
.show_ui(ui, |ui| {
4656
for option in &self.options {
4757
// Update current_value and set changed flag if a new option is selected
48-
if ui.selectable_value(&mut current_value, option.clone(), option).clicked() {
58+
if ui
59+
.selectable_value(&mut current_value, option.clone(), option)
60+
.clicked()
61+
{
4962
changed = true;
5063
}
5164
}
@@ -62,7 +75,6 @@ impl<'a, P: Param> Widget for ParamComboBox<'a, P> {
6275
}
6376
}
6477

65-
6678
/*
6779
use nih_plug::prelude::{Param, ParamSetter};
6880
use nih_plug_egui::egui::{ComboBox, Response, Ui, Widget};
@@ -111,4 +123,4 @@ impl<'a, P: Param> Widget for ParamComboBox<'a, P> {
111123
.on_hover_text("Select a parameter value")
112124
}
113125
}
114-
*/
126+
*/

src/CustomWidgets/CustomParamSlider.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// Copy of ParamSlider made custom by adding reversed bool to reverse drawing bar and empty section
22
// Needed to make some weird import changes to get this to work...Definitely should find a better way to do this in future...
33
// Ardura
4-
use std::sync::{Arc, LazyLock};
5-
use nih_plug::{
6-
prelude::{Param, ParamSetter},
4+
use nih_plug::prelude::{Param, ParamSetter};
5+
use nih_plug_egui::egui::{
6+
self, emath, vec2, Color32, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2,
7+
Widget, WidgetText,
78
};
8-
use nih_plug_egui::egui::{self, emath, vec2, Color32, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget, WidgetText};
99
use nih_plug_egui::widgets::util as nUtil;
1010
use parking_lot::Mutex;
11+
use std::sync::{Arc, LazyLock};
1112

1213
/// When shift+dragging a parameter, one pixel dragged corresponds to this much change in the
1314
/// noramlized parameter.
@@ -318,14 +319,14 @@ impl<'a, P: Param> ParamSlider<'a, P> {
318319
response.rect,
319320
0.0,
320321
Stroke::new(1.0, ui.visuals().widgets.active.bg_fill),
321-
egui::StrokeKind::Middle
322+
egui::StrokeKind::Middle,
322323
);
323324
} else {
324325
ui.painter().rect_stroke(
325326
response.rect,
326327
0.0,
327328
Stroke::new(1.0, self.background_set_color),
328-
egui::StrokeKind::Middle
329+
egui::StrokeKind::Middle,
329330
);
330331
}
331332
}
@@ -350,25 +351,28 @@ impl<'a, P: Param> ParamSlider<'a, P> {
350351
if keyboard_focus_id.is_some() {
351352
let keyboard_focus_id = keyboard_focus_id.unwrap();
352353
if self.keyboard_entry_active(ui) {
353-
let value_entry_mutex = ui
354-
.memory_mut(|mem|mem.data.get_persisted_mut_or_default::<Arc<Mutex<String>>>(*VALUE_ENTRY_MEMORY_ID).clone());
354+
let value_entry_mutex = ui.memory_mut(|mem| {
355+
mem.data
356+
.get_persisted_mut_or_default::<Arc<Mutex<String>>>(*VALUE_ENTRY_MEMORY_ID)
357+
.clone()
358+
});
355359
let mut value_entry = value_entry_mutex.lock();
356-
360+
357361
ui.add(
358362
TextEdit::singleline(&mut *value_entry)
359363
.id(keyboard_focus_id)
360364
.font(TextStyle::Monospace),
361365
);
362-
if ui.input(|reader|reader.key_pressed(Key::Escape)) {
366+
if ui.input(|reader| reader.key_pressed(Key::Escape)) {
363367
// Cancel when pressing escape
364-
ui.memory_mut(|mem|mem.surrender_focus(keyboard_focus_id));
365-
} else if ui.input(|reader|reader.key_pressed(Key::Enter)) {
368+
ui.memory_mut(|mem| mem.surrender_focus(keyboard_focus_id));
369+
} else if ui.input(|reader| reader.key_pressed(Key::Enter)) {
366370
// And try to set the value by string when pressing enter
367371
self.begin_drag();
368372
self.set_from_string(&value_entry);
369373
self.end_drag();
370-
371-
ui.memory_mut(|mem|mem.surrender_focus(keyboard_focus_id));
374+
375+
ui.memory_mut(|mem| mem.surrender_focus(keyboard_focus_id));
372376
}
373377
} else {
374378
text = WidgetText::from(text_label).into_galley(
@@ -398,7 +402,7 @@ impl<'a, P: Param> ParamSlider<'a, P> {
398402
visuals.corner_radius,
399403
fill,
400404
stroke,
401-
egui::StrokeKind::Middle
405+
egui::StrokeKind::Middle,
402406
);
403407
}
404408
let text_pos = ui
@@ -440,7 +444,7 @@ impl<'a, P: Param> ParamSlider<'a, P> {
440444
visuals.corner_radius,
441445
fill,
442446
stroke,
443-
egui::StrokeKind::Middle
447+
egui::StrokeKind::Middle,
444448
);
445449
}
446450
let text_pos = ui
@@ -457,7 +461,6 @@ impl<'a, P: Param> ParamSlider<'a, P> {
457461
}
458462
}
459463

460-
461464
impl<P: Param> Widget for ParamSlider<'_, P> {
462465
fn ui(mut self, ui: &mut Ui) -> Response {
463466
let slider_width = self
@@ -480,8 +483,9 @@ impl<P: Param> Widget for ParamSlider<'_, P> {
480483
let height = ui
481484
.text_style_height(&TextStyle::Body)
482485
.max(ui.spacing().interact_size.y * slimmer_scale);
483-
484-
let slider_height = emath::GuiRounding::round_to_pixels(height * 0.8, ui.painter().pixels_per_point());
486+
487+
let slider_height =
488+
emath::GuiRounding::round_to_pixels(height * 0.8, ui.painter().pixels_per_point());
485489
let mut response = ui
486490
.vertical(|ui| {
487491
ui.allocate_space(vec2(slider_width, (height - slider_height) / 2.0));

src/CustomWidgets/CustomVerticalSlider.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Copy of CustomParamSlider from Canopy Reverb modified further into verticality
22
// Needed to make some weird import changes to get this to work...Definitely should find a better way to do this in future...
33
// Ardura
4-
use nih_plug::{
5-
prelude::{Param, ParamSetter},
4+
use nih_plug::prelude::{Param, ParamSetter};
5+
use nih_plug_egui::egui::{
6+
self, vec2, Color32, Galley, Response, RichText, Sense, Stroke, TextStyle, Ui, Vec2, Widget,
7+
WidgetText,
68
};
7-
use nih_plug_egui::egui::{self, vec2, Color32, Galley, Response, RichText, Sense, Stroke, TextStyle, Ui, Vec2, Widget, WidgetText};
89
use nih_plug_egui::{
910
egui::{Pos2, Rect},
1011
widgets::util as nUtil,
@@ -16,7 +17,8 @@ use std::sync::{Arc, LazyLock};
1617
/// noramlized parameter.
1718
const GRANULAR_DRAG_MULTIPLIER: f32 = 0.0015;
1819

19-
static DRAG_NORMALIZED_START_VALUE_MEMORY_ID: LazyLock<egui::Id> = LazyLock::new(|| egui::Id::new((file!(), 0)));
20+
static DRAG_NORMALIZED_START_VALUE_MEMORY_ID: LazyLock<egui::Id> =
21+
LazyLock::new(|| egui::Id::new((file!(), 0)));
2022
static DRAG_AMOUNT_MEMORY_ID: LazyLock<egui::Id> = LazyLock::new(|| egui::Id::new((file!(), 1)));
2123
static VALUE_ENTRY_MEMORY_ID: LazyLock<egui::Id> = LazyLock::new(|| egui::Id::new((file!(), 2)));
2224

@@ -332,14 +334,14 @@ impl<'a, P: Param> ParamSlider<'a, P> {
332334
response.rect,
333335
4.0,
334336
Stroke::new(1.0, ui.visuals().widgets.active.bg_fill),
335-
egui::StrokeKind::Middle
337+
egui::StrokeKind::Middle,
336338
);
337339
} else {
338340
ui.painter().rect_stroke(
339341
response.rect,
340342
4.0,
341343
Stroke::new(1.0, self.background_set_color),
342-
egui::StrokeKind::Middle
344+
egui::StrokeKind::Middle,
343345
);
344346
}
345347
}
@@ -356,12 +358,14 @@ impl<'a, P: Param> ParamSlider<'a, P> {
356358

357359
let text: Arc<Galley>;
358360
if self.override_text_size != -1.0 {
359-
text = WidgetText::from(RichText::new(self.string_value()).size(self.override_text_size)).into_galley(
360-
ui,
361-
None,
362-
ui.available_width() - (padding.x * 2.0),
363-
TextStyle::Button,
364-
);
361+
text =
362+
WidgetText::from(RichText::new(self.string_value()).size(self.override_text_size))
363+
.into_galley(
364+
ui,
365+
None,
366+
ui.available_width() - (padding.x * 2.0),
367+
TextStyle::Button,
368+
);
365369
} else {
366370
text = WidgetText::from(self.string_value()).into_galley(
367371
ui,
@@ -385,7 +389,7 @@ impl<'a, P: Param> ParamSlider<'a, P> {
385389
visuals.corner_radius,
386390
fill,
387391
stroke,
388-
egui::StrokeKind::Middle
392+
egui::StrokeKind::Middle,
389393
);
390394
}
391395

src/CustomWidgets/slim_checkbox.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33

44
// ----------------------------------------------------------------------------
55

6-
use std::sync::{atomic::{AtomicBool, Ordering}, Arc};
76
use nih_plug_egui::egui::{
8-
self, epaint::{self, Brush}, pos2, vec2, NumExt, Response, Sense, Shape, TextStyle, TextureId, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType
7+
self,
8+
epaint::{self, Brush},
9+
pos2, vec2, NumExt, Response, Sense, Shape, TextStyle, TextureId, Ui, Vec2, Widget, WidgetInfo,
10+
WidgetText, WidgetType,
11+
};
12+
use std::sync::{
13+
atomic::{AtomicBool, Ordering},
14+
Arc,
915
};
1016

1117
// TODO(emilk): allow checkbox without a text label
@@ -62,8 +68,10 @@ impl<'a> Widget for AtomicSlimCheckbox<'a> {
6268

6369
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6470
//This is the only piece I changed -Ardura
65-
desired_size =
66-
desired_size.at_least(vec2(spacing.interact_size.x * 0.45, spacing.interact_size.y));
71+
desired_size = desired_size.at_least(vec2(
72+
spacing.interact_size.x * 0.45,
73+
spacing.interact_size.y,
74+
));
6775
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6876

6977
(Some(text), desired_size)
@@ -159,8 +167,10 @@ impl<'a> Widget for SlimCheckbox<'a> {
159167

160168
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
161169
//This is the only piece I changed -Ardura
162-
desired_size =
163-
desired_size.at_least(vec2(spacing.interact_size.x * 0.45, spacing.interact_size.y));
170+
desired_size = desired_size.at_least(vec2(
171+
spacing.interact_size.x * 0.45,
172+
spacing.interact_size.y,
173+
));
164174
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
165175

166176
(Some(text), desired_size)
@@ -198,7 +208,7 @@ impl<'a> Widget for SlimCheckbox<'a> {
198208
fill_texture_id: TextureId::default(),
199209
uv: big_icon_rect.expand(visuals.expansion),
200210
})),
201-
stroke_kind: egui::StrokeKind::Middle
211+
stroke_kind: egui::StrokeKind::Middle,
202212
});
203213

204214
if *checked {

0 commit comments

Comments
 (0)