mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-06 19:50:11 +02:00
input and output level control ports
This commit is contained in:
@@ -67,4 +67,25 @@
|
|||||||
lv2:index 3;
|
lv2:index 3;
|
||||||
lv2:symbol "output";
|
lv2:symbol "output";
|
||||||
lv2:name "Output";
|
lv2:name "Output";
|
||||||
|
];
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
lv2:port [
|
||||||
|
a lv2:ControlPort, lv2:InputPort;
|
||||||
|
lv2:index 4;
|
||||||
|
lv2:symbol "input_level";
|
||||||
|
lv2:name "Input Lvl";
|
||||||
|
lv2:default 0.0;
|
||||||
|
lv2:minimum -20.0;
|
||||||
|
lv2:maximum 20.0;
|
||||||
|
units:unit units:db;
|
||||||
|
], [
|
||||||
|
a lv2:ControlPort, lv2:InputPort;
|
||||||
|
lv2:index 5;
|
||||||
|
lv2:symbol "output_level";
|
||||||
|
lv2:name "Output Lvl";
|
||||||
|
lv2:default 0.0;
|
||||||
|
lv2:minimum -20.0;
|
||||||
|
lv2:maximum 20.0;
|
||||||
|
units:unit units:db;
|
||||||
].
|
].
|
||||||
|
|||||||
+14
-5
@@ -147,17 +147,26 @@ namespace NAM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float inputLevel = pow(10, *(ports.input_level) * 0.05);
|
||||||
|
float outputLevel = pow(10, *(ports.output_level) * 0.05);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < n_samples; i++)
|
||||||
|
{
|
||||||
|
ports.audio_out[i] = ports.audio_in[i] * inputLevel;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentModel == nullptr)
|
if (currentModel == nullptr)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < n_samples; i++)
|
|
||||||
{
|
|
||||||
ports.audio_out[i] = ports.audio_in[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentModel->process(ports.audio_in, ports.audio_out, n_samples, 1.0, 1.0, mNAMParams);
|
currentModel->process(ports.audio_out, ports.audio_out, n_samples, 1.0, 1.0, mNAMParams);
|
||||||
currentModel->finalize_(n_samples);
|
currentModel->finalize_(n_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < n_samples; i++)
|
||||||
|
{
|
||||||
|
ports.audio_out[i] *= outputLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -40,6 +40,8 @@ namespace NAM {
|
|||||||
LV2_Atom_Sequence* notify;
|
LV2_Atom_Sequence* notify;
|
||||||
const float* audio_in;
|
const float* audio_in;
|
||||||
float* audio_out;
|
float* audio_out;
|
||||||
|
float* input_level;
|
||||||
|
float* output_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
Ports ports = {};
|
Ports ports = {};
|
||||||
@@ -51,11 +53,7 @@ namespace NAM {
|
|||||||
std::unique_ptr<::DSP> currentModel;
|
std::unique_ptr<::DSP> currentModel;
|
||||||
std::unique_ptr<::DSP> stagedModel;
|
std::unique_ptr<::DSP> stagedModel;
|
||||||
|
|
||||||
std::unordered_map<std::string, double> mNAMParams =
|
std::unordered_map<std::string, double> mNAMParams = {};
|
||||||
{
|
|
||||||
{"Input", 0.0},
|
|
||||||
{"Output", 0.0}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Plugin(float rate);
|
Plugin(float rate);
|
||||||
|
|||||||
Reference in New Issue
Block a user