From c9a3a3ab03ad4e9b95ad67f64743ef16e6f2c468 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 16:51:57 +0200 Subject: [PATCH] Show additional technical info in label optionally. Added utility function to toggle a bool variable. --- Source/PS_Source/globals.h | 7 ++++++- Source/PluginEditor.cpp | 22 +++++++++++++++++----- Source/PluginProcessor.h | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index e8ab891..070fe18 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -240,4 +240,9 @@ inline String secondsToString(double seconds) timestring = String(durintdays) + " days " + String(durinthours % 24) + " hours " + String(durintminutes % 60) + " mins "; return timestring; -} \ No newline at end of file +} + +inline void toggleBool(bool& b) +{ + b = !b; +} diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index da397f1..1999604 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -238,7 +238,13 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) m_wavecomponent.setRecordingPosition(processor.getRecordingPositionPercent()); } else m_wavecomponent.setRecordingPosition(-1.0); - String infotext = String(processor.getStretchSource()->m_param_change_count)+" param changes "+m_last_err+" FFT size "+ + String infotext; + if (processor.m_show_technical_info) + { + infotext += String(processor.getStretchSource()->m_param_change_count); + infotext += " param changes "; + } + infotext += m_last_err + " FFT size " + String(processor.getStretchSource()->getFFTSize()); if (processor.m_abnormal_output_samples > 0) infotext += " " + String(processor.m_abnormal_output_samples) + " invalid sample values"; @@ -246,7 +252,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) infotext += " (offline rendering)"; if (processor.m_playposinfo.isPlaying) infotext += " "+String(processor.m_playposinfo.timeInSeconds,1); - infotext += " " + String(m_wavecomponent.m_image_init_count) + " " + String(m_wavecomponent.m_image_update_count); + if (processor.m_show_technical_info) + infotext += " " + String(m_wavecomponent.m_image_init_count) + " " + String(m_wavecomponent.m_image_update_count); m_info_label.setText(infotext, dontSendNotification); m_perfmeter.repaint(); } @@ -329,6 +336,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() #ifdef JUCE_DEBUG menu.addItem(6, "Dump preset to clipboard", true, false); #endif + menu.addItem(7, "Show technical info", true, processor.m_show_technical_info); int r = menu.show(); if (r >= 200 && r < 210) { @@ -337,11 +345,11 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() } if (r == 1) { - processor.m_play_when_host_plays = !processor.m_play_when_host_plays; + toggleBool(processor.m_play_when_host_plays); } if (r == 2) { - processor.m_capture_when_host_plays = !processor.m_capture_when_host_plays; + toggleBool(processor.m_capture_when_host_plays); } if (r == 4) { @@ -349,7 +357,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() } if (r == 5) { - processor.m_load_file_with_state = !processor.m_load_file_with_state; + toggleBool(processor.m_load_file_with_state); } if (r == 3) { @@ -377,6 +385,10 @@ String juceversiontxt = String("JUCE ") + String(JUCE_MAJOR_VERSION) + "." + Str String txt = Base64::toBase64(destData.getData(), destData.getSize()); SystemClipboard::copyTextToClipboard(txt); } + if (r == 7) + { + toggleBool(processor.m_show_technical_info); + } } WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* thumb) diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index c471873..b4a5b8e 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -162,6 +162,7 @@ public: void setStateFromTree(ValueTree tree); bool m_state_dirty = false; std::unique_ptr m_thumb; + bool m_show_technical_info = false; private: