diff --git a/resources/neural_amp_modeler.ttl.in b/resources/neural_amp_modeler.ttl.in index b56ec3e..700136b 100644 --- a/resources/neural_amp_modeler.ttl.in +++ b/resources/neural_amp_modeler.ttl.in @@ -10,22 +10,12 @@ @prefix units: . @prefix urid: . @prefix param: . -@prefix pg: . <@NAM_LV2_ID@> a doap:Project; doap:maintainer ; doap:name "Neural Amp Modeler". -<@NAM_LV2_ID@#input> - a pg:MonoGroup, pg:InputGroup; - lv2:symbol "input". - - - a pg:MonoGroup, pg:OutputGroup; - lv2:symbol "output"; - pg:source <@NAM_LV2_ID@#input>. - a lv2:Plugin, lv2:AmplifierPlugin; doap:name "Neural Amp Modeler"; @@ -39,49 +29,24 @@ rdfs:comment "An LV2 implementation of Neural Amp Modeler"; - pg:mainInput <@NAM_LV2_ID@#input>; - pg:mainOutput <@NAM_LV2_ID@#output>; - - # Control Ports + # Audio Ports lv2:port [ - a lv2:InputPort, atom:AtomPort; - atom:bufferType atom:Sequence; - lv2:designation lv2:control ; - lv2:index 0; - lv2:symbol "control"; - lv2:name "control"; - rdfs:comment "UI -> DSP communication" - ], [ - a lv2:OutputPort, atom:AtomPort; - atom:bufferType atom:Sequence; - lv2:designation lv2:control ; - lv2:index 1; - lv2:symbol "notify"; - lv2:name "Notify"; - # amount of data sent in a single 8192 sample process block - rsz:minimumSize 131428; - rdfs:comment "DSP -> UI communication" - ], [ a lv2:InputPort, lv2:AudioPort; - lv2:index 2; + lv2:index 0; lv2:symbol "input"; lv2:name "Input"; - pg:group ; - lv2:designation pg:left ], [ a lv2:OutputPort, lv2:AudioPort; - lv2:index 3; + lv2:index 1; lv2:symbol "output"; lv2:name "Output"; - pg:group ; - lv2:designation pg:left ]; # Mixer lv2:port [ a lv2:InputPort, lv2:ControlPort; lv2:designation param:wetDryRatio; - lv2:index 4; + lv2:index 2; lv2:symbol "mix"; lv2:name "Mix"; rdfs:comment "dry/wet ratio"; diff --git a/src/dsp.cpp b/src/dsp.cpp index 6259aa6..7f56735 100644 --- a/src/dsp.cpp +++ b/src/dsp.cpp @@ -20,14 +20,14 @@ constexpr auto _INPUT_BUFFER_SAFETY_FACTOR = 32; DSP::DSP() { this->_stale_params = true; } void DSP::process(const NAMSample *input, NAMSample *output, - const int num_channels, const int num_frames, + const int num_frames, const double input_gain, const double output_gain, const std::unordered_map ¶ms) { this->_get_params_(params); - this->_apply_input_level_(input, num_channels, num_frames, input_gain); + this->_apply_input_level_(input, num_frames, input_gain); this->_ensure_core_dsp_output_ready_(); this->_process_core_(); - this->_apply_output_level_(output, num_channels, num_frames, output_gain); + this->_apply_output_level_(output, num_frames, output_gain); } void DSP::finalize_(const int num_frames) {} @@ -46,14 +46,12 @@ void DSP::_get_params_( } } -void DSP::_apply_input_level_(const NAMSample *input, const int num_channels, - const int num_frames, const double gain) { +void DSP::_apply_input_level_(const NAMSample *input, const int num_frames, const double gain) { // Must match exactly; we're going to use the size of _input_post_gain later // for num_frames. if (this->_input_post_gain.size() != num_frames) this->_input_post_gain.resize(num_frames); - // MONO ONLY - const int channel = 0; + for (int i = 0; i < num_frames; i++) this->_input_post_gain[i] = float(gain * input[i]); } @@ -69,11 +67,9 @@ void DSP::_process_core_() { this->_core_dsp_output[i] = this->_input_post_gain[i]; } -void DSP::_apply_output_level_(NAMSample *output, const int num_channels, - const int num_frames, const double gain) { - for (int c = 0; c < num_channels; c++) - for (int s = 0; s < num_frames; s++) - output[s] = NAMSample(gain * this->_core_dsp_output[s]); +void DSP::_apply_output_level_(NAMSample *output, const int num_frames, const double gain) { + for (int s = 0; s < num_frames; s++) + output[s] = NAMSample(gain * this->_core_dsp_output[s]); } // Buffer ===================================================================== diff --git a/src/dsp.h b/src/dsp.h index 8566e31..53e7bd6 100644 --- a/src/dsp.h +++ b/src/dsp.h @@ -42,8 +42,7 @@ public: // 3. The core DSP algorithm is run (This is what should probably be // overridden in subclasses). // 4. The output level is applied and the result stored to `output`. - virtual void process(const NAMSample *input, NAMSample *output, - const int num_channels, const int num_frames, + virtual void process(const NAMSample *input, NAMSample *output, const int num_frames, const double input_gain, const double output_gain, const std::unordered_map ¶ms); // Anything to take care of before next buffer comes in. @@ -74,8 +73,7 @@ protected: // Apply the input gain // Result populates this->_input_post_gain - void _apply_input_level_(const NAMSample *input, const int num_channels, - const int num_frames, const double gain); + void _apply_input_level_(const NAMSample *input, const int num_frames, const double gain); // i.e. ensure the size is correct. void _ensure_core_dsp_output_ready_(); @@ -86,8 +84,7 @@ protected: virtual void _process_core_(); // Copy this->_core_dsp_output to output and apply the output volume - void _apply_output_level_(NAMSample *output, const int num_channels, - const int num_frames, const double gain); + void _apply_output_level_(NAMSample *output, const int num_frames, const double gain); }; // Class where an input buffer is kept so that long-time effects can be diff --git a/src/nam_plugin.cpp b/src/nam_plugin.cpp index bc10889..0c21b2d 100644 --- a/src/nam_plugin.cpp +++ b/src/nam_plugin.cpp @@ -20,15 +20,7 @@ namespace NAM { } void Plugin::process(uint32_t n_samples) noexcept { - if (ports.control) { - LV2_ATOM_SEQUENCE_FOREACH(ports.control, event) { - if (event->body.type == uris.atom_Object) { - const auto obj = reinterpret_cast(&event->body); - } - } - } - - namModel->process(ports.audio_in, ports.audio_out, 1, n_samples, 1.0, 1.0, mNAMParams); + namModel->process(ports.audio_in, ports.audio_out, n_samples, 1.0, 1.0, mNAMParams); namModel->finalize_(n_samples); } } diff --git a/src/nam_plugin.hpp b/src/nam_plugin.hpp index 9b57f6b..f9dc98e 100644 --- a/src/nam_plugin.hpp +++ b/src/nam_plugin.hpp @@ -20,8 +20,6 @@ namespace NAM { static constexpr std::string_view URI = "http://github.com/mikeoliphant/neural-amp-modeler-lv2"; struct Ports { - const LV2_Atom_Sequence* control; - LV2_Atom_Sequence* notify; const float* audio_in; float* audio_out; };