From 3fd0b4ea091dfa0c1e3a78106b7c7f4ad435ce42 Mon Sep 17 00:00:00 2001 From: xenakios Date: Thu, 16 Nov 2017 01:42:51 +0200 Subject: [PATCH] Trying to get the Mac build working, but no luck... --- Source/PS_Source/Input/AInputS.h | 16 +++++++++++----- Source/PS_Source/Input/InputS.h | 2 +- Source/PS_Source/PaulStretchControl.cpp | 4 +++- Source/PS_Source/StretchSource.cpp | 4 +++- Source/WDL/resample.cpp | 2 +- paulstretchplugin.jucer | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Source/PS_Source/Input/AInputS.h b/Source/PS_Source/Input/AInputS.h index 6544c2b..6fc9197 100644 --- a/Source/PS_Source/Input/AInputS.h +++ b/Source/PS_Source/Input/AInputS.h @@ -22,7 +22,6 @@ #include "../JuceLibraryCode/JuceHeader.h" -//#include #include "InputS.h" inline double ramp(int64_t pos, int64_t totallen, int64_t rampinlen, int64_t rampoutlen) @@ -51,7 +50,8 @@ public: void setAudioBuffer(AudioBuffer* buf, int samplerate, int len) { - m_afreader = nullptr; + std::lock_guard locker(m_mutex); + m_afreader = nullptr; m_using_memory_buffer = true; m_readbuf = *buf; info.nchannels = buf->getNumChannels(); @@ -70,7 +70,8 @@ public: AudioFormatReader* reader = m_manager->createReaderFor(file); if (reader) { - m_using_memory_buffer = false; + std::lock_guard locker(m_mutex); + m_using_memory_buffer = false; m_afreader = std::unique_ptr(reader); m_currentsample = 0; info.samplerate = (int)m_afreader->sampleRate; @@ -96,8 +97,12 @@ public: } int readNextBlock(AudioBuffer& abuf, int nsmps, int numchans) override { - if (m_afreader == nullptr && m_using_memory_buffer == false) - return 0; + std::lock_guard locker(m_mutex); + if (m_afreader == nullptr && m_using_memory_buffer == false) + { + jassert(false); + return 0; + } int inchans = 0; if (m_afreader) inchans = m_afreader->numChannels; @@ -292,4 +297,5 @@ private: int64_t m_loopcount = 0; bool m_using_memory_buffer = false; AudioFormatManager* m_manager = nullptr; + std::mutex m_mutex; }; diff --git a/Source/PS_Source/Input/InputS.h b/Source/PS_Source/Input/InputS.h index 5176d9c..b80b4d8 100644 --- a/Source/PS_Source/Input/InputS.h +++ b/Source/PS_Source/Input/InputS.h @@ -81,7 +81,7 @@ public: } protected: - int64_t m_currentsample = 0; + volatile int64_t m_currentsample = 0; int m_silenceoutputted = 0; bool m_loop_enabled = false; Range m_activerange{ 0.0,1.0 }; diff --git a/Source/PS_Source/PaulStretchControl.cpp b/Source/PS_Source/PaulStretchControl.cpp index 79d2a7f..6e3593a 100644 --- a/Source/PS_Source/PaulStretchControl.cpp +++ b/Source/PS_Source/PaulStretchControl.cpp @@ -65,7 +65,9 @@ Control::~Control() } void Control::processAudio(AudioBuffer& buf) { - if (m_buffering_source != nullptr) + jassert(m_buffering_source!=nullptr); + jassert(m_bufferingthread.isThreadRunning()); + if (m_buffering_source != nullptr) { AudioSourceChannelInfo aif(buf); m_buffering_source->getNextAudioBlock(aif); diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 7643513..9273eed 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -134,13 +134,15 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer if (m_stretchoutringbuf.available() > 0) m_output_has_begun = true; bool freezing = m_freezing; - if (m_stretchers[0]->isFreezing() != freezing) + /* + if (m_stretchers[0]->isFreezing() != freezing) { if (freezing == true && m_inputfile!=nullptr) m_freeze_pos = 1.0/m_inputfile->info.nsamples*m_inputfile->getCurrentPosition(); for (auto& e : m_stretchers) e->set_freezing(m_freezing); } + */ double maingain = Decibels::decibelsToGain((double)val_MainVolume.getValue()); if (m_vol_smoother.getTargetValue() != maingain) m_vol_smoother.setValue(maingain); diff --git a/Source/WDL/resample.cpp b/Source/WDL/resample.cpp index 9892413..bb9f985 100644 --- a/Source/WDL/resample.cpp +++ b/Source/WDL/resample.cpp @@ -632,7 +632,7 @@ int WDL_Resampler::ResampleOut(WDL_ResampleSample *out, int nsamples_in, int nsa m_samples_in_rsinbuf -= isrcpos; if (m_samples_in_rsinbuf <= 0) m_samples_in_rsinbuf=0; else - memcpy(localin, localin + isrcpos*nch,m_samples_in_rsinbuf*sizeof(WDL_ResampleSample)*nch); + memmove(localin, localin + isrcpos*nch,m_samples_in_rsinbuf*sizeof(WDL_ResampleSample)*nch); return ret; diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index 902ea94..29ac1ba 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -5,7 +5,7 @@ version="1.0.0" bundleIdentifier="com.yourcompany.paulstretchplugin" includeBinaryInAppConfig="1" cppLanguageStandard="latest" companyCopyright="" buildVST="1" buildVST3="0" buildAU="0" buildAUv3="0" buildRTAS="0" - buildAAX="0" buildStandalone="0" enableIAA="0" pluginName="paulstretchplugin" + buildAAX="0" buildStandalone="1" enableIAA="0" pluginName="paulstretchplugin" pluginDesc="paulstretchplugin" pluginManufacturer="Xenakios" pluginManufacturerCode="XenS" pluginCode="Fn1r" pluginChannelConfigs="{2,2},{4,4}, {8,8}" pluginIsSynth="0" pluginWantsMidiIn="0" pluginProducesMidiOut="0"