diff --git a/Project.jucer b/Project.jucer index 8419ba0..f2e0bff 100644 --- a/Project.jucer +++ b/Project.jucer @@ -7,7 +7,7 @@ pluginDesc="Outputs a MIDI-triggered ADSR modulator as audio signal" pluginManufacturer="Mrugalla" pluginManufacturerCode="Mrug" pluginCode="ID12" pluginVSTNumMidiInputs="1" pluginVST3Category="Fx,Generator,Modulation,Tools" - cppLanguageStandard="20" pluginName="ADSR" defines="PPDEditorWidth=946 PPDEditorHeight=574 PPDHasEditor=true PPDHasPatchBrowser=true PPDHasSidechain=false PPDHasGainIn=false PPDHasUnityGain=false PPDHasGainOut=true PPDHasHQ=false PPDHasStereoConfig=false PPDHasPolarity=false PPDHasLookahead=true PPDHasDelta=false PPDHasClipper=false PPDFPSKnobs=40 PPDFPSMeters=40 PPDFPSTextEditor=3 PPDMetersUseRMS=true PPDGainInDecibels=true PPD_GainIn_Min=-12 PPD_GainIn_Max=12 PPD_GainOut_Min=-12 PPD_GainOut_Max=12 PPD_UnityGainDefault=true PPD_MixOrGainDry=0 PPD_MIDINumVoices=2 PPDHasTuningEditor=false PPD_MaxXen=128" + cppLanguageStandard="20" pluginName="ADSR" defines="PPDEditorWidth=946 PPDEditorHeight=574 PPDHasEditor=false PPDHasPatchBrowser=true PPDHasSidechain=false PPDHasGainIn=false PPDHasUnityGain=false PPDHasGainOut=true PPDHasHQ=false PPDHasStereoConfig=false PPDHasPolarity=false PPDHasLookahead=true PPDHasDelta=false PPDHasClipper=false PPDFPSKnobs=40 PPDFPSMeters=40 PPDFPSTextEditor=3 PPDMetersUseRMS=true PPDGainInDecibels=true PPD_GainIn_Min=-12 PPD_GainIn_Max=12 PPD_GainOut_Min=-12 PPD_GainOut_Max=12 PPD_UnityGainDefault=true PPD_MixOrGainDry=0 PPD_MIDINumVoices=2 PPDHasTuningEditor=false PPD_MaxXen=128" maxBinaryFileSize="20971520" pluginAAXCategory="2048,32" pluginVSTCategory="kPlugCategGenerator"> @@ -229,6 +229,8 @@ + diff --git a/Source/Processor.cpp b/Source/Processor.cpp index e3f9f7f..6de4677 100644 --- a/Source/Processor.cpp +++ b/Source/Processor.cpp @@ -197,8 +197,10 @@ namespace audio shallForcePrepare = true; #endif - if (shallForcePrepare) - forcePrepareToPlay(); + if (!shallForcePrepare) + return; + + forcePrepareToPlay(); } void ProcessorBackEnd::processBlockBypassed(AudioBuffer& buffer, juce::MidiBuffer&) @@ -279,6 +281,7 @@ namespace audio void Processor::processBlock(AudioBuffer& buffer, MIDIBuffer& midi) { + ///* const ScopedNoDenormals noDenormals; macroProcessor(); @@ -309,7 +312,8 @@ namespace audio const auto _playHead = getPlayHead(); const auto _playHeadPos = _playHead->getPosition(); const bool playHeadValid = _playHeadPos.hasValue(); - if (playHeadValid) + if (playHeadValid && _playHeadPos->getBpm() && _playHeadPos->getPpqPosition() + && _playHeadPos->getIsPlaying() && _playHeadPos->getTimeInSamples()) { playHeadPos.bpm = *_playHeadPos->getBpm(); playHeadPos.ppqPosition = *_playHeadPos->getPpqPosition(); @@ -376,7 +380,6 @@ namespace audio auto resampledBuf = &buffer; #endif auto resampledMainBuf = mainBus->getBusBuffer(*resampledBuf); - #if PPDHasSidechain if (wrapperType != wrapperType_Standalone) { @@ -469,6 +472,7 @@ namespace audio } } #endif + //*/ } void Processor::processBlockBypassed(AudioBuffer& buffer, juce::MidiBuffer& midi) @@ -489,7 +493,7 @@ namespace audio ProcessorBackEnd::processBlockBypassed(buffer, midi); } - void Processor::processBlockPreUpscaled(float** samples, int numChannels, int numSamples, + void Processor::processBlockPreUpscaled(float* const* samples, int numChannels, int numSamples, MIDIBuffer& midi) noexcept { if (params[PID::Lookahead]->getValMod() > .5f) @@ -534,8 +538,9 @@ namespace audio oscope(envGenMIDI.data(), numSamples, playHeadPos); - const auto mode = static_cast(std::round(params[PID::EnvGenMode]->getValModDenorm())); - enum { DirectOut, Gain, MIDICC, NumModes }; + //const auto mode = static_cast(std::round(params[PID::EnvGenMode]->getValModDenorm())); + const auto mode = static_cast(params[PID::EnvGenMode]->getValModDenorm() + .5f); + enum { DirectOut, Gain, MIDICC, NumModes }; int midiCh, midiCC; switch (mode) { @@ -561,7 +566,7 @@ namespace audio } } - void Processor::processBlockUpsampled(float**, int, int + void Processor::processBlockUpsampled(float* const*, int, int #if PPDHasSidechain , float**, int #endif diff --git a/Source/Processor.h b/Source/Processor.h index 1376ba0..172435c 100644 --- a/Source/Processor.h +++ b/Source/Processor.h @@ -105,10 +105,10 @@ namespace audio void processBlockBypassed(AudioBuffer&, juce::MidiBuffer&) override; /* samples, numChannels, numSamples, midi, samplesSC, numChannelsSC */ - void processBlockPreUpscaled(float**, int numChannels, int numSamples, juce::MidiBuffer& midi) noexcept; + void processBlockPreUpscaled(float* const*, int numChannels, int numSamples, juce::MidiBuffer& midi) noexcept; /* samples, numChannels, numSamples, samplesSC, numChannelsSC */ - void processBlockUpsampled(float**, int, int + void processBlockUpsampled(float* const*, int, int #if PPDHasSidechain , float**, int #endif diff --git a/Source/audio/AutoGain.h b/Source/audio/AutoGain.h index 21dfe7b..462a1fb 100644 --- a/Source/audio/AutoGain.h +++ b/Source/audio/AutoGain.h @@ -31,7 +31,7 @@ namespace audio /* sampleRate, blockSize */ using OnPrepare = std::function; /* samples, numChannels, numSamples, valP */ - using OnProcess = std::function; + using OnProcess = std::function; using OnClear = std::function; using Range = makeRange::Range; diff --git a/Source/audio/CombFilter.cpp b/Source/audio/CombFilter.cpp index 3138f13..245298b 100644 --- a/Source/audio/CombFilter.cpp +++ b/Source/audio/CombFilter.cpp @@ -21,9 +21,9 @@ namespace audio lp.makeFromDecayInHz(1000.f, Fs); } - void CombFilter::DelayFeedback::operator()(float** samples, int numChannels, int numSamples, + void CombFilter::DelayFeedback::operator()(float* const* samples, int numChannels, int numSamples, const int* wHead, const float* fbBuf, const float* dampBuf, - const float** readHead) noexcept + const float* const* readHead) noexcept { auto ringBuf = ringBuffer.getArrayOfWritePointers(); @@ -88,7 +88,7 @@ namespace audio retuneP.prepare(sampleRate, blockSize, 10.f); } - void CombFilter::operator()(float** samples, int numChannels, int numSamples, + void CombFilter::operator()(float* const* samples, int numChannels, int numSamples, float _feedback, float _damp, float _retune) noexcept { writeHead(numSamples); diff --git a/Source/audio/CombFilter.h b/Source/audio/CombFilter.h index 0deaf37..37265f7 100644 --- a/Source/audio/CombFilter.h +++ b/Source/audio/CombFilter.h @@ -20,7 +20,7 @@ namespace audio void prepare(float, int); //samples, numChannels, numSamples, wHead, feedbackBuffer[-1,1], dampBuf, readHead - void operator()(float**, int, int, const int*, const float*, const float*, const float**) noexcept; + void operator()(float* const*, int, int, const int*, const float*, const float*, const float* const*) noexcept; protected: AudioBuffer ringBuffer; @@ -37,7 +37,7 @@ namespace audio void prepare(float, int); /* samples, numChannels, numSamples, feedback ]-1,1[, damp ]0, 22050[hz, retune [-n,n]semi */ - void operator()(float**, int, int, float, float, float) noexcept; + void operator()(float* const*, int, int, float, float, float) noexcept; protected: MIDIVoices& midiVoices; diff --git a/Source/audio/DryWetMix.cpp b/Source/audio/DryWetMix.cpp index ae531d0..45fb252 100644 --- a/Source/audio/DryWetMix.cpp +++ b/Source/audio/DryWetMix.cpp @@ -36,7 +36,7 @@ namespace audio buffers.setSize(NumBufs, blockSize, false, true, false); } - void DryWetMix::saveDry(float** samples, int numChannels, int numSamples, + void DryWetMix::saveDry(float* const* samples, int numChannels, int numSamples, #if PPDHasGainIn float gainInP, #if PPDHasUnityGain @@ -89,7 +89,7 @@ namespace audio #endif } - void DryWetMix::processBypass(float** samples, int numChannels, int numSamples) noexcept + void DryWetMix::processBypass(float* const* samples, int numChannels, int numSamples) noexcept { latencyCompensation ( @@ -109,7 +109,7 @@ namespace audio } #if PPDHasGainOut - void DryWetMix::processOutGain(float** samples, int numChannels, int numSamples) const noexcept + void DryWetMix::processOutGain(float* const* samples, int numChannels, int numSamples) const noexcept { auto bufs = buffers.getArrayOfReadPointers(); const auto gainBuf = bufs[GainOut]; @@ -119,7 +119,7 @@ namespace audio } #endif - void DryWetMix::processMix(float** samples, int numChannels, int numSamples + void DryWetMix::processMix(float* const* samples, int numChannels, int numSamples #if PPDHasDelta , bool deltaP #endif diff --git a/Source/audio/DryWetMix.h b/Source/audio/DryWetMix.h index 4f20450..8db216a 100644 --- a/Source/audio/DryWetMix.h +++ b/Source/audio/DryWetMix.h @@ -27,7 +27,7 @@ namespace audio /* samples, numChannels, numSamples, gainInP, unityGainP, mixP, gainOutP, polarityP */ void saveDry ( - float**, int, int, + float* const*, int, int, #if PPDHasGainIn float, #if PPDHasUnityGain @@ -44,15 +44,15 @@ namespace audio ) noexcept; /* samples, numChannels, numSamples */ - void processBypass(float**, int, int) noexcept; + void processBypass(float* const*, int, int) noexcept; #if PPDHasGainOut /* samples, numChannels, numSamples */ - void processOutGain(float**, int, int) const noexcept; + void processOutGain(float* const*, int, int) const noexcept; #endif /* samples, numChannels, numSamples, delta */ - void processMix(float**, int, int + void processMix(float* const*, int, int #if PPDHasDelta , bool #endif diff --git a/Source/audio/EnvelopeGenerator.h b/Source/audio/EnvelopeGenerator.h index 53f127f..fa0d7aa 100644 --- a/Source/audio/EnvelopeGenerator.h +++ b/Source/audio/EnvelopeGenerator.h @@ -308,7 +308,7 @@ namespace audio public: static float getSkewed(float x, float bias) noexcept { - const auto b2 = 2.f * bias; + const auto b2 = bias + bias; const auto bM = 1.f - bias; const auto xy = bM - x + b2 * x; if (xy == 0.f) diff --git a/Source/audio/LatencyCompensation.cpp b/Source/audio/LatencyCompensation.cpp index 8abdf47..2441793 100644 --- a/Source/audio/LatencyCompensation.cpp +++ b/Source/audio/LatencyCompensation.cpp @@ -33,7 +33,7 @@ namespace audio } } - void LatencyCompensation::operator()(float** dry, float** inputSamples, int numChannels, int numSamples) noexcept + void LatencyCompensation::operator()(float* const* dry, float* const* inputSamples, int numChannels, int numSamples) noexcept { if (latency != 0) { @@ -61,7 +61,7 @@ namespace audio SIMD::copy(dry[ch], inputSamples[ch], numSamples); } - void LatencyCompensation::operator()(float** samples, int numChannels, int numSamples) noexcept + void LatencyCompensation::operator()(float* const* samples, int numChannels, int numSamples) noexcept { if (latency != 0) { diff --git a/Source/audio/LatencyCompensation.h b/Source/audio/LatencyCompensation.h index 735e7c4..bb4dd8d 100644 --- a/Source/audio/LatencyCompensation.h +++ b/Source/audio/LatencyCompensation.h @@ -12,10 +12,10 @@ namespace audio void prepare(int, int); /* dry, inputSamples, numChannels, numSamples */ - void operator()(float**, float**, int, int) noexcept; + void operator()(float* const*, float* const*, int, int) noexcept; /* samples, numChannels, numSamples */ - void operator()(float**, int, int) noexcept; + void operator()(float* const*, int, int) noexcept; protected: AudioBuffer ring; diff --git a/Source/audio/Manta.cpp b/Source/audio/Manta.cpp index 1a55d6c..3a46e19 100644 --- a/Source/audio/Manta.cpp +++ b/Source/audio/Manta.cpp @@ -9,7 +9,7 @@ namespace audio filta() {} - void Manta::Filter::operator()(float** laneBuf, float** samples, int numChannels, int numSamples, + void Manta::Filter::operator()(float* const* laneBuf, float* const* samples, int numChannels, int numSamples, float* fcBuf, float* resoBuf, int stage) noexcept { { @@ -55,7 +55,7 @@ namespace audio ringBuffer.setSize(2, size, false, true, false); } - void Manta::DelayFeedback::operator()(float** samples, int numChannels, int numSamples, const int* wHead, const float* rHead, + void Manta::DelayFeedback::operator()(float* const* samples, int numChannels, int numSamples, const int* wHead, const float* rHead, const float* feedback) noexcept { auto ringBuffr = ringBuffer.getArrayOfWritePointers(); @@ -101,7 +101,7 @@ namespace audio oscBuffer.resize(blockSize, 0.f); } - void Manta::RingMod::operator()(float** samples, int numChannels, int numSamples, + void Manta::RingMod::operator()(float* const* samples, int numChannels, int numSamples, float* _rmDepth, float* _freqHz) noexcept { for (auto s = 0; s < numSamples; ++s) @@ -173,7 +173,7 @@ namespace audio delaySizeF = static_cast(delaySize); } - void Manta::Lane::operator()(float** samples, int numChannels, int numSamples, + void Manta::Lane::operator()(float* const* samples, int numChannels, int numSamples, bool enabled, float _pitch, float _resonance, int _slope, float _drive, float _feedback, float _oct, float _semi, float _rmOct, float _rmSemi, float _rmDepth, float _gain, const int* wHead, const XenManager& xen) noexcept @@ -234,7 +234,7 @@ namespace audio ringMod.waveTable.loadPatch(state, "manta/lane" + String(i)); } - void Manta::Lane::addTo(float** samples, int numChannels, int numSamples) noexcept + void Manta::Lane::addTo(float* const* samples, int numChannels, int numSamples) noexcept { auto lane = laneBuffer.getArrayOfReadPointers(); @@ -264,7 +264,7 @@ namespace audio return x + d * (w - x); } - void Manta::Lane::distort(float** samples, int numChannels, int numSamples, const float* driveBuf) noexcept + void Manta::Lane::distort(float* const* samples, int numChannels, int numSamples, const float* driveBuf) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { @@ -275,7 +275,7 @@ namespace audio } } - void Manta::Lane::applyGain(float** samples, int numChannels, int numSamples, const float* gainBuf) noexcept + void Manta::Lane::applyGain(float* const* samples, int numChannels, int numSamples, const float* gainBuf) noexcept { for (auto ch = 0; ch < numChannels; ++ch) SIMD::multiply(samples[ch], gainBuf, numSamples); @@ -302,7 +302,7 @@ namespace audio writeHead.prepare(blockSize, delaySize); } - void Manta::operator()(float** samples, int numChannels, int numSamples, + void Manta::operator()(float* const* samples, int numChannels, int numSamples, bool l1Enabled, bool l1Snap, float l1Pitch, float l1Resonance, int l1Slope, float l1Drive, float l1Feedback, float l1Oct, float l1Semi, float l1RMOct, float l1RMSemi, float l1RMDepth, float l1Gain, bool l2Enabled, bool l2Snap, float l2Pitch, float l2Resonance, int l2Slope, float l2Drive, float l2Feedback, float l2Oct, float l2Semi, float l2RMOct, float l2RMSemi, float l2RMDepth, float l2Gain, bool l3Enabled, bool l3Snap, float l3Pitch, float l3Resonance, int l3Slope, float l3Drive, float l3Feedback, float l3Oct, float l3Semi, float l3RMOct, float l3RMSemi, float l3RMDepth, float l3Gain) noexcept diff --git a/Source/audio/Manta.h b/Source/audio/Manta.h index 8b0e3bd..fc1818a 100644 --- a/Source/audio/Manta.h +++ b/Source/audio/Manta.h @@ -25,7 +25,7 @@ namespace audio Filter(); /* laneBuf, samples, numChannels, numSamples, fcBuf, resoBuf, stage */ - void operator()(float**, float**, int, int, + void operator()(float* const*, float* const*, int, int, float*, float*, int) noexcept; protected: @@ -40,7 +40,7 @@ namespace audio void prepare(int); /* samples, numChannels, numSamples, wHead, rHead, feedback */ - void operator()(float**, int, int, const int*, const float*, const float*) noexcept; + void operator()(float* const*, int, int, const int*, const float*, const float*) noexcept; AudioBuffer ringBuffer; int size; @@ -58,7 +58,7 @@ namespace audio void prepare(float, int); /* samples, numChannels, numSamples, rmDepth, freqHz */ - void operator()(float**, int, int, float*, float*) noexcept; + void operator()(float* const*, int, int, float*, float*) noexcept; WT waveTable; protected: @@ -75,7 +75,7 @@ namespace audio /* samples, numChannels, numSamples, enabled, pitch, resonance, slope, drive, feedback, oct, semi, rmOct, rmSemi, rmDepth, gain, wHead, xen */ - void operator()(float**, int, int, bool, float, float, int, float, float, + void operator()(float* const*, int, int, bool, float, float, int, float, float, float, float, float, float, float, float, const int*, const XenManager&) noexcept; /* state, laneIndex */ @@ -85,7 +85,7 @@ namespace audio void loadPatch(sta::State&, int); /* samples, numChannels, numSamples */ - void addTo(float**, int, int) noexcept; + void addTo(float* const*, int, int) noexcept; RingMod ringMod; protected: @@ -103,10 +103,10 @@ namespace audio float distort(float, float) const noexcept; /* samples, numChannels, numSamples, driveBuf */ - void distort(float**, int, int, const float*) noexcept; + void distort(float* const*, int, int, const float*) noexcept; /* samples, numChannels, numSamples, gainBuf */ - void applyGain(float**, int, int, const float*) noexcept; + void applyGain(float* const*, int, int, const float*) noexcept; }; public: @@ -120,7 +120,7 @@ namespace audio * l2Enabled [0, 1], l2Snap, l2Pitch [12, N]note, l2Resonance [1, N]q, l2Slope [1, 4]db/oct, l2Drive [0, 1]%, l2Feedback [0, 1]%, l2Oct[-3,3], l2Semi[-12,12], l2RMOct[-3,3], l2RMSemi[-12,12], l2RMDepth[0,1], l2Gain [-60, 60]db * l3Enabled [0, 1], l3Snap, l3Pitch [12, N]note, l3Resonance [1, N]q, l3Slope [1, 4]db/oct, l3Drive [0, 1]%, l3Feedback [0, 1]%, l3Oct[-3,3], l3Semi[-12,12], l3RMOct[-3,3], l3RMSemi[-12,12], l3RMDepth[0,1], l3Gain [-60, 60]db */ - void operator()(float**, int, int, + void operator()(float* const*, int, int, bool, bool, float, float, int, float, float, float, float, float, float, float, float, bool, bool, float, float, int, float, float, float, float, float, float, float, float, bool, bool, float, float, int, float, float, float, float, float, float, float, float) noexcept; diff --git a/Source/audio/Meter.cpp b/Source/audio/Meter.cpp index 2aa0b52..09ccf61 100644 --- a/Source/audio/Meter.cpp +++ b/Source/audio/Meter.cpp @@ -32,7 +32,7 @@ namespace audio } #if PPDHasGainIn - void Meters::processIn(const float** samples, int numChannels, int numSamples) noexcept + void Meters::processIn(const float* const* samples, int numChannels, int numSamples) noexcept { wHead(numSamples); @@ -40,7 +40,7 @@ namespace audio } #endif - void Meters::processOut(const float** samples, int numChannels, int numSamples) noexcept + void Meters::processOut(const float* const* samples, int numChannels, int numSamples) noexcept { #if !PPDHasGainIn wHead(numSamples); @@ -53,7 +53,7 @@ namespace audio return vals[i].env; } - void Meters::process(Val& val, const float** samples, int numChannels, int numSamples) noexcept + void Meters::process(Val& val, const float* const* samples, int numChannels, int numSamples) noexcept { auto& rect = val.rect; auto& vVal = val.val; diff --git a/Source/audio/Meter.h b/Source/audio/Meter.h index 6a4e3c6..ad29fc6 100644 --- a/Source/audio/Meter.h +++ b/Source/audio/Meter.h @@ -31,15 +31,15 @@ namespace audio Meters(); - /*sampleRate, blockSize*/ + /* sampleRate, blockSize */ void prepare(float, int); #if PPDHasGainIn - /*samples,numChannels,numSamples*/ - void processIn(const float**, int, int) noexcept; + /* samples, numChannels, numSamples */ + void processIn(const float* const*, int, int) noexcept; #endif - /*samples,numChannels,numSamples*/ - void processOut(const float**, int, int) noexcept; + /* samples, numChannels, numSamples */ + void processOut(const float* const*, int, int) noexcept; const std::atomic& operator()(int i) const noexcept; @@ -50,7 +50,7 @@ namespace audio int length; private: - /*val,samples,numChannels,numSamples*/ - void process(Val&, const float**, int, int) noexcept; + /* val, samples, numChannels, numSamples */ + void process(Val&, const float* const*, int, int) noexcept; }; } \ No newline at end of file diff --git a/Source/audio/OverdriveReNEO.cpp b/Source/audio/OverdriveReNEO.cpp index fdece94..d8cd4f1 100644 --- a/Source/audio/OverdriveReNEO.cpp +++ b/Source/audio/OverdriveReNEO.cpp @@ -71,7 +71,7 @@ namespace audio Fs = sampleRate; } - void OverdriveReNeo::operator()(float** samples, int numChannels, int numSamples, + void OverdriveReNeo::operator()(float* const* samples, int numChannels, int numSamples, float driveP, float muffleP, float panP, float scrapP) noexcept { const auto muffleBuf = muffled(muffleP, numSamples); @@ -98,7 +98,7 @@ namespace audio { prepare(sampleRate, blockSize); }, - [&](float** samples, int numChannels, int numSamples, float valPDenorm) + [&](float* const* samples, int numChannels, int numSamples, float valPDenorm) { operator()(samples, numChannels, numSamples, 0.f, valPDenorm, 0.f, 0.f); }, @@ -114,7 +114,7 @@ namespace audio { prepare(sampleRate, blockSize); }, - [&](float** samples, int numChannels, int numSamples, float valPDenorm) + [&](float* const* samples, int numChannels, int numSamples, float valPDenorm) { operator()(samples, numChannels, numSamples, valPDenorm, 20000.f, 0.f, 0.f); }, @@ -130,7 +130,7 @@ namespace audio { prepare(sampleRate, blockSize); }, - [&](float** samples, int numChannels, int numSamples, float valPDenorm) + [&](float* const* samples, int numChannels, int numSamples, float valPDenorm) { operator()(samples, numChannels, numSamples, .5f, 20000.f, 0.f, valPDenorm); }, @@ -157,7 +157,7 @@ namespace audio } } - void OverdriveReNeo::processBlockStereo(float** samples, int numChannels, int numSamples, + void OverdriveReNeo::processBlockStereo(float* const* samples, int numChannels, int numSamples, const float* muffleBuf, const float* driveBuf, float panP, const float* scrapBuf) noexcept { updatePanVecs(panP, numSamples); diff --git a/Source/audio/OverdriveReNEO.h b/Source/audio/OverdriveReNEO.h index b883892..388ad91 100644 --- a/Source/audio/OverdriveReNEO.h +++ b/Source/audio/OverdriveReNEO.h @@ -45,7 +45,7 @@ namespace audio void prepare(float, int); /* samples, numChannels, numSamples, drive[0,1], muffle[20,20k], pan[-1,1], scrap[0,1] */ - void operator()(float**, int, int, float, float, float, float) noexcept; + void operator()(float* const*, int, int, float, float, float, float) noexcept; private: std::array filtr; @@ -64,7 +64,7 @@ namespace audio void processBlockMono(float*, int, const float*, const float*, Filter&, const float*) noexcept; /* samples, numChannels, numSamples, muffleBuf, driveBuf, pan, scrapBuf */ - void processBlockStereo(float**, int, int, const float*, const float*, float, const float*) noexcept; + void processBlockStereo(float* const*, int, int, const float*, const float*, float, const float*) noexcept; /* x, p, xy */ float waveshape(float, float, float) const noexcept; diff --git a/Source/audio/Oversampling.cpp b/Source/audio/Oversampling.cpp index b915d1e..25fe885 100644 --- a/Source/audio/Oversampling.cpp +++ b/Source/audio/Oversampling.cpp @@ -45,7 +45,14 @@ namespace audio ///////////////////////////////////////////////////// - std::vector makeWindowedSinc(float Fs, float fc, float bw, bool upsampling) + /* + * Fs,fc,bw,upsampling + Nyquist == Fs / 2 + fc < Nyquist + bw < Nyquist + fc + bw < Nyquist + */ + static std::vector makeWindowedSinc(float Fs, float fc, float bw, bool upsampling) { const auto nyquist = Fs * .5f; if (fc > nyquist || bw > nyquist || fc + bw > nyquist) @@ -97,7 +104,12 @@ namespace audio return ir; } - std::vector makeWindowedSinc(float Fs, float fc, bool upsampling) + /* + * Fs,fc,upsampling + Nyquist == Fs / 2 + fc < Nyquist + */ + static std::vector makeWindowedSinc(float Fs, float fc, bool upsampling) { return makeWindowedSinc(Fs, fc, Fs * .25f - fc - 1.f, upsampling); } @@ -118,7 +130,7 @@ namespace audio ring.setSize(2 + (PPDHasSidechain ? 2 : 0), irSize, false, true, false); } - void Convolver::processBlock(float** samples, int numChannels, int numSamples) noexcept + void Convolver::processBlock(float* const* samples, int numChannels, int numSamples) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { @@ -155,7 +167,8 @@ namespace audio ///////////////////////////////////////////////////// - void zeroStuff(float** samplesUp, const float** samplesIn, int numChannels, int numSamples1x) noexcept + /* samplesUp, samplesIn, numChannels, numSamples1x */ + static void zeroStuff(float* const* samplesUp, const float* const* samplesIn, int numChannels, int numSamples1x) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { @@ -171,7 +184,8 @@ namespace audio } } - void decimate(float** samplesOut, const float** samplesUp, int numChannels, int numSamples1x) noexcept + /* samplesOut, samplesUp, numChannels, numSamples1x */ + static void decimate(float* const* samplesOut, const float* const* samplesUp, int numChannels, int numSamples1x) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { diff --git a/Source/audio/Oversampling.h b/Source/audio/Oversampling.h index 45d0fad..d093d23 100644 --- a/Source/audio/Oversampling.h +++ b/Source/audio/Oversampling.h @@ -33,14 +33,14 @@ namespace audio bw < Nyquist fc + bw < Nyquist */ - std::vector makeWindowedSinc(float, float, float, bool); + //std::vector makeWindowedSinc(float, float, float, bool); /* * Fs,fc,upsampling Nyquist == Fs / 2 fc < Nyquist */ - std::vector makeWindowedSinc(float, float, bool); + //std::vector makeWindowedSinc(float, float, bool); struct Convolver { @@ -48,8 +48,8 @@ namespace audio void prepare(); - /*samples,numChannels,numSamples*/ - void processBlock(float**, int, int) noexcept; + /* samples, numChannels, numSamples */ + void processBlock(float* const*, int, int) noexcept; protected: AudioBuffer ring; @@ -64,11 +64,11 @@ namespace audio float processSample(float, float*, int) noexcept; }; - /*samplesUp,samplesIn,numChannels,numSamples1x*/ - void zeroStuff(float**, const float**, int, int) noexcept; + /* samplesUp, samplesIn, numChannels, numSamples1x */ + //void zeroStuff(float* const*, const float**, int, int) noexcept; - /*samplesOut,samplesUp,numChannels,numSamples1x*/ - void decimate(float**, const float**, int, int) noexcept; + /* samplesOut, samplesUp, numChannels, numSamples1x */ + //void decimate(float* const*, const float**, int, int) noexcept; class Oversampler { diff --git a/Source/audio/PitchGlitcher.cpp b/Source/audio/PitchGlitcher.cpp index fbf7163..b52d634 100644 --- a/Source/audio/PitchGlitcher.cpp +++ b/Source/audio/PitchGlitcher.cpp @@ -127,7 +127,7 @@ namespace audio ch.resize(size + 4, 0.f); } - void PitchGlitcher::Delay::operator()(float** samples, int numChannels, int numSamples, + void PitchGlitcher::Delay::operator()(float* const* samples, int numChannels, int numSamples, const int* wHead, const float* readHead/*[0, size[*/, const float* window, float feedback/*[-1,1]*/) noexcept { @@ -184,7 +184,7 @@ namespace audio tuneParam.prepare(Fs, blockSize, 70.f); } - void PitchGlitcher::Shifter::operator()(float** samples, int numChannels, int numSamples, + void PitchGlitcher::Shifter::operator()(float* const* samples, int numChannels, int numSamples, const int* wHead, const float* grainBuf, float tune, float feedback) noexcept { @@ -223,7 +223,7 @@ namespace audio ); } - void PitchGlitcher::Shifter::copyTo(float** samples, int numChannels, int numSamples) noexcept + void PitchGlitcher::Shifter::copyTo(float* const* samples, int numChannels, int numSamples) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { @@ -234,7 +234,7 @@ namespace audio } } - void PitchGlitcher::Shifter::addTo(float** samples, int numChannels, int numSamples) noexcept + void PitchGlitcher::Shifter::addTo(float* const* samples, int numChannels, int numSamples) noexcept { for (auto ch = 0; ch < numChannels; ++ch) { @@ -271,7 +271,7 @@ namespace audio grainParam.prepare(Fs, _blockSize, 140.f); } - void PitchGlitcher::operator()(float** samples, int numChannels, int numSamples, + void PitchGlitcher::operator()(float* const* samples, int numChannels, int numSamples, float tuneP/*[-24,24]*/, float grainSizeP/*[0, sizeF]*/, float feedbackP/*[0,1]*/, int numVoicesP/*[1,NumVoices]*/, float spreadTuneP/*[0,1]*/) noexcept { diff --git a/Source/audio/PitchGlitcher.h b/Source/audio/PitchGlitcher.h index 624103b..6e26e49 100644 --- a/Source/audio/PitchGlitcher.h +++ b/Source/audio/PitchGlitcher.h @@ -77,11 +77,11 @@ namespace audio { Delay(); - /*size*/ + /* size */ void prepare(int); - /*samples, numChannels, numSamples, wHead, readHead [0, size[, window, feedback[-1,1]*/ - void operator()(float**, int, int, const int*, const float*, const float*, float) noexcept; + /* samples, numChannels, numSamples, wHead, readHead [0, size[, window, feedback[-1,1] */ + void operator()(float* const*, int, int, const int*, const float*, const float*, float) noexcept; protected: std::array, 2> ringBuffer; @@ -94,17 +94,17 @@ namespace audio { Shifter(); - /*Fs, blockSize, size*/ + /* Fs, blockSize, size */ void prepare(float, int, int); - /*samples, numChannels, numSamples, wHead, grainBuf, tune, feedback*/ - void operator()(float**, int, int, const int*, const float*, float, float) noexcept; + /* samples, numChannels, numSamples, wHead, grainBuf, tune, feedback */ + void operator()(float* const*, int, int, const int*, const float*, float, float) noexcept; - /*samples, numChannels, numSamples*/ - void copyTo(float**, int, int) noexcept; + /* samples, numChannels, numSamples */ + void copyTo(float* const*, int, int) noexcept; - /*samples, numChannels, numSamples*/ - void addTo(float**, int, int) noexcept; + /* samples, numChannels, numSamples */ + void addTo(float* const*, int, int) noexcept; protected: AudioBuffer audioBuffer; @@ -125,8 +125,8 @@ namespace audio /*Fs, blockSize*/ void prepare(float, int); - /*samples, numChannels, numSamples, tuneP[-24,24], grainSizeP[0, sizeF], feedback[0,1], numVoicesP[1,NumVoices],spreadTuneP[0,1]*/ - void operator()(float**, int, int, float, float, float, int, float) noexcept; + /* samples, numChannels, numSamples, tuneP[-24,24], grainSizeP[0, sizeF], feedback[0,1], numVoicesP[1,NumVoices],spreadTuneP[0,1] */ + void operator()(float* const*, int, int, float, float, float, int, float) noexcept; protected: WHead wHead;