From 171aa5502cfcac1abc5315c8792521790195e4a9 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 11 Jan 2025 11:43:58 +0100 Subject: Add notes and temperature monitor --- UI.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'UI.cpp') diff --git a/UI.cpp b/UI.cpp index 0b281b9..5332bba 100644 --- a/UI.cpp +++ b/UI.cpp @@ -58,6 +58,7 @@ UI::UI(Config& config): m_config(config), m_main_loops{}, m_midi_events{}, + m_midi_notes{}, m_active_sensing_timestamp{}, m_midi_timestamp{}, m_note_bpm{}, @@ -89,6 +90,9 @@ void UI::draw() std::vector cpuloads = get_cpu_loads(); int main_loops_per_second = m_main_loops.get_count_per_second(); int midi_events_per_second = m_midi_events.get_count_per_second(); + int midi_notes_per_second = m_midi_notes.get_count_per_second(); + + int temperature = m_temperature.read_degree(); int mode = m_config.get_mode(); int channel = m_config.get_midi_channel(); @@ -159,12 +163,14 @@ void UI::draw() std::cout << std::endl; std::cout << fmt::format(" MIDI Timestamp: {}", m_midi_timestamp) << std::endl; std::cout << " MIDI Active Sensing: " << fmt::format(value_color, "{}", active_sensing_names[active_sensing_detected]) << std::endl; - std::cout << fmt::format(" MIDI Events/s: {}", midi_events_per_second) << std::endl; - std::cout << fmt::format(" MIDI Click: {:3} BPM", m_note_bpm) << std::endl; - std::cout << fmt::format(" MIDI Clock: {:3} BPM", m_clock_bpm) << std::endl; - std::cout << fmt::format(" Internal: {:3} BPM", internal_bpm) << std::endl; + std::cout << fmt::format(" MIDI Events/s:{:3}", midi_events_per_second) << std::endl; + std::cout << fmt::format(" MIDI Notes/s: {:3}", midi_notes_per_second) << std::endl; + std::cout << fmt::format(" MIDI Click: {:3} BPM", m_note_bpm) << std::endl; + std::cout << fmt::format(" MIDI Clock: {:3} BPM", m_clock_bpm) << std::endl; + std::cout << fmt::format(" Internal: {:3} BPM", internal_bpm) << std::endl; - std::cout << fmt::format(" Main loops/s: {}", main_loops_per_second) << std::endl; + std::cout << fmt::format(" Main loops/s: {:3}", main_loops_per_second) << std::endl; + std::cout << fmt::format(" Temperature: {:3} C", temperature) << std::endl; std::cout << std::endl; std::cout << "Log:" << std::endl; @@ -227,6 +233,11 @@ void UI::count_midi_events() m_midi_events.count(); } +void UI::count_midi_notes() +{ + m_midi_notes.count(); +} + void UI::slot_active_sensing() { m_active_sensing_timestamp = clock_type::now(); @@ -241,6 +252,8 @@ void UI::slot_midi_note(int channel, int note, uint64_t timestamp) while (m_midi_monitor.size() > midi_monitor_max_size) { m_midi_monitor.pop_back(); } + + count_midi_notes(); } void UI::slot_note_bpm(int bpm) -- cgit v1.2.3