Made rewind a parameter. Attempts to fix the time range not being recalled properly in hosts because the time range parameters may be quickly changed when the plugin is initializing and doing the sound source smoothing fades. etc
This commit is contained in:
parent
236e6b076e
commit
db7a15d161
@ -330,6 +330,7 @@ public:
|
|||||||
void setActiveRange(Range<double> rng) override
|
void setActiveRange(Range<double> rng) override
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> locker(m_mutex);
|
std::lock_guard<std::mutex> locker(m_mutex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (rng.contains(getCurrentPositionPercent()))
|
if (rng.contains(getCurrentPositionPercent()))
|
||||||
{
|
{
|
||||||
@ -338,7 +339,7 @@ public:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
m_seekfade.requestedrange = rng;
|
m_seekfade.requestedrange = rng;
|
||||||
if (m_seekfade.state == 0)
|
//if (m_seekfade.state == 0)
|
||||||
{
|
{
|
||||||
m_seekfade.counter = 0;
|
m_seekfade.counter = 0;
|
||||||
m_seekfade.state = 1;
|
m_seekfade.state = 1;
|
||||||
|
@ -156,7 +156,7 @@ void StretchAudioSource::setAudioBufferAsInputSource(AudioBuffer<float>* buf, in
|
|||||||
|
|
||||||
m_curfile = File();
|
m_curfile = File();
|
||||||
if (m_playrange.isEmpty())
|
if (m_playrange.isEmpty())
|
||||||
setPlayRange({ 0.0,1.0 }, true);
|
setPlayRange({ 0.0,1.0 });
|
||||||
++m_param_change_count;
|
++m_param_change_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,6 +684,7 @@ void StretchAudioSource::seekPercent(double pos)
|
|||||||
{
|
{
|
||||||
ScopedLock locker(m_cs);
|
ScopedLock locker(m_cs);
|
||||||
m_seekpos = pos;
|
m_seekpos = pos;
|
||||||
|
//m_firstbuffer = true;
|
||||||
//m_resampler->Reset();
|
//m_resampler->Reset();
|
||||||
m_inputfile->seek(pos);
|
m_inputfile->seek(pos);
|
||||||
++m_param_change_count;
|
++m_param_change_count;
|
||||||
@ -715,7 +716,7 @@ void StretchAudioSource::setOnsetDetection(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StretchAudioSource::setPlayRange(Range<double> playrange, bool isloop)
|
void StretchAudioSource::setPlayRange(Range<double> playrange)
|
||||||
{
|
{
|
||||||
if (m_playrange.isEmpty() == false && playrange == m_playrange)
|
if (m_playrange.isEmpty() == false && playrange == m_playrange)
|
||||||
return;
|
return;
|
||||||
@ -727,7 +728,7 @@ void StretchAudioSource::setPlayRange(Range<double> playrange, bool isloop)
|
|||||||
m_playrange = playrange;
|
m_playrange = playrange;
|
||||||
m_stream_end_reached = false;
|
m_stream_end_reached = false;
|
||||||
m_inputfile->setActiveRange(m_playrange);
|
m_inputfile->setActiveRange(m_playrange);
|
||||||
m_inputfile->setLoopEnabled(isloop);
|
|
||||||
//if (m_playrange.contains(m_seekpos) == false)
|
//if (m_playrange.contains(m_seekpos) == false)
|
||||||
// m_inputfile->seek(m_playrange.getStart());
|
// m_inputfile->seek(m_playrange.getStart());
|
||||||
m_seekpos = m_playrange.getStart();
|
m_seekpos = m_playrange.getStart();
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
double getOutputDurationSecondsForRange(Range<double> range, int fftsize);
|
double getOutputDurationSecondsForRange(Range<double> range, int fftsize);
|
||||||
|
|
||||||
void setOnsetDetection(double x);
|
void setOnsetDetection(double x);
|
||||||
void setPlayRange(Range<double> playrange, bool isloop);
|
void setPlayRange(Range<double> playrange);
|
||||||
Range<double> getPlayRange() { return m_playrange; }
|
Range<double> getPlayRange() { return m_playrange; }
|
||||||
bool isLoopEnabled();
|
bool isLoopEnabled();
|
||||||
bool hasReachedEnd();
|
bool hasReachedEnd();
|
||||||
|
@ -67,7 +67,8 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
|
|||||||
m_rewind_button.setButtonText("<<");
|
m_rewind_button.setButtonText("<<");
|
||||||
m_rewind_button.onClick = [this]()
|
m_rewind_button.onClick = [this]()
|
||||||
{
|
{
|
||||||
processor.getStretchSource()->seekPercent(processor.getStretchSource()->getPlayRange().getStart());
|
*processor.getBoolParameter(cpi_rewind) = true;
|
||||||
|
//processor.getStretchSource()->seekPercent(processor.getStretchSource()->getPlayRange().getStart());
|
||||||
};
|
};
|
||||||
|
|
||||||
addAndMakeVisible(&m_info_label);
|
addAndMakeVisible(&m_info_label);
|
||||||
|
@ -175,6 +175,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
addParameter(new AudioParameterBool("loop_enabled0", "Loop", true)); // 60
|
addParameter(new AudioParameterBool("loop_enabled0", "Loop", true)); // 60
|
||||||
|
addParameter(new AudioParameterBool("rewind0", "Rewind", false)); // 61
|
||||||
|
|
||||||
auto& pars = getParameters();
|
auto& pars = getParameters();
|
||||||
for (const auto& p : pars)
|
for (const auto& p : pars)
|
||||||
@ -392,7 +393,7 @@ void PaulstretchpluginAudioProcessor::setFFTSize(double size)
|
|||||||
|
|
||||||
void PaulstretchpluginAudioProcessor::startplay(Range<double> playrange, int numoutchans, int maxBlockSize, String& err)
|
void PaulstretchpluginAudioProcessor::startplay(Range<double> playrange, int numoutchans, int maxBlockSize, String& err)
|
||||||
{
|
{
|
||||||
m_stretch_source->setPlayRange(playrange, true);
|
m_stretch_source->setPlayRange(playrange);
|
||||||
m_stretch_source->setFreeFilterEnvelope(m_free_filter_envelope);
|
m_stretch_source->setFreeFilterEnvelope(m_free_filter_envelope);
|
||||||
int bufamt = m_bufamounts[m_prebuffer_amount];
|
int bufamt = m_bufamounts[m_prebuffer_amount];
|
||||||
|
|
||||||
@ -479,7 +480,7 @@ String PaulstretchpluginAudioProcessor::offlineRender(File outputfile)
|
|||||||
double t1 = *getFloatParameter(cpi_soundend);
|
double t1 = *getFloatParameter(cpi_soundend);
|
||||||
sanitizeTimeRange(t0, t1);
|
sanitizeTimeRange(t0, t1);
|
||||||
ss->setRate(*getFloatParameter(cpi_stretchamount));
|
ss->setRate(*getFloatParameter(cpi_stretchamount));
|
||||||
ss->setPlayRange({ t0,t1 }, true);
|
ss->setPlayRange({ t0,t1 });
|
||||||
ss->setLoopingEnabled(true);
|
ss->setLoopingEnabled(true);
|
||||||
ss->setNumOutChannels(numoutchans);
|
ss->setNumOutChannels(numoutchans);
|
||||||
ss->setFFTWindowingType(1);
|
ss->setFFTWindowingType(1);
|
||||||
@ -542,6 +543,7 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl
|
|||||||
m_cur_sr = sampleRate;
|
m_cur_sr = sampleRate;
|
||||||
m_curmaxblocksize = samplesPerBlock;
|
m_curmaxblocksize = samplesPerBlock;
|
||||||
m_input_buffer.setSize(getMainBusNumInputChannels(), samplesPerBlock);
|
m_input_buffer.setSize(getMainBusNumInputChannels(), samplesPerBlock);
|
||||||
|
*getBoolParameter(cpi_rewind) = false;
|
||||||
int numoutchans = *m_outchansparam;
|
int numoutchans = *m_outchansparam;
|
||||||
if (numoutchans != m_cur_num_out_chans)
|
if (numoutchans != m_cur_num_out_chans)
|
||||||
m_prebuffering_inited = false;
|
m_prebuffering_inited = false;
|
||||||
@ -663,6 +665,10 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
}
|
}
|
||||||
jassert(m_buffering_source != nullptr);
|
jassert(m_buffering_source != nullptr);
|
||||||
jassert(m_bufferingthread.isThreadRunning());
|
jassert(m_bufferingthread.isThreadRunning());
|
||||||
|
double t0 = *getFloatParameter(cpi_soundstart);
|
||||||
|
double t1 = *getFloatParameter(cpi_soundend);
|
||||||
|
sanitizeTimeRange(t0, t1);
|
||||||
|
m_stretch_source->setPlayRange({ t0,t1 });
|
||||||
if (m_last_host_playing == false && m_playposinfo.isPlaying)
|
if (m_last_host_playing == false && m_playposinfo.isPlaying)
|
||||||
{
|
{
|
||||||
m_stretch_source->seekPercent(*getFloatParameter(cpi_soundstart));
|
m_stretch_source->seekPercent(*getFloatParameter(cpi_soundstart));
|
||||||
@ -686,6 +692,16 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
|
|
||||||
if (m_stretch_source->isLoopEnabled() != *getBoolParameter(cpi_looping_enabled))
|
if (m_stretch_source->isLoopEnabled() != *getBoolParameter(cpi_looping_enabled))
|
||||||
m_stretch_source->setLoopingEnabled(*getBoolParameter(cpi_looping_enabled));
|
m_stretch_source->setLoopingEnabled(*getBoolParameter(cpi_looping_enabled));
|
||||||
|
bool rew = *getBoolParameter(cpi_rewind);
|
||||||
|
if (rew !=m_lastrewind)
|
||||||
|
{
|
||||||
|
if (rew == true)
|
||||||
|
{
|
||||||
|
*getBoolParameter(cpi_rewind) = false;
|
||||||
|
m_stretch_source->seekPercent(m_stretch_source->getPlayRange().getStart());
|
||||||
|
}
|
||||||
|
m_lastrewind = rew;
|
||||||
|
}
|
||||||
|
|
||||||
m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume));
|
m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume));
|
||||||
m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount));
|
m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount));
|
||||||
@ -696,11 +712,9 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
|
|
||||||
m_stretch_source->setOnsetDetection(*getFloatParameter(cpi_onsetdetection));
|
m_stretch_source->setOnsetDetection(*getFloatParameter(cpi_onsetdetection));
|
||||||
m_stretch_source->setLoopXFadeLength(*getFloatParameter(cpi_loopxfadelen));
|
m_stretch_source->setLoopXFadeLength(*getFloatParameter(cpi_loopxfadelen));
|
||||||
double t0 = *getFloatParameter(cpi_soundstart);
|
|
||||||
double t1 = *getFloatParameter(cpi_soundend);
|
|
||||||
sanitizeTimeRange(t0, t1);
|
|
||||||
|
|
||||||
m_stretch_source->setPlayRange({ t0,t1 }, true);
|
|
||||||
|
|
||||||
m_stretch_source->setFreezing(getParameter(cpi_freeze));
|
m_stretch_source->setFreezing(getParameter(cpi_freeze));
|
||||||
m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
|
m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
|
||||||
m_stretch_source->setProcessParameters(&m_ppar);
|
m_stretch_source->setProcessParameters(&m_ppar);
|
||||||
@ -902,7 +916,7 @@ void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording)
|
|||||||
{
|
{
|
||||||
m_is_recording = false;
|
m_is_recording = false;
|
||||||
m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer, getSampleRateChecked(), lenrecording);
|
m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer, getSampleRateChecked(), lenrecording);
|
||||||
m_stretch_source->setPlayRange({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) }, true);
|
m_stretch_source->setPlayRange({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) });
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
||||||
|
@ -88,6 +88,7 @@ const int cpi_octaves_ratio5 = 57;
|
|||||||
const int cpi_octaves_ratio6 = 58;
|
const int cpi_octaves_ratio6 = 58;
|
||||||
const int cpi_octaves_ratio7 = 59;
|
const int cpi_octaves_ratio7 = 59;
|
||||||
const int cpi_looping_enabled = 60;
|
const int cpi_looping_enabled = 60;
|
||||||
|
const int cpi_rewind = 61;
|
||||||
|
|
||||||
class MyPropertiesFile
|
class MyPropertiesFile
|
||||||
{
|
{
|
||||||
@ -258,6 +259,7 @@ private:
|
|||||||
float m_cur_playrangeoffset = 0.0;
|
float m_cur_playrangeoffset = 0.0;
|
||||||
void updateStretchParametersFromPluginParameters(ProcessParameters& pars);
|
void updateStretchParametersFromPluginParameters(ProcessParameters& pars);
|
||||||
std::array<AudioParameterBool*, 9> m_sm_enab_pars;
|
std::array<AudioParameterBool*, 9> m_sm_enab_pars;
|
||||||
|
bool m_lastrewind = false;
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
|
||||||
};
|
};
|
||||||
|
@ -9,8 +9,9 @@ Released under GNU General Public License v.2 license.
|
|||||||
History :
|
History :
|
||||||
05-18-2018 1.2.1
|
05-18-2018 1.2.1
|
||||||
-Added looping enabled parameter
|
-Added looping enabled parameter
|
||||||
-Added button to rewind to beginning of selected time range
|
-Added button and parameter to rewind to beginning of selected time range
|
||||||
-Flush old stretched audio faster when source audio is changed
|
-Flush old stretched audio faster when source audio is changed
|
||||||
|
-Fix time range not being recalled properly when loading host project
|
||||||
05-07-2018 1.2.0
|
05-07-2018 1.2.0
|
||||||
-Changed "Octaves" module to "Ratios". The Ratios module has more shifters than the previous
|
-Changed "Octaves" module to "Ratios". The Ratios module has more shifters than the previous
|
||||||
Octaves module and allows changing the pitch ratios (and the shifters mix)
|
Octaves module and allows changing the pitch ratios (and the shifters mix)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user