Fix main module audio/cv usage
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
59006c3797
commit
b15e5ede6c
6 changed files with 30 additions and 39 deletions
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "plugincontext.hpp"
|
#include "plugincontext.hpp"
|
||||||
|
|
||||||
|
#define CARDINAL_AUDIO_IO_OFFSET 8
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
USE_NAMESPACE_DISTRHO;
|
USE_NAMESPACE_DISTRHO;
|
||||||
|
|
@ -84,8 +86,8 @@ struct HostCV : Module {
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
{
|
{
|
||||||
outputs[i].setVoltage(dataIns[i+2][dataFrame] - outputOffset);
|
outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] - outputOffset);
|
||||||
dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + inputOffset;
|
dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] = inputs[i].getVoltage() + inputOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f;
|
inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f;
|
||||||
|
|
@ -93,8 +95,8 @@ struct HostCV : Module {
|
||||||
|
|
||||||
for (int i=5; i<10; ++i)
|
for (int i=5; i<10; ++i)
|
||||||
{
|
{
|
||||||
outputs[i].setVoltage(dataIns[i+2][dataFrame] - outputOffset);
|
outputs[i].setVoltage(dataIns[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] - outputOffset);
|
||||||
dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + inputOffset;
|
dataOuts[i+CARDINAL_AUDIO_IO_OFFSET][dataFrame] = inputs[i].getVoltage() + inputOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,7 @@
|
||||||
// #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AnalyserPlugin"
|
// #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AnalyserPlugin"
|
||||||
// #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer"
|
// #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer"
|
||||||
|
|
||||||
|
#define CARDINAL_NUM_AUDIO_INPUTS 8
|
||||||
|
#define CARDINAL_NUM_AUDIO_OUTPUTS 8
|
||||||
|
|
||||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,7 @@
|
||||||
// #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AnalyserPlugin"
|
// #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AnalyserPlugin"
|
||||||
// #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer"
|
// #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer"
|
||||||
|
|
||||||
|
#define CARDINAL_NUM_AUDIO_INPUTS DISTRHO_PLUGIN_NUM_INPUTS
|
||||||
|
#define CARDINAL_NUM_AUDIO_OUTPUTS DISTRHO_PLUGIN_NUM_OUTPUTS
|
||||||
|
|
||||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -942,20 +942,18 @@ protected:
|
||||||
|
|
||||||
if (fCurrentAudioDevice != nullptr)
|
if (fCurrentAudioDevice != nullptr)
|
||||||
{
|
{
|
||||||
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
|
#if CARDINAL_NUM_AUDIO_INPUTS != 0
|
||||||
for (uint32_t i=0, j=0; i<frames; ++i)
|
for (uint32_t i=0, j=0; i<frames; ++i)
|
||||||
{
|
for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_INPUTS; ++k)
|
||||||
fAudioBufferIn[j++] = inputs[0][i];
|
fAudioBufferIn[j++] = inputs[k][i];
|
||||||
fAudioBufferIn[j++] = inputs[1][i];
|
fCurrentAudioDevice->processInput(fAudioBufferIn, CARDINAL_NUM_AUDIO_INPUTS, frames);
|
||||||
}
|
|
||||||
fCurrentAudioDevice->processInput(fAudioBufferIn, 2, frames);
|
|
||||||
#else
|
#else
|
||||||
std::memset(fAudioBufferIn, 0, sizeof(float)*frames);
|
std::memset(fAudioBufferIn, 0, sizeof(float)*frames);
|
||||||
fCurrentAudioDevice->processInput(fAudioBufferIn, 1, frames);
|
fCurrentAudioDevice->processInput(fAudioBufferIn, 1, frames);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 2
|
#if CARDINAL_NUM_AUDIO_OUTPUTS != 2
|
||||||
context->dataFrame = 0;
|
context->dataFrame = 0;
|
||||||
context->dataIns = inputs;
|
context->dataIns = inputs;
|
||||||
context->dataOuts = outputs;
|
context->dataOuts = outputs;
|
||||||
|
|
@ -965,19 +963,17 @@ protected:
|
||||||
|
|
||||||
if (fCurrentAudioDevice != nullptr)
|
if (fCurrentAudioDevice != nullptr)
|
||||||
{
|
{
|
||||||
std::memset(fAudioBufferOut, 0, sizeof(float)*frames*2);
|
std::memset(fAudioBufferOut, 0, sizeof(float)*frames*CARDINAL_NUM_AUDIO_OUTPUTS);
|
||||||
fCurrentAudioDevice->processOutput(fAudioBufferOut, 2, frames);
|
fCurrentAudioDevice->processOutput(fAudioBufferOut, CARDINAL_NUM_AUDIO_OUTPUTS, frames);
|
||||||
|
|
||||||
for (uint32_t i=0, j=0; i<frames; ++i)
|
for (uint32_t i=0, j=0; i<frames; ++i)
|
||||||
{
|
for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_OUTPUTS; ++k)
|
||||||
outputs[0][i] = fAudioBufferOut[j++];
|
outputs[k][i] = fAudioBufferOut[j++];
|
||||||
outputs[1][i] = fAudioBufferOut[j++];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::memset(outputs[0], 0, sizeof(float)*frames);
|
for (uint32_t k=0; k<CARDINAL_NUM_AUDIO_OUTPUTS; ++k)
|
||||||
std::memset(outputs[1], 0, sizeof(float)*frames);
|
std::memset(outputs[k], 0, sizeof(float)*frames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,7 @@
|
||||||
#define DISTRHO_PLUGIN_WANT_STATE 1
|
#define DISTRHO_PLUGIN_WANT_STATE 1
|
||||||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1
|
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1
|
||||||
|
|
||||||
|
#define CARDINAL_NUM_AUDIO_INPUTS DISTRHO_PLUGIN_NUM_INPUTS
|
||||||
|
#define CARDINAL_NUM_AUDIO_OUTPUTS DISTRHO_PLUGIN_NUM_OUTPUTS
|
||||||
|
|
||||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -37,20 +37,12 @@ struct CardinalAudioDevice : rack::audio::Device
|
||||||
|
|
||||||
int getNumInputs() override
|
int getNumInputs() override
|
||||||
{
|
{
|
||||||
#if DISTRHO_PLUGIN_NUM_INPUTS > 10
|
return CARDINAL_NUM_AUDIO_INPUTS;
|
||||||
return DISTRHO_PLUGIN_NUM_INPUTS - 10;
|
|
||||||
#else
|
|
||||||
return std::min(2, DISTRHO_PLUGIN_NUM_INPUTS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumOutputs() override
|
int getNumOutputs() override
|
||||||
{
|
{
|
||||||
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 10
|
return CARDINAL_NUM_AUDIO_OUTPUTS;
|
||||||
return DISTRHO_PLUGIN_NUM_OUTPUTS - 10;
|
|
||||||
#else
|
|
||||||
return std::min(2, DISTRHO_PLUGIN_NUM_OUTPUTS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getBlockSize() override
|
int getBlockSize() override
|
||||||
|
|
@ -117,20 +109,12 @@ struct CardinalAudioDriver : rack::audio::Driver
|
||||||
|
|
||||||
int getDeviceNumInputs(int) override
|
int getDeviceNumInputs(int) override
|
||||||
{
|
{
|
||||||
#if DISTRHO_PLUGIN_NUM_INPUTS > 10
|
return CARDINAL_NUM_AUDIO_INPUTS;
|
||||||
return DISTRHO_PLUGIN_NUM_INPUTS - 10;
|
|
||||||
#else
|
|
||||||
return std::min(2, DISTRHO_PLUGIN_NUM_INPUTS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDeviceNumOutputs(int) override
|
int getDeviceNumOutputs(int) override
|
||||||
{
|
{
|
||||||
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 10
|
return CARDINAL_NUM_AUDIO_OUTPUTS;
|
||||||
return DISTRHO_PLUGIN_NUM_OUTPUTS - 10;
|
|
||||||
#else
|
|
||||||
return std::min(2, DISTRHO_PLUGIN_NUM_OUTPUTS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rack::audio::Device* subscribe(int, rack::audio::Port* const port) override
|
rack::audio::Device* subscribe(int, rack::audio::Port* const port) override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue