- void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
- const pframes_t event_count = jack_midi_get_event_count (jack_buffer);
-
- assert (event_count < _buffer->capacity());
-
- /* suck all relevant MIDI events from the JACK MIDI port buffer
- into our MidiBuffer
- */
-
- for (pframes_t i = 0; i < event_count; ++i) {
-
- jack_midi_event_t ev;
-
- jack_midi_event_get (&ev, jack_buffer, i);
-
- if (ev.buffer[0] == 0xfe) {
- /* throw away active sensing */
- continue;
- }
-
- /* check that the event is in the acceptable time range */
-
- if ((ev.time >= (_global_port_buffer_offset + _port_buffer_offset)) &&
- (ev.time < (_global_port_buffer_offset + _port_buffer_offset + nframes))) {
- _buffer->push_back (ev);
- } else {
- cerr << "Dropping incoming MIDI at time " << ev.time << "; offset="
- << _global_port_buffer_offset << " limit="
- << (_global_port_buffer_offset + _port_buffer_offset + nframes) << "\n";
- }
+ if (_input_active) {
+
+ void* buffer = port_engine.get_buffer (_port_handle, nframes);
+ const pframes_t event_count = port_engine.get_midi_event_count (buffer);
+
+ /* suck all relevant MIDI events from the MIDI port buffer
+ into our MidiBuffer
+ */
+
+ for (pframes_t i = 0; i < event_count; ++i) {
+
+ pframes_t timestamp;
+ size_t size;
+ uint8_t* buf;
+
+ port_engine.midi_event_get (timestamp, size, &buf, buffer, i);
+
+ if (buf[0] == 0xfe) {
+ /* throw away active sensing */
+ continue;
+ }
+
+ /* check that the event is in the acceptable time range */
+
+ if ((timestamp >= (_global_port_buffer_offset + _port_buffer_offset)) &&
+ (timestamp < (_global_port_buffer_offset + _port_buffer_offset + nframes))) {
+ _buffer->push_back (timestamp, size, buf);
+ } else {
+ cerr << "Dropping incoming MIDI at time " << timestamp << "; offset="
+ << _global_port_buffer_offset << " limit="
+ << (_global_port_buffer_offset + _port_buffer_offset + nframes) << "\n";
+ }
+ }
+
+ } else {
+ _buffer->silence (nframes);