Show additional technical info in label optionally. Added utility function to toggle a bool variable.

This commit is contained in:
xenakios 2018-02-13 16:51:57 +02:00
parent 53029555d0
commit c9a3a3ab03
3 changed files with 24 additions and 6 deletions

View File

@ -240,4 +240,9 @@ inline String secondsToString(double seconds)
timestring = String(durintdays) + " days " + String(durinthours % 24) + " hours " +
String(durintminutes % 60) + " mins ";
return timestring;
}
}
inline void toggleBool(bool& b)
{
b = !b;
}

View File

@ -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)

View File

@ -162,6 +162,7 @@ public:
void setStateFromTree(ValueTree tree);
bool m_state_dirty = false;
std::unique_ptr<AudioThumbnail> m_thumb;
bool m_show_technical_info = false;
private: