More mini details, fake audio runs, set host param values

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-12-29 23:58:16 +00:00
parent d0eba9e1ae
commit 5e73b8c227
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
14 changed files with 427 additions and 127 deletions

View file

@ -222,25 +222,51 @@ struct HostAudio2 : HostAudio<2> {
valueR = 0.0f;
}
const uint32_t j = internalDataFrame++;
internalDataBufferL[j] = valueL;
internalDataBufferR[j] = valueR;
if (internalDataFrame == 128)
if (pcontext->variant == kCardinalVariantMini)
{
internalDataFrame = 0;
const uint32_t j = internalDataFrame++;
internalDataBufferL[j] = valueL;
internalDataBufferR[j] = valueR;
if (resetMeters)
gainMeterL = gainMeterR = 0.0f;
if (internalDataFrame == 4)
{
internalDataFrame = 0;
gainMeterL = std::max(gainMeterL, d_findMaxNormalizedFloat128(internalDataBufferL));
if (resetMeters)
gainMeterL = gainMeterR = 0.0f;
if (in2connected)
gainMeterR = std::max(gainMeterR, d_findMaxNormalizedFloat128(internalDataBufferR));
else
gainMeterR = gainMeterL;
gainMeterL = std::max(gainMeterL, d_findMaxNormalizedFloat<4>(internalDataBufferL));
resetMeters = false;
if (in2connected)
gainMeterR = std::max(gainMeterR, d_findMaxNormalizedFloat<4>(internalDataBufferR));
else
gainMeterR = gainMeterL;
resetMeters = false;
}
}
else
{
const uint32_t j = internalDataFrame++;
internalDataBufferL[j] = valueL;
internalDataBufferR[j] = valueR;
if (internalDataFrame == 128)
{
internalDataFrame = 0;
if (resetMeters)
gainMeterL = gainMeterR = 0.0f;
gainMeterL = std::max(gainMeterL, d_findMaxNormalizedFloat128(internalDataBufferL));
if (in2connected)
gainMeterR = std::max(gainMeterR, d_findMaxNormalizedFloat128(internalDataBufferR));
else
gainMeterR = gainMeterL;
resetMeters = false;
}
}
#endif
}

View file

@ -52,6 +52,37 @@ extern Model* modelTextEditor;
extern std::vector<Model*> hostTerminalModels;
/*
* Find the highest absolute and normalized value within a float array.
*/
template<std::size_t size>
static inline
float d_findMaxNormalizedFloat(const float floats[size])
{
static constexpr const float kEmptyFloats[size] = {};
if (std::memcmp(floats, kEmptyFloats, sizeof(float)*size) == 0)
return 0.f;
float tmp, maxf2 = std::abs(floats[0]);
for (std::size_t i=1; i<size; ++i)
{
if (!std::isfinite(floats[i]))
__builtin_unreachable();
tmp = std::abs(floats[i]);
if (tmp > maxf2)
maxf2 = tmp;
}
if (maxf2 > 1.f)
maxf2 = 1.f;
return maxf2;
}
/*
* Find the highest absolute and normalized value within a float array.
*/
@ -61,7 +92,7 @@ float d_findMaxNormalizedFloat128(const float floats[128])
static constexpr const float kEmptyFloats[128] = {};
if (std::memcmp(floats, kEmptyFloats, sizeof(float)*128) == 0)
return 0.0f;
return 0.f;
float tmp, maxf2 = std::abs(floats[0]);
@ -76,8 +107,8 @@ float d_findMaxNormalizedFloat128(const float floats[128])
maxf2 = tmp;
}
if (maxf2 > 1.0f)
maxf2 = 1.0f;
if (maxf2 > 1.f)
maxf2 = 1.f;
return maxf2;
}

View file

@ -311,9 +311,12 @@ endif
PLUGIN_FILES += $(filter-out Fundamental/src/plugin.cpp,$(wildcard Fundamental/src/*.cpp))
PLUGIN_FILES += Fundamental/src/dr_wav.c
MINIPLUGIN_FILES += Fundamental/src/ADSR.cpp
MINIPLUGIN_FILES += Fundamental/src/LFO.cpp
MINIPLUGIN_FILES += Fundamental/src/Noise.cpp
MINIPLUGIN_FILES += Fundamental/src/Random.cpp
MINIPLUGIN_FILES += Fundamental/src/Scope.cpp
MINIPLUGIN_FILES += Fundamental/src/VCA-1.cpp
MINIPLUGIN_FILES += Fundamental/src/VCF.cpp
MINIPLUGIN_FILES += Fundamental/src/VCMixer.cpp
MINIPLUGIN_FILES += Fundamental/src/VCO.cpp

View file

@ -209,13 +209,16 @@ static void initStatic__Fundamental()
const StaticPluginLoader spl(p, "Fundamental");
if (spl.ok())
{
p->addModel(modelADSR);
p->addModel(modelLFO);
p->addModel(modelNoise);
p->addModel(modelRandom);
p->addModel(modelScope);
p->addModel(modelVCA_1);
p->addModel(modelVCF);
p->addModel(modelVCMixer);
p->addModel(modelVCO);
spl.removeModule("8vert");
spl.removeModule("ADSR");
spl.removeModule("Delay");
spl.removeModule("LFO2");
spl.removeModule("Merge");
@ -226,14 +229,11 @@ static void initStatic__Fundamental()
spl.removeModule("Pulses");
spl.removeModule("Quantizer");
spl.removeModule("SEQ3");
spl.removeModule("Scope");
spl.removeModule("SequentialSwitch1");
spl.removeModule("SequentialSwitch2");
spl.removeModule("Split");
spl.removeModule("Sum");
spl.removeModule("VCA");
spl.removeModule("VCA-1");
spl.removeModule("VCO");
spl.removeModule("VCO2");
}
}