diff options
-rw-r--r-- | libs/ardour/session_midi.cc | 5 | ||||
-rw-r--r-- | libs/ardour/session_process.cc | 5 | ||||
-rw-r--r-- | libs/midi++2/jack_midiport.cc | 5 | ||||
-rw-r--r-- | libs/midi++2/midi++/port.h | 2 | ||||
-rw-r--r-- | libs/midi++2/port.cc | 11 |
5 files changed, 21 insertions, 7 deletions
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 45642749e2..d205cc1ca8 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -1173,6 +1173,9 @@ Session::midi_thread_work () break; } + + nframes64_t now = engine().frame_time(); + DEBUG_TRACE (DEBUG::MidiIO, "MIDI thread awake\n"); fds_ready = 0; @@ -1260,7 +1263,7 @@ Session::midi_thread_work () if (pfd[p].revents & POLLIN) { DEBUG_TRACE (DEBUG::MidiIO, string_compose ("MIDI fd # %1 has data ready\n", p)); fds_ready++; - ports[p]->parse (); + ports[p]->parse (now); } } diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 33b24ca95f..0af2e37b57 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -496,6 +496,7 @@ Session::follow_slave (nframes_t nframes) DEBUG_TRACE (DEBUG::Slave, string_compose ("Slave @ %2 speed %1\n", slave_speed, slave_transport_frame)); if (!_slave->locked()) { + DEBUG_TRACE (DEBUG::Slave, "slave not locked\n"); goto noroll; } @@ -533,6 +534,10 @@ Session::follow_slave (nframes_t nframes) track_slave_state (slave_speed, slave_transport_frame, this_delta, starting); + DEBUG_TRACE (DEBUG::Slave, string_compose ("slave state %1 @ %2 speed %3 cur delta %4 starting %5\n", + slave_state, slave_transport_frame, slave_speed, this_delta, starting)); + + if (slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) { if (_transport_speed != 0.0f) { diff --git a/libs/midi++2/jack_midiport.cc b/libs/midi++2/jack_midiport.cc index ee9dcc73c8..ada72f1be6 100644 --- a/libs/midi++2/jack_midiport.cc +++ b/libs/midi++2/jack_midiport.cc @@ -82,6 +82,7 @@ JACK_MidiPort::cycle_start (nframes_t nframes) const nframes_t event_count = jack_midi_get_event_count(jack_buffer); jack_midi_event_t ev; + nframes_t cycle_start_frame = jack_last_frame_time (_jack_client); for (nframes_t i=0; i < event_count; ++i) { @@ -89,7 +90,7 @@ JACK_MidiPort::cycle_start (nframes_t nframes) if (input_parser) { for (size_t i = 0; i < ev.size; i++) { - input_parser->set_timestamp (ev.time + jack_last_frame_time(_jack_client)); + input_parser->set_timestamp (cycle_start_frame + ev.time); input_parser->scanner (ev.buffer[i]); } } @@ -101,7 +102,7 @@ void JACK_MidiPort::cycle_end () { if (_jack_output_port != 0) { - flush(jack_port_get_buffer(_jack_output_port, _nframes_this_cycle)); + flush (jack_port_get_buffer (_jack_output_port, _nframes_this_cycle)); } } diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index e7d5531bf9..1bab068f85 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -74,7 +74,7 @@ class Port : public sigc::trackable { */ virtual int read (byte *buf, size_t bufsize) = 0; - void parse (); + void parse (nframes_t timestamp); /** Write a message to port. * @return true on success. diff --git a/libs/midi++2/port.cc b/libs/midi++2/port.cc index b7ffcc7b48..5fe2016587 100644 --- a/libs/midi++2/port.cc +++ b/libs/midi++2/port.cc @@ -91,13 +91,18 @@ Port::~Port () } void -Port::parse () +Port::parse (nframes_t timestamp) { byte buf[512]; - /* parsing is done (if at all) by initiating a read from - the port. + /* NOTE: parsing is done (if at all) by initiating a read from + the port. Each port implementation calls on the parser + once it has data ready. */ + + if (input_parser) { + input_parser->set_timestamp (timestamp); + } while (1) { |