From 962d4806b50410be5e1c63772897bf0feab92ee6 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 14 Nov 2017 00:50:12 +0200 Subject: [PATCH] Tiny improvements but things arestill not working right --- Source/PS_Source/Input/AInputS.h | 1 + Source/PluginEditor.cpp | 4 ++++ Source/PluginProcessor.cpp | 6 ++++++ Source/PluginProcessor.h | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/PS_Source/Input/AInputS.h b/Source/PS_Source/Input/AInputS.h index 4c5b5c1..c57bd20 100644 --- a/Source/PS_Source/Input/AInputS.h +++ b/Source/PS_Source/Input/AInputS.h @@ -57,6 +57,7 @@ public: info.nsamples = len; info.samplerate = samplerate; m_currentsample = 0; + m_loop_enabled = true; m_crossfadebuf.setSize(info.nchannels, m_crossfadebuf.getNumSamples()); m_cached_file_range = { 0,len }; updateXFadeCache(); diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index c77ecc2..49b530b 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -34,6 +34,10 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa *processor.getFloatParameter(5) = range.getStart(); *processor.getFloatParameter(6) = range.getEnd(); }; + m_wavecomponent.CursorPosCallback = [this]() + { + return processor.m_control->getLivePlayPosition(); + }; m_wavecomponent.ShowFileCacheRange = true; startTimer(1, 100); } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 028ebf7..2b7c622 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -25,11 +25,14 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() ) #endif { + m_recbuffer.setSize(2, 44100); + m_recbuffer.clear(); m_afm = std::make_unique(); m_afm->registerBasicFormats(); m_control = std::make_unique(m_afm.get()); m_control->ppar.pitch_shift.enabled = true; m_control->ppar.freq_shift.enabled = true; + m_control->setOnsetDetection(0.0); m_control->getStretchAudioSource()->setLoopingEnabled(true); addParameter(new AudioParameterFloat("mainvolume0", "Main volume", -24.0f, 12.0f, -3.0f)); addParameter(new AudioParameterFloat("stretchamount0", "Stretch amount", 0.1f, 128.0f, 1.0f)); @@ -110,10 +113,13 @@ void PaulstretchpluginAudioProcessor::changeProgramName (int index, const String //============================================================================== void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock) { + if (m_using_memory_buffer == true) + m_control->getStretchAudioSource()->setAudioBufferAsInputSource(&m_recbuffer, getSampleRate(), m_recbuffer.getNumSamples()); if (m_ready_to_play == false) { m_control->update_player_stretch(); m_control->update_process_parameters(); + String err; m_control->startplay(false, true, { *getFloatParameter(5),*getFloatParameter(6) }, diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 0798576..187c59d 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -63,8 +63,9 @@ public: bool isRecordingEnabled() { return m_is_recording; } double getRecordingPositionPercent(); std::unique_ptr m_afm; -private: std::unique_ptr m_control; +private: + bool m_ready_to_play = false; AudioBuffer m_recbuffer;