From 178d68b0ecc76d930dd438297f35d00fe9fabe18 Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 14 Feb 2018 18:38:54 +0200 Subject: [PATCH] Store and restore zoomscrollbar positions. Readme change. --- Source/PluginEditor.cpp | 6 +++++- Source/PluginProcessor.cpp | 2 ++ Source/PluginProcessor.h | 1 + readme.txt | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 6650f6c..1dd6bb1 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -83,7 +83,9 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau m_zs.RangeChanged = [this](Range r) { m_wavecomponent.setViewRange(r); + processor.m_wave_view_range = r; }; + m_zs.setRange(processor.m_wave_view_range, true); setSize (1000, 30+(pars.size()/2)*25+200+15); m_wavecomponent.TimeSelectionChangedCallback = [this](Range range, int which) { @@ -229,7 +231,7 @@ void PaulstretchpluginAudioProcessorEditor::resized() int remain_h = getHeight() - 1 - yoffs -15; m_spec_order_ed.setBounds(1, yoffs, getWidth() - 2, remain_h / 5 * 1); m_wavecomponent.setBounds(1, m_spec_order_ed.getBottom()+1, getWidth()-2, remain_h/5*4); - m_zs.setBounds(1, m_wavecomponent.getBottom(), getWidth() - 2, 14); + m_zs.setBounds(1, m_wavecomponent.getBottom(), getWidth() - 2, 16); //m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs); } @@ -1132,6 +1134,8 @@ void zoom_scrollbar::paint(Graphics &g) void zoom_scrollbar::setRange(Range rng, bool docallback) { + if (rng.isEmpty()) + return; m_therange = rng.constrainRange({ 0.0,1.0 }); if (RangeChanged && docallback) RangeChanged(m_therange); diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 4738495..9816c1e 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -225,6 +225,7 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool paramtree.setProperty("prebufamount", -1, nullptr); paramtree.setProperty("loadfilewithstate", m_load_file_with_state, nullptr); } + storeToTreeProperties(paramtree, nullptr, "waveviewrange", m_wave_view_range); return paramtree; } @@ -246,6 +247,7 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree) } m_stretch_source->setSpectrumProcessOrder(order); } + getFromTreeProperties(tree, "waveviewrange", m_wave_view_range); for (int i = 0; i < getNumParameters(); ++i) { auto par = getFloatParameter(i); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index b4a5b8e..3a89cc4 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -163,6 +163,7 @@ public: bool m_state_dirty = false; std::unique_ptr m_thumb; bool m_show_technical_info = false; + Range m_wave_view_range; private: diff --git a/readme.txt b/readme.txt index c3ac753..00e4565 100644 --- a/readme.txt +++ b/readme.txt @@ -8,8 +8,9 @@ Released under GNU General Public License v.2 license. History : -02-13-2018 1.0.1 +02-14-2018 1.0.1 -Increased maximum number of input channels to 8 + -Added zoom/scroll bar for waveform -GUI performance improvement/bug fix during capture mode 02-09-2018 1.0.0 -Control/Command click on waveform seeks (if click within active play range)