diff options
Diffstat (limited to 'src/server/internals/Controller.cpp')
-rw-r--r-- | src/server/internals/Controller.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 1f4f75cc..5f084f6f 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -53,6 +53,10 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(6); + const Atom zero = bufs.forge().make(0.0f); + const Atom one = bufs.forge().make(1.0f); + const Atom atom_Float = bufs.forge().alloc_uri(LV2_ATOM__Float); + _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, PortType::ATOM, uris.atom_Sequence, Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); @@ -61,40 +65,43 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, _ports->at(0) = _midi_in_port; _param_port = new InputPort(bufs, this, Raul::Symbol("controller"), 1, 1, - PortType::CONTROL, 0, bufs.forge().make(0.0f)); - _param_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); + PortType::ATOM, uris.atom_Sequence, zero); + _param_port->set_property(uris.atom_supports, atom_Float); + _param_port->set_property(uris.lv2_minimum, zero); _param_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f)); _param_port->set_property(uris.lv2_portProperty, uris.lv2_integer); _param_port->set_property(uris.lv2_name, bufs.forge().alloc("Controller")); _ports->at(1) = _param_port; _log_port = new InputPort(bufs, this, Raul::Symbol("logarithmic"), 2, 1, - PortType::CONTROL, 0, bufs.forge().make(0.0f)); + PortType::ATOM, uris.atom_Sequence, zero); + _log_port->set_property(uris.atom_supports, atom_Float); _log_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _log_port->set_property(uris.lv2_name, bufs.forge().alloc("Logarithmic")); _ports->at(2) = _log_port; _min_port = new InputPort(bufs, this, Raul::Symbol("minimum"), 3, 1, - PortType::CONTROL, 0, bufs.forge().make(0.0f)); + PortType::ATOM, uris.atom_Sequence, zero); + _min_port->set_property(uris.atom_supports, atom_Float); _min_port->set_property(uris.lv2_name, bufs.forge().alloc("Minimum")); _ports->at(3) = _min_port; _max_port = new InputPort(bufs, this, Raul::Symbol("maximum"), 4, 1, - PortType::CONTROL, 0, bufs.forge().make(1.0f)); + PortType::ATOM, uris.atom_Sequence, one); + _max_port->set_property(uris.atom_supports, atom_Float); _max_port->set_property(uris.lv2_name, bufs.forge().alloc("Maximum")); _ports->at(4) = _max_port; _audio_port = new OutputPort(bufs, this, Raul::Symbol("output"), 5, 1, - PortType::CV, 0, bufs.forge().make(0.0f)); + PortType::ATOM, uris.atom_Sequence, zero); + _audio_port->set_property(uris.atom_supports, atom_Float); _audio_port->set_property(uris.lv2_name, bufs.forge().alloc("Output")); _ports->at(5) = _audio_port; } void -ControllerNode::process(ProcessContext& context) +ControllerNode::run(ProcessContext& context) { - BlockImpl::pre_process(context); - Buffer* const midi_in = _midi_in_port->buffer(0).get(); LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)midi_in->atom(); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { @@ -105,8 +112,6 @@ ControllerNode::process(ProcessContext& context) control(context, buf[1], buf[2], ev->time.frames + context.start()); } } - - BlockImpl::post_process(context); } void @@ -117,10 +122,8 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va const Sample nval = (val / 127.0f); // normalized [0, 1] if (_learning) { - // FIXME: not thread safe - _param_port->set_value(context.engine().world()->forge().make(control_num)); _param_port->set_control_value(context, time, control_num); - _param_port->monitor(context, true); + _param_port->force_monitor_update(); _learning = false; } |