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

Method update

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

Source from the content-addressed store, hash-verified

88
89impl App for DemoApp {
90 fn update(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame) {
91 egui::TopBottomPanel::top("top_panel").show(cx, |ui| {
92 egui::MenuBar::new().ui(ui, |ui| {
93 #[cfg(not(target_arch = "wasm32"))]
94 {
95 ui.menu_button("Menu", |ui| {
96 if ui.button("Quit").clicked() {
97 cx.send_viewport_cmd(egui::ViewportCommand::Close)
98 }
99 });
100 ui.add_space(16.0);
101 }
102
103 egui::widgets::global_theme_preference_switch(ui);
104 });
105 });
106
107 egui::CentralPanel::default().show(cx, |ui| {
108 if ui.button("Play Sample").clicked() {
109 self.audio_system.play_sample();
110 }
111
112 if ui
113 .checkbox(&mut self.audio_system.triple_buffer_bypassed, "enabled")
114 .changed()
115 {
116 self.audio_system
117 .set_bypassed(self.audio_system.triple_buffer_bypassed);
118 }
119
120 if ui
121 .add(egui::Slider::new(&mut self.window_size, 1..=2000).text("window size"))
122 .changed()
123 {
124 self.audio_system.set_window_size(self.window_size);
125 }
126
127 ui.separator();
128
129 self.draw_oscilloscope(ui);
130 });
131
132 self.audio_system.update();
133
134 if !self.audio_system.is_activated() {
135 panic!("Audio system disconnected");
136 }
137
138 cx.request_repaint();
139 }
140}

Callers

nothing calls this directly

Calls 7

uiMethod · 0.80
play_sampleMethod · 0.80
set_bypassedMethod · 0.80
set_window_sizeMethod · 0.80
draw_oscilloscopeMethod · 0.80
addMethod · 0.45
is_activatedMethod · 0.45

Tested by

no test coverage detected