From cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 13 Oct 2007 20:35:29 +0000 Subject: Fix sub-patch MIDI I/O. Make buffer 'joining' (zero-copy connections) significantly less retarded. git-svn-id: http://svn.drobilla.net/lad/ingen@882 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/MidiNoteNode.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/libs/engine/MidiNoteNode.cpp') diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index 7b3c1c9e..c90f44ae 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -130,6 +130,8 @@ MidiNoteNode::process(ProcessContext& context) MidiBuffer* const midi_in = (MidiBuffer*)_midi_in_port->buffer(0); assert(midi_in->this_nframes() == context.nframes()); + //cerr << path() << " # input events: " << midi_in->event_count() << endl; + if (midi_in->event_count() > 0) while (midi_in->get_event(×tamp, &size, &buffer) < context.nframes()) { @@ -167,11 +169,11 @@ MidiNoteNode::process(ProcessContext& context) } break; default: - //fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buffer[0]); + fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buffer[0]); break; } } else { - //fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buffer[0]); + fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buffer[0]); } if (midi_in->increment() == midi_in->this_nframes()) @@ -218,8 +220,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) { @@ -273,7 +275,7 @@ MidiNoteNode::note_off(uchar note_num, FrameTime time, ProcessContext& context) Key* key = &_keys[note_num]; - cerr << "[MidiNoteNode] Note off @ " << time << ". Key " << (int)note_num << endl; + //cerr << "[MidiNoteNode] Note " << (int)note_num << " off @ " << time << endl; if (key->state == Key::ON_ASSIGNED) { // Assigned key, turn off voice and key @@ -345,7 +347,7 @@ MidiNoteNode::all_notes_off(FrameTime time, ProcessContext& context) assert(time >= context.start() && time <= context.end()); assert(time - context.start() < _buffer_size); - //cerr << "Note off starting at sample " << offset << endl; + //cerr << "All notes off @ " << offset << endl; // FIXME: set all keys to Key::OFF? -- cgit v1.2.1