Separate out transmogrifier settings
This commit is contained in:
parent
20dfc0c378
commit
7392fcfbdb
3 changed files with 53 additions and 15 deletions
34
dynamite.ttl
34
dynamite.ttl
|
@ -44,7 +44,7 @@
|
||||||
lv2:symbol "drive" ;
|
lv2:symbol "drive" ;
|
||||||
lv2:name "Drive" ;
|
lv2:name "Drive" ;
|
||||||
lv2:default 0.0 ;
|
lv2:default 0.0 ;
|
||||||
lv2:minimum -20.0 ;
|
lv2:minimum -60.0 ;
|
||||||
lv2:maximum 20.0 ;
|
lv2:maximum 20.0 ;
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
lv2:name "Threshold" ;
|
lv2:name "Threshold" ;
|
||||||
lv2:default 10.0 ;
|
lv2:default 10.0 ;
|
||||||
lv2:minimum -60.0 ;
|
lv2:minimum -60.0 ;
|
||||||
lv2:maximum 0.0 ;
|
lv2:maximum 20.0 ;
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort , lv2:ControlPort ;
|
a lv2:InputPort , lv2:ControlPort ;
|
||||||
|
@ -62,24 +62,42 @@
|
||||||
lv2:symbol "gain" ;
|
lv2:symbol "gain" ;
|
||||||
lv2:name "Level" ;
|
lv2:name "Level" ;
|
||||||
lv2:default 0.0 ;
|
lv2:default 0.0 ;
|
||||||
lv2:minimum -20.0 ;
|
lv2:minimum -60.0 ;
|
||||||
lv2:maximum 20.0 ;
|
lv2:maximum 20.0 ;
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort , lv2:ControlPort ;
|
a lv2:InputPort , lv2:ControlPort ;
|
||||||
lv2:index 5 ;
|
lv2:index 5 ;
|
||||||
lv2:symbol "mix" ;
|
lv2:symbol "transmogrify_gain" ;
|
||||||
lv2:name "Mix" ;
|
lv2:name "Transmogrifier: Gain" ;
|
||||||
lv2:default 0.5 ;
|
lv2:default -20.0 ;
|
||||||
lv2:minimum 0.0 ;
|
lv2:minimum -60.0 ;
|
||||||
lv2:maximum 1.0 ;
|
lv2:maximum 20.0 ;
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 6 ;
|
lv2:index 6 ;
|
||||||
|
lv2:symbol "transmogrify_threshold" ;
|
||||||
|
lv2:name "Transmogrifier: Noise Threshold" ;
|
||||||
|
lv2:default -40.0 ;
|
||||||
|
lv2:minimum -60.0 ;
|
||||||
|
lv2:maximum 20.0 ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort , lv2:ControlPort ;
|
||||||
|
lv2:index 7 ;
|
||||||
lv2:symbol "algorithm_mix" ;
|
lv2:symbol "algorithm_mix" ;
|
||||||
lv2:name "Transmogrify" ;
|
lv2:name "Transmogrify" ;
|
||||||
lv2:default 0.0 ;
|
lv2:default 0.0 ;
|
||||||
lv2:minimum 0.0 ;
|
lv2:minimum 0.0 ;
|
||||||
lv2:maximum 1.0 ;
|
lv2:maximum 1.0 ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort , lv2:ControlPort ;
|
||||||
|
lv2:index 8 ;
|
||||||
|
lv2:symbol "mix" ;
|
||||||
|
lv2:name "Mix" ;
|
||||||
|
lv2:default 0.5 ;
|
||||||
|
lv2:minimum 0.0 ;
|
||||||
|
lv2:maximum 1.0 ;
|
||||||
] .
|
] .
|
22
gui.cc
22
gui.cc
|
@ -24,6 +24,8 @@ namespace Dynamite {
|
||||||
Scale *threshold_scale;
|
Scale *threshold_scale;
|
||||||
Scale *gain_scale;
|
Scale *gain_scale;
|
||||||
Scale *mix_scale;
|
Scale *mix_scale;
|
||||||
|
Scale *t_gain_scale;
|
||||||
|
Scale *t_threshold_scale;
|
||||||
Scale *transmogrify_scale;
|
Scale *transmogrify_scale;
|
||||||
Scale *create_scale(p_port_enum nport, Orientation orient = ORIENTATION_VERTICAL) {
|
Scale *create_scale(p_port_enum nport, Orientation orient = ORIENTATION_VERTICAL) {
|
||||||
auto port = p_ports[nport];
|
auto port = p_ports[nport];
|
||||||
|
@ -35,18 +37,28 @@ namespace Dynamite {
|
||||||
public:
|
public:
|
||||||
DriveGUI(const std::string &url) {
|
DriveGUI(const std::string &url) {
|
||||||
auto vbox = manage(new VBox(false, 6));
|
auto vbox = manage(new VBox(false, 6));
|
||||||
auto hbox = manage(new HBox(false, 6));
|
auto notebook = manage(new Notebook);
|
||||||
|
|
||||||
vbox->add(*manage(new Label("Dynamite")));
|
vbox->add(*manage(new Label("Dynamite")));
|
||||||
|
|
||||||
|
auto clip_hbox = manage(new HBox(false, 6));
|
||||||
drive_scale = create_scale(p_drive);
|
drive_scale = create_scale(p_drive);
|
||||||
hbox->add(*manage(new LabeledWidget("Drive", *drive_scale)));
|
clip_hbox->add(*manage(new LabeledWidget("Drive", *drive_scale)));
|
||||||
threshold_scale = create_scale(p_threshold);
|
threshold_scale = create_scale(p_threshold);
|
||||||
hbox->add(*manage(new LabeledWidget("Threshold", *threshold_scale)));
|
clip_hbox->add(*manage(new LabeledWidget("Threshold", *threshold_scale)));
|
||||||
gain_scale = create_scale(p_gain);
|
gain_scale = create_scale(p_gain);
|
||||||
hbox->add(*manage(new LabeledWidget("Gain", *gain_scale)));
|
clip_hbox->add(*manage(new LabeledWidget("Gain", *gain_scale)));
|
||||||
|
notebook->append_page(*clip_hbox, "Clipping");
|
||||||
|
|
||||||
|
auto transmogrify_hbox = manage(new HBox(false, 6));
|
||||||
|
t_gain_scale = create_scale(p_transmogrify_gain);
|
||||||
|
transmogrify_hbox->add(*manage(new LabeledWidget("Gain", *t_gain_scale)));
|
||||||
|
t_threshold_scale = create_scale(p_transmogrify_threshold);
|
||||||
|
transmogrify_hbox->add(*manage(new LabeledWidget("Noise Threshold", *t_threshold_scale)));
|
||||||
|
notebook->append_page(*transmogrify_hbox, "Transmogrifier");
|
||||||
|
|
||||||
|
vbox->add(*notebook);
|
||||||
|
|
||||||
vbox->add(*hbox);
|
|
||||||
|
|
||||||
transmogrify_scale = create_scale(p_algorithm_mix, ORIENTATION_HORIZONTAL);
|
transmogrify_scale = create_scale(p_algorithm_mix, ORIENTATION_HORIZONTAL);
|
||||||
vbox->add(*manage(new LabeledWidget("Transmogrify", *transmogrify_scale)));
|
vbox->add(*manage(new LabeledWidget("Transmogrify", *transmogrify_scale)));
|
||||||
|
|
10
plugin.cc
10
plugin.cc
|
@ -1,6 +1,11 @@
|
||||||
#include "plugin.hh"
|
#include "plugin.hh"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace Dynamite {
|
namespace Dynamite {
|
||||||
void Drive::run(uint32_t n_samples) {
|
void Drive::run(uint32_t n_samples) {
|
||||||
const float coeff = dbCo(*p(p_drive));
|
const float coeff = dbCo(*p(p_drive));
|
||||||
|
@ -8,6 +13,8 @@ namespace Dynamite {
|
||||||
const float gainCoeff = dbCo(*p(p_gain));
|
const float gainCoeff = dbCo(*p(p_gain));
|
||||||
const float mix = *p(p_mix);
|
const float mix = *p(p_mix);
|
||||||
const float algoMix = *p(p_algorithm_mix);
|
const float algoMix = *p(p_algorithm_mix);
|
||||||
|
const float transmogrifier = dbCo(*p(p_transmogrify_gain));
|
||||||
|
const float transmogrifyThreshold = dbCo(*p(p_transmogrify_threshold));
|
||||||
|
|
||||||
const float *input = p(p_audio_in);
|
const float *input = p(p_audio_in);
|
||||||
float *output = p(p_audio_out);
|
float *output = p(p_audio_out);
|
||||||
|
@ -23,9 +30,10 @@ namespace Dynamite {
|
||||||
|
|
||||||
dist = dist * gainCoeff;
|
dist = dist * gainCoeff;
|
||||||
|
|
||||||
float transmogrifier = threshCoeff * gainCoeff;
|
|
||||||
float transmogrified = (input[pos] < 0 ? -transmogrifier : transmogrifier);
|
float transmogrified = (input[pos] < 0 ? -transmogrifier : transmogrifier);
|
||||||
|
|
||||||
|
if(abs(input[pos]) < transmogrifyThreshold) transmogrified = 0;
|
||||||
|
|
||||||
output[pos] = (mix * ((algoMix * transmogrified) + ((1.0 - algoMix) * dist))) + ((1.0 - mix) * input[pos] * gainCoeff);
|
output[pos] = (mix * ((algoMix * transmogrified) + ((1.0 - algoMix) * dist))) + ((1.0 - mix) * input[pos] * gainCoeff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue