diff options
Diffstat (limited to 'src/engine/InternalController.cpp')
-rw-r--r-- | src/engine/InternalController.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/engine/InternalController.cpp b/src/engine/InternalController.cpp index fad17225..d9c3b3b1 100644 --- a/src/engine/InternalController.cpp +++ b/src/engine/InternalController.cpp @@ -1,15 +1,15 @@ /* This file is part of Ingen. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * Ingen is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -36,7 +36,7 @@ namespace Ingen { using namespace Shared; static InternalPlugin controller_plugin(NS_INTERNALS "Controller", "controller"); - + ControllerNode::ControllerNode(const string& path, bool polyphonic, PatchImpl* parent, @@ -49,7 +49,7 @@ ControllerNode::ControllerNode(const string& path, _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Raul::Atom(), _buffer_size); _ports->at(0) = _midi_in_port; - + _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 0.0f, 1); _param_port->set_property("lv2:minimum", 0.0f); _param_port->set_property("lv2:maximum", 127.0f); @@ -59,13 +59,13 @@ ControllerNode::ControllerNode(const string& path, _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, 1); _log_port->set_property("lv2:toggled", true); _ports->at(2) = _log_port; - + _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 0.0f, 1); _ports->at(3) = _min_port; - + _max_port = new InputPort(this, "maximum", 4, 1, DataType::CONTROL, 1.0f, 1); _ports->at(4) = _max_port; - + _audio_port = new OutputPort(this, "ar_output", 5, 1, DataType::AUDIO, 0.0f, _buffer_size); _ports->at(5) = _audio_port; } @@ -75,7 +75,7 @@ void ControllerNode::process(ProcessContext& context) { NodeBase::pre_process(context); - + uint32_t frames = 0; uint32_t subframes = 0; uint16_t type = 0; @@ -84,17 +84,17 @@ ControllerNode::process(ProcessContext& context) EventBuffer* const midi_in = (EventBuffer*)_midi_in_port->buffer(0); //assert(midi_in->this_nframes() == context.nframes()); - + midi_in->rewind(); while (midi_in->get_event(&frames, &subframes, &type, &size, &buf)) { // FIXME: type if (size >= 3 && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) control(context, buf[1], buf[2], frames + context.start()); - + midi_in->increment(); } - + NodeBase::post_process(context); } @@ -105,9 +105,9 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va assert(time - context.start() < _buffer_size); Sample scaled_value; - + const Sample nval = (val / 127.0f); // normalized [0, 1] - + if (_learning) { _param_port->set_value(control_num); ((AudioBuffer*)_param_port->buffer(0))->set_value( |