summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-07-29 06:21:29 +0000
committerDavid Robillard <d@drobilla.net>2008-07-29 06:21:29 +0000
commit1bcac68c24eeca5fba730a9dc48ac09eee9ac76b (patch)
tree4db45b2f7ead16227906ec6fcb8999cefb87b32e /src/libs/engine
parentf0e920ab170569fc9eaf5858af2e9ae3e8d44993 (diff)
downloadingen-1bcac68c24eeca5fba730a9dc48ac09eee9ac76b.tar.gz
ingen-1bcac68c24eeca5fba730a9dc48ac09eee9ac76b.tar.bz2
ingen-1bcac68c24eeca5fba730a9dc48ac09eee9ac76b.zip
Add converted Smack 909 patches.
Fix MIDI/Event ports loaded from patches. git-svn-id: http://svn.drobilla.net/lad/ingen@1303 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/AudioBuffer.cpp5
-rw-r--r--src/libs/engine/MidiNoteNode.cpp4
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp7
-rw-r--r--src/libs/engine/events/CreatePortEvent.cpp4
4 files changed, 9 insertions, 11 deletions
diff --git a/src/libs/engine/AudioBuffer.cpp b/src/libs/engine/AudioBuffer.cpp
index b874d527..5eea7103 100644
--- a/src/libs/engine/AudioBuffer.cpp
+++ b/src/libs/engine/AudioBuffer.cpp
@@ -129,8 +129,11 @@ AudioBuffer::clear()
void
AudioBuffer::set_value(Sample val, FrameTime cycle_start, FrameTime time)
{
+ if (_size == 1)
+ time = cycle_start;
+
FrameTime offset = time - cycle_start;
- assert(offset < _size);
+ assert(offset <= _size);
set_block(val, offset, _size - 1);
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 53778f17..e9b36fbf 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -225,8 +225,8 @@ MidiNoteNode::note_on(ProcessContext& context, uchar note_num, uchar velocity, F
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 7b210201..65f9833e 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -107,19 +107,14 @@ MidiTriggerNode::note_on(ProcessContext& context, uchar note_num, uchar velocity
assert(time >= context.start() && time <= context.end());
assert(time - context.start() < _buffer_size);
- cerr << "[MidiTriggerNode] " << path() << " Note " << (int)note_num << " on @ " << time << endl;
+ /*cerr << "[MidiTriggerNode] " << path() << " Note " << (int)note_num << " on @ " << time << endl;*/
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";
-
((AudioBuffer*)_gate_port->buffer(0))->set_value(1.0f, context.start(), time);
((AudioBuffer*)_trig_port->buffer(0))->set_value(1.0f, context.start(), time);
((AudioBuffer*)_trig_port->buffer(0))->set_value(0.0f, context.start(), time + 1);
((AudioBuffer*)_vel_port->buffer(0))->set_value(velocity / 127.0f, context.start(), time);
-
assert(((AudioBuffer*)_trig_port->buffer(0))->data()[time - context.start()] == 1.0f);
}
}
diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp
index 272ef561..aca33c67 100644
--- a/src/libs/engine/events/CreatePortEvent.cpp
+++ b/src/libs/engine/events/CreatePortEvent.cpp
@@ -113,7 +113,7 @@ CreatePortEvent::pre_process()
if (_type == "ingen:AudioPort")
_driver_port = _engine.audio_driver()->create_port(
dynamic_cast<DuplexPort*>(_patch_port));
- else if (_type == "ingen:MIDIPort")
+ else if (_type == "ingen:MIDIPort" || _type == "ingen:EventPort")
_driver_port = _engine.midi_driver()->create_port(
dynamic_cast<DuplexPort*>(_patch_port));
else if (_type == "ingen:OSCPort" && _engine.osc_driver())
@@ -145,7 +145,7 @@ CreatePortEvent::execute(ProcessContext& context)
if (_driver_port) {
if (_type == "ingen:AudioPort")
_engine.audio_driver()->add_port(_driver_port);
- else if (_type == "ingen:MIDIPort")
+ else if (_type == "ingen:MIDIPort" || _type == "ingen:EventPort")
_engine.midi_driver()->add_port(_driver_port);
else if (_type == "ingen:OSCPort")
cerr << "OSC DRIVER PORT" << endl;