From f5f4e7f081c9fbbe3b63ba72cdc12489653fb1bf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Apr 2012 05:28:50 +0000 Subject: Use CV ports on internal modules. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4301 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/internals/Controller.cpp | 4 ++-- src/server/internals/Note.cpp | 16 ++++++++-------- src/server/internals/Note.hpp | 2 +- src/server/internals/Trigger.cpp | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/server/internals') diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 6abdaf64..6a9139b5 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -82,8 +82,8 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, _max_port->set_property(uris.lv2_name, bufs.forge().alloc("Maximum")); _ports->at(4) = _max_port; - _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + _audio_port = new OutputPort(bufs, this, "output", 5, 1, + PortType::CV, 0, bufs.forge().make(0.0f)); _audio_port->set_property(uris.lv2_name, bufs.forge().alloc("Output")); _ports->at(5) = _audio_port; } diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index c770177f..1a21ed37 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -69,25 +69,27 @@ NoteNode::NoteNode( _ports->at(0) = _midi_in_port; _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, - PortType::AUDIO, 0, bufs.forge().make(440.0f)); + PortType::CV, 0, bufs.forge().make(440.0f)); _freq_port->set_property(uris.lv2_name, bufs.forge().alloc("Frequency")); + _freq_port->set_property(uris.lv2_minimum, bufs.forge().make(16.0f)); + _freq_port->set_property(uris.lv2_maximum, bufs.forge().make(25088.0f)); _ports->at(1) = _freq_port; _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f)); _vel_port->set_property(uris.lv2_name, bufs.forge().alloc("Velocity")); _ports->at(2) = _vel_port; _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _gate_port->set_property(uris.lv2_name, bufs.forge().alloc("Gate")); _ports->at(3) = _gate_port; _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _trig_port->set_property(uris.lv2_name, bufs.forge().alloc("Trigger")); _ports->at(4) = _trig_port; @@ -372,12 +374,10 @@ NoteNode::all_notes_off(ProcessContext& context, FrameTime time) } float -NoteNode::note_to_freq(int num) +NoteNode::note_to_freq(uint8_t num) { static const float A4 = 440.0f; - if (num >= 0 && num <= 119) - return A4 * powf(2.0f, (float)(num - 57.0f) / 12.0f); - return 1.0f; // Frequency of zero causes numerical problems... + return A4 * powf(2.0f, (float)(num - 57.0f) / 12.0f); } void diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 8e83a404..687a8871 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -82,7 +82,7 @@ private: SampleCount time; }; - float note_to_freq(int num); + float note_to_freq(uint8_t num); void free_voice(ProcessContext& context, uint32_t voice, FrameTime time); Raul::Array* _voices; diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 15921ae9..d6d13c58 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -71,19 +71,19 @@ TriggerNode::TriggerNode( _ports->at(1) = _note_port; _gate_port = new OutputPort(bufs, this, "gate", 2, 1, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _gate_port->set_property(uris.lv2_name, bufs.forge().alloc("Gate")); _ports->at(2) = _gate_port; _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _trig_port->set_property(uris.lv2_name, bufs.forge().alloc("Trigger")); _ports->at(3) = _trig_port; _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, - PortType::AUDIO, 0, bufs.forge().make(0.0f)); + PortType::CV, 0, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f)); _vel_port->set_property(uris.lv2_name, bufs.forge().alloc("Velocity")); -- cgit v1.2.1