[LAD] Time & How to approach it

Olivier Guilyardi list at samalyse.com
Wed Jan 20 18:46:15 UTC 2010


Sorry I clicked this damn Send button before my example was finished
(only cosmetics changes though).

Below is the corrected (but still untested) example. nframes is the first
argument of the JACK process callback, which is the same as the buffer size.

double event_time             = 10; // seconds
jack_nframes_t event_framepos = event_time * jack_get_sample_rate(client);

void * port_buffer = jack_port_get_buffer(midi_output_port, nframes);
jack_midi_clear_buffer(port_buffer);

jack_position_t position;
jack_transport_query(client, &position);
jack_nframes_t event_offset = event_framepos - position.frame;

if (event_offset >= 0 && event_offset < nframes) {
    jack_midi_event_write(port_buffer, event_offset, ...);
}

--
  Olivier



More information about the Linux-audio-dev mailing list