(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame)
| 88 | |
| 89 | impl 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 | } |
nothing calls this directly
no test coverage detected