Re: [LAD] Time & How to approach it

From: Olivier Guilyardi <list@email-addr-hidden>
Date: Wed Jan 20 2010 - 20:46:15 EET

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
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Thu Jan 21 00:15:04 2010

This archive was generated by hypermail 2.1.8 : Thu Jan 21 2010 - 00:15:04 EET