Fix host audio left/mono mode
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
ac297f95f4
commit
9a9dd654af
1 changed files with 29 additions and 15 deletions
|
|
@ -111,16 +111,31 @@ struct HostAudio : TerminalModule {
|
||||||
const int k = dataFrame++;
|
const int k = dataFrame++;
|
||||||
DISTRHO_SAFE_ASSERT_INT2_RETURN(k < blockFrames, k, blockFrames,);
|
DISTRHO_SAFE_ASSERT_INT2_RETURN(k < blockFrames, k, blockFrames,);
|
||||||
|
|
||||||
|
if (isBypassed())
|
||||||
|
return;
|
||||||
|
|
||||||
float** const dataOuts = pcontext->dataOuts;
|
float** const dataOuts = pcontext->dataOuts;
|
||||||
|
|
||||||
// from cardinal into host, shows as input plug
|
// stereo version gain
|
||||||
if (! isBypassed())
|
|
||||||
{
|
|
||||||
const float gain = numParams != 0 ? std::pow(params[0].getValue(), 2.f) : 1.0f;
|
const float gain = numParams != 0 ? std::pow(params[0].getValue(), 2.f) : 1.0f;
|
||||||
|
|
||||||
for (int i=0; i<numInputs; ++i)
|
// read first value, special case for mono mode
|
||||||
|
float valueL = inputs[0].getVoltage() * 0.1f;
|
||||||
|
|
||||||
|
// Apply DC filter
|
||||||
|
if (dcFilterEnabled)
|
||||||
{
|
{
|
||||||
float v = inputs[i].getVoltageSum() * 0.1f;
|
dcFilters[0].process(valueL);
|
||||||
|
valueL = dcFilters[0].highpass();
|
||||||
|
}
|
||||||
|
|
||||||
|
valueL = clamp(valueL * gain, -1.0f, 1.0f);
|
||||||
|
dataOuts[0][k] += valueL;
|
||||||
|
|
||||||
|
// read everything else
|
||||||
|
for (int i=1; i<numInputs; ++i)
|
||||||
|
{
|
||||||
|
float v = inputs[i].getVoltage() * 0.1f;
|
||||||
|
|
||||||
// Apply DC filter
|
// Apply DC filter
|
||||||
if (dcFilterEnabled)
|
if (dcFilterEnabled)
|
||||||
|
|
@ -131,14 +146,13 @@ struct HostAudio : TerminalModule {
|
||||||
|
|
||||||
dataOuts[i][k] += clamp(v * gain, -1.0f, 1.0f);
|
dataOuts[i][k] += clamp(v * gain, -1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (numInputs == 2)
|
if (numInputs == 2)
|
||||||
{
|
{
|
||||||
const bool connected = inputs[1].isConnected();
|
const bool connected = inputs[1].isConnected();
|
||||||
|
|
||||||
if (! connected)
|
if (! connected)
|
||||||
dataOuts[1][k] += dataOuts[0][k];
|
dataOuts[1][k] += valueL;
|
||||||
|
|
||||||
if (dataFrame == blockFrames)
|
if (dataFrame == blockFrames)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue