MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / update

Method update

examples/custom_nodes/src/ui.rs:20–133  ·  view source on GitHub ↗
(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame)

Source from the content-addressed store, hash-verified

18
19impl App for DemoApp {
20 fn update(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame) {
21 egui::TopBottomPanel::top("top_panel").show(cx, |ui| {
22 egui::MenuBar::new().ui(ui, |ui| {
23 #[cfg(not(target_arch = "wasm32"))]
24 {
25 ui.menu_button("Menu", |ui| {
26 if ui.button("Quit").clicked() {
27 cx.send_viewport_cmd(egui::ViewportCommand::Close)
28 }
29 });
30 ui.add_space(16.0);
31 }
32
33 egui::widgets::global_theme_preference_switch(ui);
34 });
35 });
36
37 egui::CentralPanel::default().show(cx, |ui| {
38 ui.label("Noise gen");
39
40 let mut linear_volume = self.audio_system.noise_gen_node.volume.linear();
41 if ui
42 .add(egui::Slider::new(&mut linear_volume, 0.0..=1.0).text("volume"))
43 .changed()
44 {
45 self.audio_system.noise_gen_node.volume = Volume::Linear(linear_volume);
46 };
47
48 if ui
49 .checkbox(&mut self.audio_system.noise_gen_bypassed, "bypassed")
50 .changed()
51 {
52 self.audio_system.cx.queue_bypassed_for(
53 self.audio_system.noise_gen_node_id,
54 self.audio_system.noise_gen_bypassed,
55 );
56 }
57
58 self.audio_system.noise_gen_node.update_memo(
59 &mut self
60 .audio_system
61 .cx
62 .event_queue(self.audio_system.noise_gen_node_id),
63 );
64
65 ui.separator();
66 ui.label("Filter");
67
68 if ui
69 .checkbox(&mut self.audio_system.filter_bypassed, "bypassed")
70 .changed()
71 {
72 self.audio_system.cx.queue_bypassed_for(
73 self.audio_system.filter_node_id,
74 self.audio_system.filter_bypassed,
75 );
76 }
77

Callers

nothing calls this directly

Calls 7

uiMethod · 0.80
linearMethod · 0.80
queue_bypassed_forMethod · 0.80
update_memoMethod · 0.80
rms_valueMethod · 0.80
addMethod · 0.45
event_queueMethod · 0.45

Tested by

no test coverage detected