Skip to content

Commit

Permalink
Quick update to latest DPF
Browse files Browse the repository at this point in the history
  • Loading branch information
falkTX committed Feb 11, 2018
1 parent be32048 commit 215c14f
Show file tree
Hide file tree
Showing 26 changed files with 394 additions and 479 deletions.
3 changes: 3 additions & 0 deletions Makefile.mk
Expand Up @@ -77,6 +77,9 @@ endif
# --------------------------------------------------------------
# Check for required libs

# FIXME
BASE_FLAGS += -DHAVE_JACK -DHAVE_LIBLO -DHAVE_DGL

ifeq ($(LINUX),true)
ifneq ($(shell pkg-config --exists jack && echo true),true)
$(error JACK missing, cannot continue)
Expand Down
2 changes: 1 addition & 1 deletion dpf
Submodule dpf updated 101 files
48 changes: 24 additions & 24 deletions plugins/PowerJuice/PowerJuicePlugin.cpp
Expand Up @@ -27,10 +27,10 @@ PowerJuicePlugin::PowerJuicePlugin()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
loadProgram(0);

// reset
d_deactivate();
deactivate();
}

PowerJuicePlugin::~PowerJuicePlugin()
Expand All @@ -42,12 +42,12 @@ PowerJuicePlugin::~PowerJuicePlugin()
// -----------------------------------------------------------------------
// Init

void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
void PowerJuicePlugin::initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramAttack:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Attack";
parameter.symbol = "att";
parameter.unit = "ms";
Expand All @@ -56,7 +56,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 1000.0f;
break;
case paramRelease:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Release";
parameter.symbol = "rel";
parameter.unit = "ms";
Expand All @@ -65,7 +65,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 1000.0f;
break;
case paramThreshold:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Threshold";
parameter.symbol = "thr";
parameter.unit = "dB";
Expand All @@ -74,7 +74,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 0.0f;
break;
case paramRatio:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Ratio";
parameter.symbol = "rat";
parameter.unit = "";
Expand All @@ -83,7 +83,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 10.0f;
break;
case paramMakeup:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Make-Up";
parameter.symbol = "mak";
parameter.unit = "";
Expand All @@ -92,7 +92,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 20.0f;
break;
case paramMix:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.hints = kParameterIsAutomable;
parameter.name = "Mix";
parameter.symbol = "Mix";
parameter.unit = "";
Expand All @@ -104,7 +104,7 @@ void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
}
}

void PowerJuicePlugin::d_initProgramName(uint32_t index, d_string& programName)
void PowerJuicePlugin::initProgramName(uint32_t index, String& programName)
{
if (index != 0)
return;
Expand All @@ -115,7 +115,7 @@ void PowerJuicePlugin::d_initProgramName(uint32_t index, d_string& programName)
// -----------------------------------------------------------------------
// Internal data

float PowerJuicePlugin::d_getParameterValue(uint32_t index) const
float PowerJuicePlugin::getParameterValue(uint32_t index) const
{
switch (index)
{
Expand All @@ -136,17 +136,17 @@ float PowerJuicePlugin::d_getParameterValue(uint32_t index) const
}
}

void PowerJuicePlugin::d_setParameterValue(uint32_t index, float value)
void PowerJuicePlugin::setParameterValue(uint32_t index, float value)
{
switch (index)
{
case paramAttack:
attack = value;
attackSamples = d_getSampleRate()*(attack/1000.0f);
attackSamples = getSampleRate()*(attack/1000.0f);
break;
case paramRelease:
release = value;
releaseSamples = d_getSampleRate()*(release/1000.0f);
releaseSamples = getSampleRate()*(release/1000.0f);
break;
case paramThreshold:
threshold = value;
Expand All @@ -164,7 +164,7 @@ void PowerJuicePlugin::d_setParameterValue(uint32_t index, float value)
}
}

void PowerJuicePlugin::d_setProgram(uint32_t index)
void PowerJuicePlugin::loadProgram(uint32_t index)
{
if (index != 0)
return;
Expand All @@ -178,8 +178,8 @@ void PowerJuicePlugin::d_setProgram(uint32_t index)
mix = 1.0f;

makeupFloat = fromDB(makeup);
attackSamples = d_getSampleRate()*(attack/1000.0f);
releaseSamples = d_getSampleRate()*(release/1000.0f);
attackSamples = getSampleRate()*(attack/1000.0f);
releaseSamples = getSampleRate()*(release/1000.0f);



Expand Down Expand Up @@ -207,13 +207,13 @@ void PowerJuicePlugin::d_setProgram(uint32_t index)
repaintSkip = 0;


kFloatRMSStackCount = 400.0f/44100.0f*d_getSampleRate();
kFloatRMSStackCount = 400.0f/44100.0f*getSampleRate();
RMSStack.data = (float*) calloc(kFloatRMSStackCount, sizeof(float));

kFloatLookaheadStackCount = 800.0f/44100.0f*d_getSampleRate();
kFloatLookaheadStackCount = 800.0f/44100.0f*getSampleRate();
lookaheadStack.data = (float*) calloc(kFloatLookaheadStackCount, sizeof(float));

refreshSkip= 300.0f/44100.0f*d_getSampleRate();
refreshSkip= 300.0f/44100.0f*getSampleRate();

std::memset(rms.data, 0, sizeof(float)*kFloatStackCount);
std::memset(gainReduction.data, 0, sizeof(float)*kFloatStackCount);
Expand All @@ -225,7 +225,7 @@ void PowerJuicePlugin::d_setProgram(uint32_t index)
for (int j=0; j < kFloatStackCount; ++j)
history.gainReduction[j] = h +y;

d_activate();
activate();

}

Expand All @@ -248,16 +248,16 @@ float PowerJuicePlugin::getGainReductionHistory(int n) {
// -----------------------------------------------------------------------
// Process

void PowerJuicePlugin::d_activate()
void PowerJuicePlugin::activate()
{
}

void PowerJuicePlugin::d_deactivate()
void PowerJuicePlugin::deactivate()
{
// all values to zero
}

void PowerJuicePlugin::d_run(const float** inputs, float** outputs, uint32_t frames)
void PowerJuicePlugin::run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in = inputs[0];
float* out = outputs[0];
Expand Down
26 changes: 13 additions & 13 deletions plugins/PowerJuice/PowerJuicePlugin.hpp
Expand Up @@ -70,50 +70,50 @@ class PowerJuicePlugin : public Plugin
// -------------------------------------------------------------------
// Information

const char* d_getLabel() const noexcept override
const char* getLabel() const noexcept override
{
return "PowerJuice";
}

const char* d_getMaker() const noexcept override
const char* getMaker() const noexcept override
{
return "Andre Sklenar";
}

const char* d_getLicense() const noexcept override
const char* getLicense() const noexcept override
{
return "GPL v2+";
}

uint32_t d_getVersion() const noexcept override
uint32_t getVersion() const noexcept override
{
return 0x1000;
}

long d_getUniqueId() const noexcept override
long getUniqueId() const noexcept override
{
return d_cconst('P', 'w', 'r', 'J');
}

// -------------------------------------------------------------------
// Init

void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
void initParameter(uint32_t index, Parameter& parameter) override;
void initProgramName(uint32_t index, String& programName) override;

// -------------------------------------------------------------------
// Internal data

float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
float getParameterValue(uint32_t index) const override;
void setParameterValue(uint32_t index, float value) override;
void loadProgram(uint32_t index) override;

// -------------------------------------------------------------------
// Process

void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
void activate() override;
void deactivate() override;
void run(const float** inputs, float** outputs, uint32_t frames) override;

// -------------------------------------------------------------------

Expand Down
48 changes: 24 additions & 24 deletions plugins/PowerJuice/PowerJuiceUI.cpp
Expand Up @@ -27,9 +27,9 @@ START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------

PowerJuiceUI::PowerJuiceUI()
: UI(),
: UI(PowerJuiceArtwork::backgroundWidth, PowerJuiceArtwork::backgroundHeight),
fAboutWindow(this),
dsp((PowerJuicePlugin*)d_getPluginInstancePointer())
dsp((PowerJuicePlugin*)getPluginInstancePointer())
{
DISTRHO_SAFE_ASSERT(dsp != nullptr);

Expand Down Expand Up @@ -100,13 +100,13 @@ PowerJuiceUI::PowerJuiceUI()
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
programLoaded(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void PowerJuiceUI::d_parameterChanged(uint32_t index, float value)
void PowerJuiceUI::parameterChanged(uint32_t index, float value)
{
switch (index)
{
Expand All @@ -131,7 +131,7 @@ void PowerJuiceUI::d_parameterChanged(uint32_t index, float value)
}
}

void PowerJuiceUI::d_programChanged(uint32_t index)
void PowerJuiceUI::programLoaded(uint32_t index)
{
if (index != 0)
return;
Expand Down Expand Up @@ -159,53 +159,53 @@ void PowerJuiceUI::imageButtonClicked(ImageButton* button, int)
void PowerJuiceUI::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == fKnobAttack)
d_editParameter(PowerJuicePlugin::paramAttack, true);
editParameter(PowerJuicePlugin::paramAttack, true);
else if (knob == fKnobRelease)
d_editParameter(PowerJuicePlugin::paramRelease, true);
editParameter(PowerJuicePlugin::paramRelease, true);
else if (knob == fKnobThreshold)
d_editParameter(PowerJuicePlugin::paramThreshold, true);
editParameter(PowerJuicePlugin::paramThreshold, true);
else if (knob == fKnobRatio)
d_editParameter(PowerJuicePlugin::paramRatio, true);
editParameter(PowerJuicePlugin::paramRatio, true);
else if (knob == fKnobMakeup)
d_editParameter(PowerJuicePlugin::paramMakeup, true);
editParameter(PowerJuicePlugin::paramMakeup, true);
else if (knob == fKnobMix)
d_editParameter(PowerJuicePlugin::paramMix, true);
editParameter(PowerJuicePlugin::paramMix, true);
}

void PowerJuiceUI::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == fKnobAttack)
d_editParameter(PowerJuicePlugin::paramAttack, false);
editParameter(PowerJuicePlugin::paramAttack, false);
else if (knob == fKnobRelease)
d_editParameter(PowerJuicePlugin::paramRelease, false);
editParameter(PowerJuicePlugin::paramRelease, false);
else if (knob == fKnobThreshold)
d_editParameter(PowerJuicePlugin::paramThreshold, false);
editParameter(PowerJuicePlugin::paramThreshold, false);
else if (knob == fKnobRatio)
d_editParameter(PowerJuicePlugin::paramRatio, false);
editParameter(PowerJuicePlugin::paramRatio, false);
else if (knob == fKnobMakeup)
d_editParameter(PowerJuicePlugin::paramMakeup, false);
editParameter(PowerJuicePlugin::paramMakeup, false);
else if (knob == fKnobMix)
d_editParameter(PowerJuicePlugin::paramMix, false);
editParameter(PowerJuicePlugin::paramMix, false);
}

void PowerJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == fKnobAttack)
d_setParameterValue(PowerJuicePlugin::paramAttack, value);
setParameterValue(PowerJuicePlugin::paramAttack, value);
else if (knob == fKnobRelease)
d_setParameterValue(PowerJuicePlugin::paramRelease, value);
setParameterValue(PowerJuicePlugin::paramRelease, value);
else if (knob == fKnobThreshold)
d_setParameterValue(PowerJuicePlugin::paramThreshold, value);
setParameterValue(PowerJuicePlugin::paramThreshold, value);
else if (knob == fKnobRatio)
d_setParameterValue(PowerJuicePlugin::paramRatio, value);
setParameterValue(PowerJuicePlugin::paramRatio, value);
else if (knob == fKnobMakeup)
d_setParameterValue(PowerJuicePlugin::paramMakeup, value);
setParameterValue(PowerJuicePlugin::paramMakeup, value);
else if (knob == fKnobMix)
d_setParameterValue(PowerJuicePlugin::paramMix, value);
setParameterValue(PowerJuicePlugin::paramMix, value);

}

void PowerJuiceUI::d_uiIdle()
void PowerJuiceUI::uiIdle()
{
if (dsp != nullptr && dsp->repaintNeeded())
repaint();
Expand Down

0 comments on commit 215c14f

Please sign in to comment.