mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
make ALSA MIDI I/O work with timestamps; more MTC debug tracing
git-svn-id: svn://localhost/ardour2/branches/3.0@6258 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
66ee16d7c8
commit
b6d418f3c2
5 changed files with 21 additions and 7 deletions
|
|
@ -1173,6 +1173,9 @@ Session::midi_thread_work ()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nframes64_t now = engine().frame_time();
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::MidiIO, "MIDI thread awake\n");
|
DEBUG_TRACE (DEBUG::MidiIO, "MIDI thread awake\n");
|
||||||
|
|
||||||
fds_ready = 0;
|
fds_ready = 0;
|
||||||
|
|
@ -1260,7 +1263,7 @@ Session::midi_thread_work ()
|
||||||
if (pfd[p].revents & POLLIN) {
|
if (pfd[p].revents & POLLIN) {
|
||||||
DEBUG_TRACE (DEBUG::MidiIO, string_compose ("MIDI fd # %1 has data ready\n", p));
|
DEBUG_TRACE (DEBUG::MidiIO, string_compose ("MIDI fd # %1 has data ready\n", p));
|
||||||
fds_ready++;
|
fds_ready++;
|
||||||
ports[p]->parse ();
|
ports[p]->parse (now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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));
|
DEBUG_TRACE (DEBUG::Slave, string_compose ("Slave @ %2 speed %1\n", slave_speed, slave_transport_frame));
|
||||||
|
|
||||||
if (!_slave->locked()) {
|
if (!_slave->locked()) {
|
||||||
|
DEBUG_TRACE (DEBUG::Slave, "slave not locked\n");
|
||||||
goto noroll;
|
goto noroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,6 +534,10 @@ Session::follow_slave (nframes_t nframes)
|
||||||
|
|
||||||
track_slave_state (slave_speed, slave_transport_frame, this_delta, starting);
|
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 (slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) {
|
||||||
|
|
||||||
if (_transport_speed != 0.0f) {
|
if (_transport_speed != 0.0f) {
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ JACK_MidiPort::cycle_start (nframes_t nframes)
|
||||||
const nframes_t event_count = jack_midi_get_event_count(jack_buffer);
|
const nframes_t event_count = jack_midi_get_event_count(jack_buffer);
|
||||||
|
|
||||||
jack_midi_event_t ev;
|
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) {
|
for (nframes_t i=0; i < event_count; ++i) {
|
||||||
|
|
||||||
|
|
@ -89,7 +90,7 @@ JACK_MidiPort::cycle_start (nframes_t nframes)
|
||||||
|
|
||||||
if (input_parser) {
|
if (input_parser) {
|
||||||
for (size_t i = 0; i < ev.size; i++) {
|
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]);
|
input_parser->scanner (ev.buffer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +102,7 @@ void
|
||||||
JACK_MidiPort::cycle_end ()
|
JACK_MidiPort::cycle_end ()
|
||||||
{
|
{
|
||||||
if (_jack_output_port != 0) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class Port : public sigc::trackable {
|
||||||
*/
|
*/
|
||||||
virtual int read (byte *buf, size_t bufsize) = 0;
|
virtual int read (byte *buf, size_t bufsize) = 0;
|
||||||
|
|
||||||
void parse ();
|
void parse (nframes_t timestamp);
|
||||||
|
|
||||||
/** Write a message to port.
|
/** Write a message to port.
|
||||||
* @return true on success.
|
* @return true on success.
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,19 @@ Port::~Port ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Port::parse ()
|
Port::parse (nframes_t timestamp)
|
||||||
{
|
{
|
||||||
byte buf[512];
|
byte buf[512];
|
||||||
|
|
||||||
/* parsing is done (if at all) by initiating a read from
|
/* NOTE: parsing is done (if at all) by initiating a read from
|
||||||
the port.
|
the port. Each port implementation calls on the parser
|
||||||
|
once it has data ready.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (input_parser) {
|
||||||
|
input_parser->set_timestamp (timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
// cerr << "+++ READ ON " << name() << endl;
|
// cerr << "+++ READ ON " << name() << endl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue