From bebaf97ed2b8b62ee118a50aca2ec703a645fe23 Mon Sep 17 00:00:00 2001 From: MyBlackMIDIScore Date: Fri, 18 Oct 2024 16:59:56 +0300 Subject: [PATCH] Disable polyphony for cake --- src/gui/window/scene.rs | 2 +- src/gui/window/scene/cake_system/mod.rs | 2 +- src/gui/window/scene/note_list_system/mod.rs | 2 +- src/gui/window/settings/midi.rs | 3 ++- src/gui/window/stats.rs | 26 +++++++++++--------- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/gui/window/scene.rs b/src/gui/window/scene.rs index b145939..cc8a28f 100644 --- a/src/gui/window/scene.rs +++ b/src/gui/window/scene.rs @@ -55,7 +55,7 @@ pub struct GuiRenderScene { pub struct RenderResultData { pub notes_rendered: u64, - pub polyphony: u64, + pub polyphony: Option, pub key_colors: Vec>, } diff --git a/src/gui/window/scene/cake_system/mod.rs b/src/gui/window/scene/cake_system/mod.rs index 71ad9f5..d135db4 100644 --- a/src/gui/window/scene/cake_system/mod.rs +++ b/src/gui/window/scene/cake_system/mod.rs @@ -469,7 +469,7 @@ impl CakeRenderer { RenderResultData { notes_rendered: rendered_notes, - polyphony: 0, + polyphony: None, key_colors: colors, } } diff --git a/src/gui/window/scene/note_list_system/mod.rs b/src/gui/window/scene/note_list_system/mod.rs index c8e7fef..edd4538 100644 --- a/src/gui/window/scene/note_list_system/mod.rs +++ b/src/gui/window/scene/note_list_system/mod.rs @@ -202,7 +202,7 @@ impl NoteRenderer { RenderResultData { notes_rendered: notes_pushed as u64, - polyphony: polyphony as u64, + polyphony: Some(polyphony as u64), key_colors: columns_view_info .iter() .map(|column| column.color) diff --git a/src/gui/window/settings/midi.rs b/src/gui/window/settings/midi.rs index 67eef09..cb24290 100644 --- a/src/gui/window/settings/midi.rs +++ b/src/gui/window/settings/midi.rs @@ -33,7 +33,8 @@ impl SettingsWindow { - Cake\n\ \0 The most efficient loading and displaying algorithm.\n\ \0 The notes will be stored in binary trees and will be\n\ - \0 displayed dynamically.\n\ + \0 displayed dynamically. This mode does not support\n\ + \0 polyphony statistics.\n\ - Standard (RAM)\n\ \0 The MIDI will be loaded in the RAM and all the notes\n\ \0 will be rendered normally by the GPU.\n\ diff --git a/src/gui/window/stats.rs b/src/gui/window/stats.rs index dd8948a..fc530c0 100644 --- a/src/gui/window/stats.rs +++ b/src/gui/window/stats.rs @@ -13,7 +13,7 @@ pub struct GuiMidiStats { time_passed: f64, time_total: f64, notes_on_screen: u64, - polyphony: u64, + polyphony: Option, voice_count: Option, } @@ -23,7 +23,7 @@ impl GuiMidiStats { time_passed: 0.0, time_total: 0.0, notes_on_screen: 0, - polyphony: 0, + polyphony: None, voice_count: None, } } @@ -36,7 +36,7 @@ impl GuiMidiStats { self.notes_on_screen = notes; } - pub fn set_polyphony(&mut self, polyphony: u64) { + pub fn set_polyphony(&mut self, polyphony: Option) { self.polyphony = polyphony; } } @@ -184,15 +184,17 @@ impl GuiWasabiWindow { }); } Statistics::Polyphony => { - ui.horizontal(|ui| { - ui.monospace("Polyphony:"); - ui.with_layout( - egui::Layout::right_to_left(egui::Align::Center), - |ui| { - ui.monospace(format!("{}", stats.polyphony)); - }, - ); - }); + if let Some(poly) = stats.polyphony { + ui.horizontal(|ui| { + ui.monospace("Polyphony:"); + ui.with_layout( + egui::Layout::right_to_left(egui::Align::Center), + |ui| { + ui.monospace(format!("{}", poly)); + }, + ); + }); + } } }; }