kopia lustrzana https://github.com/jameshball/osci-render
Add dashed line effect
rodzic
ff1b62dfb3
commit
e132eb63bb
|
@ -121,6 +121,12 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
|||
new EffectParameter("Delay Length", "Controls the time in seconds between echos.", "delayLength", VERSION_HINT, 0.5, 0.0, 1.0)
|
||||
}
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
dashedLineEffect,
|
||||
std::vector<EffectParameter*>{
|
||||
new EffectParameter("Dash Length", "Controls the length of the dashed line.", "dashLength", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
}
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
customEffect,
|
||||
new EffectParameter("Lua Effect", "Controls the strength of the custom Lua effect applied. You can write your own custom effect using Lua by pressing the edit button on the right.", "customEffectStrength", VERSION_HINT, 1.0, 0.0, 1.0)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "UGen/Env.h"
|
||||
#include "UGen/ugen_JuceEnvelopeComponent.h"
|
||||
#include "audio/CustomEffect.h"
|
||||
#include "audio/DashedLineEffect.h"
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
@ -139,6 +140,8 @@ public:
|
|||
|
||||
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
|
||||
|
||||
std::shared_ptr<DashedLineEffect> dashedLineEffect = std::make_shared<DashedLineEffect>();
|
||||
|
||||
std::function<void(int, juce::String, juce::String)> errorCallback = [this](int lineNum, juce::String fileName, juce::String error) { notifyErrorListeners(lineNum, fileName, error); };
|
||||
std::shared_ptr<CustomEffect> customEffect = std::make_shared<CustomEffect>(errorCallback);
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include "DashedLineEffect.h"
|
||||
|
||||
DashedLineEffect::DashedLineEffect() {}
|
||||
|
||||
DashedLineEffect::~DashedLineEffect() {}
|
||||
|
||||
Point DashedLineEffect::apply(int index, Point vector, const std::vector<double>& values, double sampleRate) {
|
||||
// dash length in seconds
|
||||
double dashLength = values[0] / 400;
|
||||
int dashLengthSamples = (int)(dashLength * sampleRate);
|
||||
dashLengthSamples = juce::jmin(dashLengthSamples, MAX_BUFFER);
|
||||
|
||||
if (dashIndex >= dashLengthSamples) {
|
||||
dashIndex = 0;
|
||||
bufferIndex = 0;
|
||||
}
|
||||
|
||||
buffer[bufferIndex] = vector;
|
||||
bufferIndex++;
|
||||
|
||||
vector = buffer[dashIndex];
|
||||
|
||||
if (index % 2 == 0) {
|
||||
dashIndex++;
|
||||
}
|
||||
|
||||
return vector;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
#include "EffectApplication.h"
|
||||
#include "../shape/Point.h"
|
||||
|
||||
class DashedLineEffect : public EffectApplication {
|
||||
public:
|
||||
DashedLineEffect();
|
||||
~DashedLineEffect();
|
||||
|
||||
Point apply(int index, Point input, const std::vector<double>& values, double sampleRate) override;
|
||||
|
||||
private:
|
||||
const static int MAX_BUFFER = 192000;
|
||||
std::vector<Point> buffer = std::vector<Point>(MAX_BUFFER);
|
||||
int dashIndex = 0;
|
||||
int bufferIndex = 0;
|
||||
};
|
|
@ -5,7 +5,7 @@
|
|||
pluginCharacteristicsValue="pluginProducesMidiOut,pluginWantsMidiIn"
|
||||
pluginManufacturer="jameshball" aaxIdentifier="sh.ball.oscirender"
|
||||
cppLanguageStandard="20" projectLineFeed=" " headerPath="./include"
|
||||
version="2.0.8" companyName="James H Ball" companyWebsite="https://osci-render.com"
|
||||
version="2.1.0" companyName="James H Ball" companyWebsite="https://osci-render.com"
|
||||
companyEmail="james@ball.sh" defines="NOMINMAX=1">
|
||||
<MAINGROUP id="j5Ge2T" name="osci-render">
|
||||
<GROUP id="{5ABCED88-0059-A7AF-9596-DBF91DDB0292}" name="Resources">
|
||||
|
@ -141,6 +141,10 @@
|
|||
<FILE id="uvMCNC" name="CustomEffect.cpp" compile="1" resource="0"
|
||||
file="Source/audio/CustomEffect.cpp"/>
|
||||
<FILE id="qFZDUh" name="CustomEffect.h" compile="0" resource="0" file="Source/audio/CustomEffect.h"/>
|
||||
<FILE id="JtasnQ" name="DashedLineEffect.cpp" compile="1" resource="0"
|
||||
file="Source/audio/DashedLineEffect.cpp"/>
|
||||
<FILE id="I7B78q" name="DashedLineEffect.h" compile="0" resource="0"
|
||||
file="Source/audio/DashedLineEffect.h"/>
|
||||
<FILE id="e6SZox" name="DelayEffect.cpp" compile="1" resource="0" file="Source/audio/DelayEffect.cpp"/>
|
||||
<FILE id="kpI9pv" name="DelayEffect.h" compile="0" resource="0" file="Source/audio/DelayEffect.h"/>
|
||||
<FILE id="DiIoN4" name="DistortEffect.cpp" compile="1" resource="0"
|
||||
|
|
Ładowanie…
Reference in New Issue