summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-28 05:28:50 +0000
committerDavid Robillard <d@drobilla.net>2012-04-28 05:28:50 +0000
commitf5f4e7f081c9fbbe3b63ba72cdc12489653fb1bf (patch)
tree6a5f01f958fc003f488d9c307d402b575e1015ac
parent50f5747f3877d124014ce6eaba307a6bffddc1c2 (diff)
downloadingen-f5f4e7f081c9fbbe3b63ba72cdc12489653fb1bf.tar.gz
ingen-f5f4e7f081c9fbbe3b63ba72cdc12489653fb1bf.tar.bz2
ingen-f5f4e7f081c9fbbe3b63ba72cdc12489653fb1bf.zip
Use CV ports on internal modules.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4301 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/server/internals/Controller.cpp4
-rw-r--r--src/server/internals/Note.cpp16
-rw-r--r--src/server/internals/Note.hpp2
-rw-r--r--src/server/internals/Trigger.cpp6
4 files changed, 14 insertions, 14 deletions
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<Voice>* _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"));