<p>This should be called at the beginning of each process cycle before calling <aclass="el" href="group__MIDIAPI.html#ga150dcdc37583e1ecbe0a6f16b6ac48a9">jack_midi_event_reserve</a> or <aclass="el" href="group__MIDIAPI.html#gaa25503c07ac3c2ed62d79be9c25d42ed">jack_midi_event_write</a>. This function may not be called on an input port's buffer.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">port_buffer</td><td>Port buffer to clear (must be an output port buffer). </td></tr>
<p>Get a MIDI event from an event port buffer.</p>
<p>Jack MIDI is normalised, the MIDI event returned by this function is guaranteed to be a complete MIDI event (the status byte will always be present, and no realtime events will interspered with the event).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">event</td><td>Event structure to store retrieved event in. </td></tr>
<tr><tdclass="paramname">port_buffer</td><td>Port buffer from which to retrieve event. </td></tr>
<tr><tdclass="paramname">event_index</td><td>Index of event to retrieve. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>0 on success, ENODATA if buffer is empty. </dd></dl>
<p>Allocate space for an event to be written to an event port buffer.</p>
<p>Clients are to write the actual event data to be written starting at the pointer returned by this function. Clients must not write more than <em>data_size</em> bytes into this buffer. Clients must write normalised MIDI data to the port - no running status and no (1-byte) realtime messages interspersed with other messages (realtime messages are fine when they occur on their own, like other messages).</p>
<p>Events must be written in order, sorted by their sample offsets. JACK will not sort the events for you, and will refuse to store out-of-order events.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">port_buffer</td><td>Buffer to write event to. </td></tr>
<tr><tdclass="paramname">time</td><td>Sample offset of event. </td></tr>
<tr><tdclass="paramname">data_size</td><td>Length of event's raw data in bytes. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Pointer to the beginning of the reserved event's data buffer, or NULL on error (ie not enough space). </dd></dl>
<p>This function is simply a wrapper for <aclass="el" href="group__MIDIAPI.html#ga150dcdc37583e1ecbe0a6f16b6ac48a9">jack_midi_event_reserve</a> which writes the event data into the space reserved in the buffer.</p>
<p>Clients must not write more than <em>data_size</em> bytes into this buffer. Clients must write normalised MIDI data to the port - no running status and no (1-byte) realtime messages interspersed with other messages (realtime messages are fine when they occur on their own, like other messages).</p>
<p>Events must be written in order, sorted by their sample offsets. JACK will not sort the events for you, and will refuse to store out-of-order events.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">port_buffer</td><td>Buffer to write event to. </td></tr>
<tr><tdclass="paramname">time</td><td>Sample offset of event. </td></tr>
<tr><tdclass="paramname">data</td><td>Message data to be written. </td></tr>
<tr><tdclass="paramname">data_size</td><td>Length of <em>data</em> in bytes. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>0 on success, ENOBUFS if there's not enough space in buffer for event. </dd></dl>
<p>Get the number of events that could not be written to <em>port_buffer</em>.</p>
<p>This function returning a non-zero value implies <em>port_buffer</em> is full. Currently the only way this can happen is if events are lost on port mixdown.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">port_buffer</td><td>Port to receive count for. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Number of events that could not be written to <em>port_buffer</em>. </dd></dl>