Replace Diopser egui GUI with empty iced GUI
This commit is contained in:
parent
3ebe34c870
commit
ab1e170f74
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -746,7 +746,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"fftw",
|
||||
"nih_plug",
|
||||
"nih_plug_egui",
|
||||
"nih_plug_iced",
|
||||
"triple_buffer",
|
||||
]
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ simd = ["nih_plug/simd"]
|
|||
|
||||
[dependencies]
|
||||
nih_plug = { path = "../../", features = ["assert_process_allocs"] }
|
||||
nih_plug_egui = { path = "../../nih_plug_egui" }
|
||||
nih_plug_iced = { path = "../../nih_plug_iced" }
|
||||
|
||||
# For the GUI
|
||||
fftw = "0.7"
|
||||
|
|
|
@ -15,25 +15,50 @@
|
|||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use nih_plug::prelude::Editor;
|
||||
use nih_plug_egui::widgets::generic_ui;
|
||||
use nih_plug_egui::{create_egui_editor, egui, EguiState};
|
||||
use nih_plug_iced::{create_iced_editor, Application, Command, Element, IcedState};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::DiopserParams;
|
||||
|
||||
// Makes sense to also define this here, makes it a bit easier to keep track of
|
||||
pub fn default_state() -> Arc<EguiState> {
|
||||
EguiState::from_size(220, 330)
|
||||
pub fn default_state() -> Arc<IcedState> {
|
||||
IcedState::from_size(600, 400)
|
||||
}
|
||||
|
||||
pub fn create(
|
||||
params: Pin<Arc<DiopserParams>>,
|
||||
editor_state: Arc<EguiState>,
|
||||
editor_state: Arc<IcedState>,
|
||||
) -> Option<Box<dyn Editor>> {
|
||||
create_egui_editor(editor_state, (), move |egui_ctx, setter, _state| {
|
||||
egui::CentralPanel::default().show(egui_ctx, |ui| {
|
||||
generic_ui::create(ui, params.as_ref(), setter, generic_ui::GenericSlider);
|
||||
});
|
||||
})
|
||||
create_iced_editor::<DiopserEditor>(editor_state, params)
|
||||
}
|
||||
|
||||
struct DiopserEditor {
|
||||
params: Pin<Arc<DiopserParams>>,
|
||||
}
|
||||
|
||||
impl Application for DiopserEditor {
|
||||
type Executor = nih_plug_iced::executor::Default;
|
||||
// TODO:
|
||||
type Message = ();
|
||||
type Flags = Pin<Arc<DiopserParams>>;
|
||||
|
||||
fn new(flags: Self::Flags) -> (Self, Command<Self::Message>) {
|
||||
let editor = DiopserEditor { params: flags };
|
||||
|
||||
(editor, Command::none())
|
||||
}
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
window: &mut nih_plug_iced::WindowQueue,
|
||||
message: Self::Message,
|
||||
) -> Command<Self::Message> {
|
||||
// TODO:
|
||||
Command::none()
|
||||
}
|
||||
|
||||
fn view(&mut self) -> Element<'_, Self::Message> {
|
||||
nih_plug_iced::Text::new("Hello, world!").into()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ compile_error!("Compiling without SIMD support is currently not supported");
|
|||
extern crate nih_plug;
|
||||
|
||||
use nih_plug::prelude::*;
|
||||
use nih_plug_egui::EguiState;
|
||||
use nih_plug_iced::IcedState;
|
||||
use std::pin::Pin;
|
||||
use std::simd::f32x2;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
@ -50,7 +50,7 @@ const MAX_AUTOMATION_STEP_SIZE: u32 = 512;
|
|||
// - A proper GUI
|
||||
struct Diopser {
|
||||
params: Pin<Arc<DiopserParams>>,
|
||||
editor_state: Arc<EguiState>,
|
||||
editor_state: Arc<IcedState>,
|
||||
|
||||
/// Needed for computing the filter coefficients.
|
||||
sample_rate: f32,
|
||||
|
|
Loading…
Reference in a new issue