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

Method update

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

Source from the content-addressed store, hash-verified

879
880impl App for DemoApp {
881 fn update(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame) {
882 egui::TopBottomPanel::top("top_panel").show(cx, |ui| {
883 egui::MenuBar::new().ui(ui, |ui| {
884 #[cfg(not(target_arch = "wasm32"))]
885 {
886 ui.menu_button("Menu", |ui| {
887 if ui.button("Quit").clicked() {
888 cx.send_viewport_cmd(egui::ViewportCommand::Close)
889 }
890 });
891 ui.add_space(16.0);
892 }
893
894 egui::widgets::global_theme_preference_switch(ui);
895
896 if ui.button("Clear All").clicked() {
897 self.audio_system.reset();
898
899 self.snarl = Default::default();
900 self.snarl.insert_node(
901 egui::Pos2 { x: 0.0, y: 0.0 },
902 GuiAudioNode {
903 node: GuiAudioNodeType::SystemOut,
904 id: self.audio_system.graph_out_node_id(),
905 bypassed: false,
906 },
907 );
908 }
909 });
910
911 if self.last_cpu_usage_update.elapsed() >= Duration::from_secs(1) {
912 self.last_cpu_usage_update = Instant::now();
913 self.overall_cpu_usage_percent =
914 (self.audio_system.cx.profiling_data().overall_cpu_usage * 100.0).round()
915 as u32;
916 };
917 ui.label(format!(
918 "overall cpu usage: {}",
919 self.overall_cpu_usage_percent
920 ));
921 });
922
923 egui::CentralPanel::default().show(cx, |ui| {
924 self.snarl_ui_id = Some(ui.id());
925
926 self.snarl.show(
927 &mut DemoViewer {
928 audio_system: &mut self.audio_system,
929 },
930 &self.style,
931 "snarl",
932 ui,
933 );
934 });
935
936 self.audio_system.update();
937
938 if !self.audio_system.is_activated() {

Callers

nothing calls this directly

Calls 7

nowFunction · 0.85
uiMethod · 0.80
profiling_dataMethod · 0.80
idMethod · 0.80
resetMethod · 0.45
graph_out_node_idMethod · 0.45
is_activatedMethod · 0.45

Tested by

no test coverage detected