diff options
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/MidiControlNode.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/MidiNoteNode.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/MidiTriggerNode.cpp | 13 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.cpp | 42 |
4 files changed, 46 insertions, 21 deletions
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index d9c426e3..afd588ea 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -48,11 +48,11 @@ MidiControlNode::MidiControlNode(const string& path, _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 0.0f, 1); _param_port->set_variable("ingen:minimum", 0.0f); _param_port->set_variable("ingen:maximum", 127.0f); - _param_port->set_variable("ingen:integer", 1); + _param_port->set_variable("ingen:integer", true); _ports->at(1) = _param_port; _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, 1); - _log_port->set_variable("ingen:toggled", 1); + _log_port->set_variable("ingen:toggled", true); _ports->at(2) = _log_port; _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 0.0f, 1); diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index 729cf2c3..3c4f0e56 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -57,11 +57,11 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, PatchImpl* paren _ports->at(2) = _vel_port; _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); - _gate_port->set_variable("ingen:toggled", 1); + _gate_port->set_variable("ingen:toggled", true); _ports->at(3) = _gate_port; _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); - _trig_port->set_variable("ingen:toggled", 1); + _trig_port->set_variable("ingen:toggled", true); _ports->at(4) = _trig_port; } @@ -225,8 +225,8 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, ProcessCon assert(voice != NULL); assert(voice == &(*_voices)[voice_num]); - //cerr << "[MidiNoteNode] Note " << (int)note_num << " on @ " << time - // << ". Voice " << voice_num << " / " << _polyphony << endl; + cerr << "[MidiNoteNode] Note " << (int)note_num << " on @ " << time + << ". Voice " << voice_num << " / " << _polyphony << endl; // Update stolen key, if applicable if (voice->state == Voice::Voice::ACTIVE) { diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index 0ae67c27..5fa1cd4b 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -26,6 +26,8 @@ #include "EventBuffer.hpp" #include "util.hpp" +using namespace std; + namespace Ingen { @@ -41,7 +43,7 @@ MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, PatchImpl* _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 60.0f, 1); _note_port->set_variable("ingen:minimum", 0.0f); _note_port->set_variable("ingen:maximum", 127.0f); - _note_port->set_variable("ingen:integer", 1); + _note_port->set_variable("ingen:integer", true); _ports->at(1) = _note_port; _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, 0.0f, _buffer_size); @@ -105,11 +107,14 @@ MidiTriggerNode::note_on(uchar note_num, uchar velocity, FrameTime time, Process assert(time >= context.start() && time <= context.end()); assert(time - context.start() < _buffer_size); - //std::cerr << "Note on starting at sample " << offset << std::endl; + cerr << "[MidiTriggerNode] " << path() << " Note " << (int)note_num << " on @ " << time << endl; - const Sample filter_note = ((AudioBuffer*)_note_port->buffer(0))->value_at(0); - if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uchar)filter_note)){ + Sample filter_note = ((AudioBuffer*)_note_port->buffer(0))->value_at(0); + cerr << "note: " << (int)note_num << ", filter: " << filter_note << endl; + if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uchar)filter_note)) { + cerr << "!\n"; + // FIXME FIXME FIXME SampleCount offset = time - context.start(); diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 4c8e7f72..893dc9cb 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -15,20 +15,22 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ConnectionEvent.hpp" + #include <string> +#include <boost/format.hpp> #include <raul/Maid.hpp> #include <raul/Path.hpp> -#include "Responder.hpp" -#include "types.hpp" -#include "Engine.hpp" +#include "ClientBroadcaster.hpp" +#include "ConnectionEvent.hpp" #include "ConnectionImpl.hpp" +#include "Engine.hpp" #include "InputPort.hpp" +#include "ObjectStore.hpp" #include "OutputPort.hpp" #include "PatchImpl.hpp" -#include "ClientBroadcaster.hpp" #include "PortImpl.hpp" -#include "ObjectStore.hpp" +#include "Responder.hpp" +#include "types.hpp" using std::string; namespace Ingen { @@ -164,15 +166,33 @@ ConnectionEvent::execute(ProcessContext& context) void ConnectionEvent::post_process() { + std::ostringstream ss; if (_error == NO_ERROR) { _responder->respond_ok(); _engine.broadcaster()->send_connection(_connection); - } else { - // FIXME: better error messages - string msg = "Unable to make connection "; - msg.append(_src_port_path + " -> " + _dst_port_path); - _responder->respond_error(msg); + return; + } + + ss << boost::format("Unable to make connection %1% -> %2% (") % _src_port_path % _dst_port_path; + + switch (_error) { + case PARENT_PATCH_DIFFERENT: + ss << "Ports have mismatched parents"; break; + case PORT_NOT_FOUND: + ss << "Port not found"; break; + case TYPE_MISMATCH: + ss << "Type mismatch"; break; + case DIRECTION_MISMATCH: + ss << "Direction mismatch"; break; + case ALREADY_CONNECTED: + ss << "Already connected"; break; + case PARENTS_NOT_FOUND: + ss << "Parents not found"; break; + default: + ss << "Unknown error"; } + ss << ")"; + _responder->respond_error(ss.str()); } |