summaryrefslogtreecommitdiffstats
path: root/src/server/internals
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
committerDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
commit81e9fb3245bd461ebfee4cfa16d1792e48533f9e (patch)
treeeb1b30d79cba70dda9d832100dd7c14b08085b03 /src/server/internals
parente9d9569271ee962c09ab66c6babed1ca5655a6c6 (diff)
downloadingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.gz
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.bz2
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.zip
Centralise atom creation in forge object.
Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4054 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/internals')
-rw-r--r--src/server/internals/Controller.cpp36
-rw-r--r--src/server/internals/Delay.cpp22
-rw-r--r--src/server/internals/Note.cpp29
-rw-r--r--src/server/internals/Trigger.cpp35
4 files changed, 71 insertions, 51 deletions
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index df9c6bfb..f29951c8 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -53,31 +53,36 @@ ControllerNode::ControllerNode(InternalPlugin* plugin,
_ports = new Raul::Array<PortImpl*>(6);
_midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _param_port = new InputPort(bufs, this, "controller", 1, 1, PortType::CONTROL, 0.0f);
- _param_port->set_property(uris.lv2_minimum, 0.0f);
- _param_port->set_property(uris.lv2_maximum, 127.0f);
- _param_port->set_property(uris.lv2_integer, true);
- _param_port->set_property(uris.lv2_name, "Controller");
+ _param_port = new InputPort(bufs, this, "controller", 1, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
+ _param_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _param_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
+ _param_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _param_port->set_property(uris.lv2_name, bufs.forge().make("Controller"));
_ports->at(1) = _param_port;
- _log_port = new InputPort(bufs, this, "logarithmic", 2, 1, PortType::CONTROL, 0.0f);
+ _log_port = new InputPort(bufs, this, "logarithmic", 2, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
_log_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _log_port->set_property(uris.lv2_name, "Logarithmic");
+ _log_port->set_property(uris.lv2_name, bufs.forge().make("Logarithmic"));
_ports->at(2) = _log_port;
- _min_port = new InputPort(bufs, this, "minimum", 3, 1, PortType::CONTROL, 0.0f);
- _min_port->set_property(uris.lv2_name, "Minimum");
+ _min_port = new InputPort(bufs, this, "minimum", 3, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
+ _min_port->set_property(uris.lv2_name, bufs.forge().make("Minimum"));
_ports->at(3) = _min_port;
- _max_port = new InputPort(bufs, this, "maximum", 4, 1, PortType::CONTROL, 1.0f);
- _max_port->set_property(uris.lv2_name, "Maximum");
+ _max_port = new InputPort(bufs, this, "maximum", 4, 1,
+ PortType::CONTROL, bufs.forge().make(1.0f));
+ _max_port->set_property(uris.lv2_name, bufs.forge().make("Maximum"));
_ports->at(4) = _max_port;
- _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1, PortType::AUDIO, 0.0f);
- _audio_port->set_property(uris.lv2_name, "Output");
+ _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _audio_port->set_property(uris.lv2_name, bufs.forge().make("Output"));
_ports->at(5) = _audio_port;
}
@@ -115,7 +120,8 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va
const Sample nval = (val / 127.0f); // normalized [0, 1]
if (_learning) {
- _param_port->set_value(control_num);
+ // FIXME: not thread safe
+ _param_port->set_value(context.engine().world()->forge().make(control_num));
((AudioBuffer*)_param_port->buffer(0).get())->set_value(
(float)control_num, context.start(), context.end());
_param_port->broadcast_value(context, true);
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index a1b331ed..e3be103a 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -71,19 +71,23 @@ DelayNode::DelayNode(
_last_delay_time = default_delay;
_delay_samples = default_delay;
- _delay_port = new InputPort(bufs, this, "delay", 1, _polyphony, PortType::CONTROL, default_delay);
- _delay_port->set_property(uris.lv2_name, "Delay");
- _delay_port->set_property(uris.lv2_default, default_delay);
- _delay_port->set_property(uris.lv2_minimum, (float)(1.0/(double)srate));
- _delay_port->set_property(uris.lv2_maximum, MAX_DELAY_SECONDS);
+ _delay_port = new InputPort(bufs, this, "delay", 1, _polyphony,
+ PortType::CONTROL, bufs.forge().make(default_delay));
+ _delay_port->set_property(uris.lv2_name, bufs.forge().make("Delay"));
+ _delay_port->set_property(uris.lv2_default, bufs.forge().make(default_delay));
+ _delay_port->set_property(uris.lv2_minimum, bufs.forge().make((float)(1.0/(double)srate)));
+ _delay_port->set_property(uris.lv2_maximum, bufs.forge().make(MAX_DELAY_SECONDS));
_ports->at(0) = _delay_port;
- _in_port = new InputPort(bufs, this, "in", 0, 1, PortType::AUDIO, 0.0f);
- _in_port->set_property(uris.lv2_name, "Input");
+ _in_port = new InputPort(bufs, this, "in", 0, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(1) = _in_port;
- _out_port = new OutputPort(bufs, this, "out", 0, 1, PortType::AUDIO, 0.0f);
- _out_port->set_property(uris.lv2_name, "Output");
+ _out_port = new OutputPort(bufs, this, "out", 0, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _out_port->set_property(uris.lv2_name,
+ bufs.forge().make("Output"));
_ports->at(2) = _out_port;
//_buffer = bufs.get(PortType::AUDIO, bufs.audio_buffer_size(buffer_length_frames), true);
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index 6942cb02..fc88038b 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -61,28 +61,33 @@ NoteNode::NoteNode(
const Ingen::Shared::URIs& uris = bufs.uris();
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port = new InputPort(bufs, this, "input", 0, 1,
+ PortType::EVENTS, Raul::Atom());
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, PortType::AUDIO, 440.0f);
- _freq_port->set_property(uris.lv2_name, "Frequency");
+ _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony,
+ PortType::AUDIO, bufs.forge().make(440.0f));
+ _freq_port->set_property(uris.lv2_name, bufs.forge().make("Frequency"));
_ports->at(1) = _freq_port;
- _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, PortType::AUDIO, 0.0f);
- _vel_port->set_property(uris.lv2_minimum, 0.0f);
- _vel_port->set_property(uris.lv2_maximum, 1.0f);
- _vel_port->set_property(uris.lv2_name, "Velocity");
+ _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony,
+ PortType::AUDIO, 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().make("Velocity"));
_ports->at(2) = _vel_port;
- _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, PortType::AUDIO, 0.0f);
+ _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _gate_port->set_property(uris.lv2_name, "Gate");
+ _gate_port->set_property(uris.lv2_name, bufs.forge().make("Gate"));
_ports->at(3) = _gate_port;
- _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, PortType::AUDIO, 0.0f);
+ _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _trig_port->set_property(uris.lv2_name, "Trigger");
+ _trig_port->set_property(uris.lv2_name, bufs.forge().make("Trigger"));
_ports->at(4) = _trig_port;
}
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 0f2e03ab..ccab41f2 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -56,30 +56,34 @@ TriggerNode::TriggerNode(
_ports = new Raul::Array<PortImpl*>(5);
_midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _note_port = new InputPort(bufs, this, "note", 1, 1, PortType::CONTROL, 60.0f);
- _note_port->set_property(uris.lv2_minimum, 0.0f);
- _note_port->set_property(uris.lv2_maximum, 127.0f);
- _note_port->set_property(uris.lv2_integer, true);
- _note_port->set_property(uris.lv2_name, "Note");
+ _note_port = new InputPort(bufs, this, "note", 1, 1,
+ PortType::CONTROL, bufs.forge().make(60.0f));
+ _note_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _note_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
+ _note_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _note_port->set_property(uris.lv2_name, bufs.forge().make("Note"));
_ports->at(1) = _note_port;
- _gate_port = new OutputPort(bufs, this, "gate", 2, 1, PortType::AUDIO, 0.0f);
+ _gate_port = new OutputPort(bufs, this, "gate", 2, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _gate_port->set_property(uris.lv2_name, "Gate");
+ _gate_port->set_property(uris.lv2_name, bufs.forge().make("Gate"));
_ports->at(2) = _gate_port;
- _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, PortType::AUDIO, 0.0f);
+ _trig_port = new OutputPort(bufs, this, "trigger", 3, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _trig_port->set_property(uris.lv2_name, "Trigger");
+ _trig_port->set_property(uris.lv2_name, bufs.forge().make("Trigger"));
_ports->at(3) = _trig_port;
- _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, PortType::AUDIO, 0.0f);
- _vel_port->set_property(uris.lv2_minimum, 0.0f);
- _vel_port->set_property(uris.lv2_maximum, 1.0f);
- _vel_port->set_property(uris.lv2_name, "Velocity");
+ _vel_port = new OutputPort(bufs, this, "velocity", 4, 1,
+ PortType::AUDIO, 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().make("Velocity"));
_ports->at(4) = _vel_port;
}
@@ -133,7 +137,8 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity
assert(time >= context.start() && time <= context.end());
if (_learning) {
- _note_port->set_value(note_num);
+ // FIXME
+ //_note_port->set_value(note_num);
((AudioBuffer*)_note_port->buffer(0).get())->set_value(
(float)note_num, context.start(), context.end());
_note_port->broadcast_value(context, true);