diff --git a/plugins/diopser/src/editor.rs b/plugins/diopser/src/editor.rs
index 02f9f550..a99792f1 100644
--- a/plugins/diopser/src/editor.rs
+++ b/plugins/diopser/src/editor.rs
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+use atomic_float::AtomicF32;
use nih_plug::nih_debug_assert_failure;
use nih_plug::prelude::{Editor, Plugin};
use nih_plug_vizia::vizia::prelude::*;
@@ -37,15 +38,17 @@ const SPECTRUM_ANALYZER_HEIGHT: f32 = 260.0;
const DARK_GRAY: Color = Color::rgb(0xc4, 0xc4, 0xc4);
const DARKER_GRAY: Color = Color::rgb(0x69, 0x69, 0x69);
-#[derive(Lens)]
-struct Data {
- params: Arc,
+#[derive(Lens, Clone)]
+pub(crate) struct Data {
+ pub(crate) params: Arc,
- spectrum: Arc>,
+ /// The plugin's current sample rate.
+ pub(crate) sample_rate: Arc,
+ pub(crate) spectrum: Arc>,
/// Whether the safe mode button is enabled. The number of filter stages is capped at 40 while
/// this is active.
/// TODO: Actually hook up safe mode
- safe_mode: Arc,
+ pub(crate) safe_mode: Arc,
}
impl Model for Data {}
@@ -55,24 +58,14 @@ pub(crate) fn default_state() -> Arc {
ViziaState::from_size(EDITOR_WIDTH, EDITOR_HEIGHT)
}
-pub(crate) fn create(
- params: Arc,
- spectrum: Arc>,
- editor_state: Arc,
-) -> Option> {
+pub(crate) fn create(editor_data: Data, editor_state: Arc) -> Option> {
create_vizia_editor(editor_state, ViziaTheming::Custom, move |cx, _| {
assets::register_noto_sans_light(cx);
assets::register_noto_sans_thin(cx);
cx.add_theme(include_str!("editor/theme.css"));
- Data {
- params: params.clone(),
-
- spectrum: spectrum.clone(),
- safe_mode: params.safe_mode.clone(),
- }
- .build(cx);
+ editor_data.clone().build(cx);
ResizeHandle::new(cx);
diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs
index 67a1d624..cc3132d8 100644
--- a/plugins/diopser/src/lib.rs
+++ b/plugins/diopser/src/lib.rs
@@ -299,8 +299,13 @@ impl Plugin for Diopser {
fn editor(&self, _async_executor: AsyncExecutor) -> Option> {
editor::create(
- self.params.clone(),
- self.spectrum_output.clone(),
+ editor::Data {
+ params: self.params.clone(),
+
+ sample_rate: self.sample_rate.clone(),
+ spectrum: self.spectrum_output.clone(),
+ safe_mode: self.params.safe_mode.clone(),
+ },
self.params.editor_state.clone(),
)
}