Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update nekobi
  • Loading branch information
falkTX committed Aug 21, 2018
1 parent ad2d6be commit 5d5dc0b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions distrho-nekobi/DistrhoPluginNekobi.cpp
Expand Up @@ -135,6 +135,7 @@ DistrhoPluginNekobi::DistrhoPluginNekobi()
fParams.decay = 75.0f;
fParams.accent = 25.0f;
fParams.volume = 75.0f;
fParams.bypass = false;

// Internal stuff
fSynth.waveform = 0.0f;
Expand Down Expand Up @@ -169,6 +170,16 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
parameter.enumValues.count = 2;
parameter.enumValues.restrictedMode = true;
{
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
enumValues[0].value = 0.0f;
enumValues[0].label = "Square";
enumValues[1].value = 1.0f;
enumValues[1].label = "Triangle";
parameter.enumValues.values = enumValues;
}
break;
case paramTuning:
parameter.hints = kParameterIsAutomable; // was 0.5 <-> 2.0, log
Expand Down Expand Up @@ -232,6 +243,9 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramBypass:
parameter.initDesignation(kParameterDesignationBypass);
break;
}
}

Expand All @@ -258,6 +272,8 @@ float DistrhoPluginNekobi::getParameterValue(uint32_t index) const
return fParams.accent;
case paramVolume:
return fParams.volume;
case paramBypass:
return fParams.bypass ? 1.0f : 0.0f;
}

return 0.0f;
Expand Down Expand Up @@ -307,6 +323,14 @@ void DistrhoPluginNekobi::setParameterValue(uint32_t index, float value)
fSynth.volume = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.volume >= 0.0f && fSynth.volume <= 1.0f);
break;
case paramBypass: {
const bool bypass = (value > 0.5f);
if (fParams.bypass != bypass)
{
fParams.bypass = bypass;
nekobee_synth_all_voices_off(&fSynth);
}
} break;
}
}

Expand Down Expand Up @@ -342,6 +366,10 @@ void DistrhoPluginNekobi::run(const float**, float** outputs, uint32_t frames, c
return;
}

// ignore midi input if bypassed
if (fParams.bypass)
midiEventCount = 0;

while (framesDone < frames)
{
if (fSynth.nugget_remains == 0)
Expand Down
4 changes: 3 additions & 1 deletion distrho-nekobi/DistrhoPluginNekobi.hpp
Expand Up @@ -42,6 +42,7 @@ class DistrhoPluginNekobi : public Plugin
paramDecay,
paramAccent,
paramVolume,
paramBypass,
paramCount
};

Expand Down Expand Up @@ -79,7 +80,7 @@ class DistrhoPluginNekobi : public Plugin

uint32_t getVersion() const noexcept override
{
return d_version(1, 0, 0);
return d_version(1, 1, 0);
}

int64_t getUniqueId() const noexcept override
Expand Down Expand Up @@ -117,6 +118,7 @@ class DistrhoPluginNekobi : public Plugin
float decay;
float accent;
float volume;
bool bypass;
} fParams;

nekobee_synth_t fSynth;
Expand Down

0 comments on commit 5d5dc0b

Please sign in to comment.