From 103a085304fdecc4826b065ea81a5c2d3fe8d170 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 15:37:16 +0200 Subject: [PATCH 1/6] Use the input channel count parameter when initing capture. Readme change. --- Source/PluginProcessor.cpp | 3 ++- readme.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 4ace62c..1e0b17e 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -625,7 +625,8 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b) { m_using_memory_buffer = true; m_current_file = File(); - m_recbuffer.setSize(getMainBusNumInputChannels(), m_max_reclen*getSampleRateChecked()+4096,false,false,true); + int numchans = *m_inchansparam; + m_recbuffer.setSize(numchans, m_max_reclen*getSampleRateChecked()+4096,false,false,true); m_recbuffer.clear(); m_rec_pos = 0; m_thumb->reset(m_recbuffer.getNumChannels(), getSampleRateChecked(), lenbufframes); diff --git a/readme.txt b/readme.txt index 993fe1a..c3ac753 100644 --- a/readme.txt +++ b/readme.txt @@ -8,7 +8,7 @@ Released under GNU General Public License v.2 license. History : -02-12-2018 1.0.1 +02-13-2018 1.0.1 -Increased maximum number of input channels to 8 -GUI performance improvement/bug fix during capture mode 02-09-2018 1.0.0 From 53029555d0ccac23a5aa626778018cac12ad4ef4 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 15:47:17 +0200 Subject: [PATCH 2/6] Parameter layout tweaks etc --- Source/PluginEditor.cpp | 8 +++++++- Source/PluginProcessor.cpp | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 74ea489..da397f1 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -139,6 +139,9 @@ void PaulstretchpluginAudioProcessorEditor::resized() int xoffs = 1; int yoffs = 30; int div = w / 4; + //std::vector> layout; + //layout.emplace_back(cpi_capture_enabled, cpi_passthrough, cpi_pause_enabled, cpi_freeze); + //layout.emplace_back(cpi_main_volume, cpi_num_inchans, cpi_num_outchans); m_parcomps[cpi_capture_enabled]->setBounds(xoffs, yoffs, div-1, 24); //xoffs += div; //m_parcomps[cpi_max_capture_len]->setBounds(xoffs, yoffs, div - 1, 24); @@ -898,7 +901,10 @@ void ParameterComponent::resized() { if (m_slider) { - m_label.setBounds(0, 0, 200, 24); + int labw = 200; + if (getWidth() < 400) + labw = 100; + m_label.setBounds(0, 0, labw, 24); m_slider->setBounds(m_label.getRight() + 1, 0, getWidth() - 2 - m_label.getWidth(), 24); } if (m_togglebut) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 1e0b17e..daa5664 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -134,13 +134,13 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() filt_convertFrom0To1Func,filt_convertTo0To1Func), 20000.0f));; // 24 addParameter(make_floatpar("onsetdetect_0", "Onset detection", 0.0f, 1.0f, 0.0f, 0.01, 1.0)); // 25 addParameter(new AudioParameterBool("capture_enabled0", "Capture", false)); // 26 - m_outchansparam = new AudioParameterInt("numoutchans0", "Num output channels", 2, 8, 2); // 27 + m_outchansparam = new AudioParameterInt("numoutchans0", "Num outs", 2, 8, 2); // 27 addParameter(m_outchansparam); // 27 addParameter(new AudioParameterBool("pause_enabled0", "Pause", false)); // 28 addParameter(new AudioParameterFloat("maxcapturelen_0", "Max capture length", 1.0f, 120.0f, 10.0f)); // 29 addParameter(new AudioParameterBool("passthrough0", "Pass input through", false)); // 30 addParameter(new AudioParameterBool("markdirty0", "Internal (don't use)", false)); // 31 - m_inchansparam = new AudioParameterInt("numinchans0", "Num input channels", 2, 8, 2); // 32 + m_inchansparam = new AudioParameterInt("numinchans0", "Num ins", 2, 8, 2); // 32 addParameter(m_inchansparam); // 32 auto& pars = getParameters(); for (const auto& p : pars) From c9a3a3ab03ad4e9b95ad67f64743ef16e6f2c468 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 16:51:57 +0200 Subject: [PATCH 3/6] 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: From 3a36e359031c7df72bec695e6cbac7ba7fd5b098 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 17:52:45 +0200 Subject: [PATCH 4/6] Store and restore tech info toggle via settings file --- Source/PluginEditor.cpp | 1 + Source/PluginProcessor.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 1999604..a4a356c 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -388,6 +388,7 @@ String juceversiontxt = String("JUCE ") + String(JUCE_MAJOR_VERSION) + "." + Str if (r == 7) { toggleBool(processor.m_show_technical_info); + processor.m_propsfile->m_props_file->setValue("showtechnicalinfo", processor.m_show_technical_info); } } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index daa5664..b526ea9 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -147,6 +147,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() m_reset_pars.push_back(p->getValue()); setPreBufferAmount(2); startTimer(1, 50); + m_show_technical_info = m_propsfile->m_props_file->getBoolValue("showtechnicalinfo", false); } PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor() From acbbe693bd621a9b25c25da3d9a16252b3fc2a4b Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 19:41:52 +0200 Subject: [PATCH 5/6] Boolean stuff --- Source/PS_Source/globals.h | 5 +++++ Source/PluginProcessor.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index 070fe18..8d932ec 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -246,3 +246,8 @@ inline void toggleBool(bool& b) { b = !b; } + +inline void toggleBool(AudioParameterBool* b) +{ + *b = !(*b); +} diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index b526ea9..4738495 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -615,7 +615,7 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int void PaulstretchpluginAudioProcessor::setDirty() { - *getBoolParameter(cpi_markdirty) = !(*getBoolParameter(cpi_markdirty)); + toggleBool(getBoolParameter(cpi_markdirty)); } void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b) From b6f5c0ea7d3757c04521deb0c0f3304638820077 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 13 Feb 2018 22:16:18 +0200 Subject: [PATCH 6/6] Shorten the FFT switch crossfade length. Remove commented out code. Formatting change. --- Source/PS_Source/Stretch.cpp | 9 ++++++--- Source/PS_Source/StretchSource.cpp | 2 +- Source/PluginEditor.cpp | 6 ------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Source/PS_Source/Stretch.cpp b/Source/PS_Source/Stretch.cpp index 726c37d..e73f7e9 100644 --- a/Source/PS_Source/Stretch.cpp +++ b/Source/PS_Source/Stretch.cpp @@ -28,11 +28,14 @@ FFT::FFT(int nsamples_, bool no_inverse) printf("WARNING: Odd sample size on FFT::FFT() (%d)",nsamples); }; smp.resize(nsamples); - for (int i = 0; i < nsamples; i++) smp[i] = 0.0; + for (int i = 0; i < nsamples; i++) + smp[i] = 0.0; freq.resize(nsamples/2+1); - for (int i=0;idrawChannels(g, { 0,m_topmargin,getWidth(),getHeight() - m_topmargin }, thumblen*m_view_range.getStart(), thumblen*m_view_range.getEnd(), 1.0f); } - //g.setColour(Colours::darkgrey); - //m_thumb->drawChannels(g, { 0,m_topmargin,getWidth(),getHeight()-m_topmargin }, - // 0.0, thumblen, 1.0f); g.setColour(Colours::white.withAlpha(0.5f)); double sel_len = m_time_sel_end - m_time_sel_start; //if (sel_len > 0.0 && sel_len < 1.0) @@ -530,7 +525,6 @@ void WaveformComponent::timerCallback() void WaveformComponent::setFileCachedRange(std::pair, Range> rng) { m_file_cached = rng; - //repaint(); } void WaveformComponent::setTimerEnabled(bool b)