From 23d63c88279c8f53fc7cc65fd022bed533004716 Mon Sep 17 00:00:00 2001 From: xenakios Date: Thu, 17 Jan 2019 15:23:01 +0200 Subject: [PATCH] Removed the phase freeze processing for now. --- Source/PS_Source/Stretch.cpp | 34 ++---------------------------- Source/PS_Source/Stretch.h | 10 ++++----- Source/PS_Source/StretchSource.cpp | 17 --------------- Source/PS_Source/StretchSource.h | 5 ++--- Source/PluginProcessor.cpp | 4 ++-- Source/PluginProcessor.h | 1 - readme.txt | 3 +-- 7 files changed, 11 insertions(+), 63 deletions(-) diff --git a/Source/PS_Source/Stretch.cpp b/Source/PS_Source/Stretch.cpp index 9b656b8..579b3ca 100644 --- a/Source/PS_Source/Stretch.cpp +++ b/Source/PS_Source/Stretch.cpp @@ -38,8 +38,7 @@ FFT::FFT(int nsamples_, bool no_inverse) window.data[i]=0.707f; window.type=W_RECTANGULAR; - phases.resize(nsamples); - data.resize(nsamples,true); + data.resize(nsamples,true); bool allow_long_planning = false; // g_propsfile->getBoolValue("fftw_allow_long_planning", false); //double t0 = Time::getMillisecondCounterHiRes(); if (allow_long_planning) @@ -92,15 +91,9 @@ void FFT::smp2freq() void FFT::freq2smp() { REALTYPE inv_2p15_2pi=1.0f/16384.0f*(float)c_PI; - if (m_phaserefreshcounter % m_phaserefreshrate == 0) - { - updatePhases(); - //Logger::writeToLog("phases updated "+String(m_phaserefreshrate)); - } - ++m_phaserefreshcounter; for (int i=1;isetPhaseRefreshRate(rate); -} - int Stretch::get_nsamples(REALTYPE current_pos_percents){ if (bypass) return bufsize; if (freezing) return 0; diff --git a/Source/PS_Source/Stretch.h b/Source/PS_Source/Stretch.h index 72957b2..fb89b4c 100644 --- a/Source/PS_Source/Stretch.h +++ b/Source/PS_Source/Stretch.h @@ -124,19 +124,17 @@ class FFT void applywindow(FFTWindow type); std::vector smp;//size of samples/2 std::vector freq;//size of samples - std::vector phases; + int nsamples=0; - void setPhaseRefreshRate(int rate); + private: fftwf_plan planfftw,planifftw; FFTWBuffer data; - int m_phaserefreshcounter = 0; - int m_phaserefreshrate = 1; - void updatePhases(); + struct{ std::vector data; FFTWindow type; @@ -171,7 +169,7 @@ class Stretch freezing=new_freezing; }; bool isFreezing() { return freezing; } - void setPhaseRefreshRate(int rate); + std::vector out_buf;//pot sa pun o variabila "max_out_bufsize" si asta sa fie marimea lui out_buf si pe out_bufsize sa il folosesc ca marime adaptiva int get_nsamples(REALTYPE current_pos_percents);//how many samples are required diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index d34c833..0728633 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -277,23 +277,6 @@ void StretchAudioSource::setSpectralOrderPreset(int id) } } -void StretchAudioSource::setPhaseRefreshRate(int rate) -{ - for (auto& e : m_stretchers) - e->setPhaseRefreshRate(rate); - return; - if (rate == m_phase_refresh_rate) - return; - if (m_cs.tryEnter()) - { - for (auto& e : m_stretchers) - e->setPhaseRefreshRate(rate); - m_phase_refresh_rate = rate; - ++m_param_change_count; - m_cs.exit(); - } -} - void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill) { ScopedLock locker(m_cs); diff --git a/Source/PS_Source/StretchSource.h b/Source/PS_Source/StretchSource.h index 95a0f5a..aab20d6 100644 --- a/Source/PS_Source/StretchSource.h +++ b/Source/PS_Source/StretchSource.h @@ -114,8 +114,7 @@ public: int64_t getLastSourcePosition() const { return m_last_filepos; } int m_prebuffersize = 0; void setSpectralOrderPreset(int id); - int getPhaseRefreshRate() const { return m_phase_refresh_rate; } - void setPhaseRefreshRate(int rate); + private: CircularBuffer m_stretchoutringbuf{ 1024 * 1024 }; AudioBuffer m_file_inbuf; @@ -144,7 +143,7 @@ private: int m_pause_state = 0; Range m_playrange{ 0.0,1.0 }; int64_t m_rand_count = 0; - int m_phase_refresh_rate = 1; + bool m_stream_end_reached = false; int64_t m_output_silence_counter = 0; File m_curfile; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 8368360..83c81b6 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -184,7 +184,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() addParameter(new AudioParameterFloat("dryplayrate0", "Dry playrate", NormalisableRange(0.1f, 8.0f, dprate_convertFrom0To1Func, dprate_convertTo0To1Func), 1.0f)); // 62 - addParameter(new AudioParameterInt("phaserefreshrate0", "Phase randomization rate", 1, 32, 32)); // 63 + auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); @@ -745,7 +745,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M m_free_filter_envelope->m_transform_y_random_rate = *getIntParameter(cpi_freefilter_randomy_rate); m_free_filter_envelope->m_transform_y_random_amount = *getFloatParameter(cpi_freefilter_randomy_amount); - m_stretch_source->setPhaseRefreshRate(*getIntParameter(cpi_phase_refresh_rate)); + //m_stretch_source->setSpectralModulesEnabled(m_sm_enab_pars); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 37a1182..8434645 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -88,7 +88,6 @@ const int cpi_octaves_ratio7 = 59; const int cpi_looping_enabled = 60; const int cpi_rewind = 61; const int cpi_dryplayrate = 62; -const int cpi_phase_refresh_rate = 63; class MyThreadPool : public ThreadPool { diff --git a/readme.txt b/readme.txt index 9bc8f6e..515fcf3 100644 --- a/readme.txt +++ b/readme.txt @@ -7,13 +7,12 @@ Copyright (C) 2017-2018 Xenakios Released under GNU General Public License v.3 license. History : -08-01-2019 1.3.0 +01-17-2019 1.3.0 -Captured audio buffers can optionally be saved as files on disk for later recall. -Added varispeed (resampling speed change) feature when spectral stretch engine is bypassed -Added shortcut key (may not work properly in all plugin formats and hosts) : "I" to open file import dialog -Attempt to prevent capture enabled state from being recalled when undoing in the host - -Added VST3 version 07-09-2018 1.2.2 -Add option to mute audio when capturing audio -Automatically adjust play range after capturing to captured length