# midiport.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2004 Ian Esten
    00003
    00004     This program is free software; you can redistribute it and/or modify
    00005     it under the terms of the GNU Lesser General Public License as published by
    00006     the Free Software Foundation; either version 2.1 of the License, or
    00007     (at your option) any later version.
    00008
    00009     This program is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012     GNU Lesser General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Lesser General Public License
    00015     along with this program; if not, write to the Free Software
    00016     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017
    00018 */
    00019
    00020
    00021 #ifndef __JACK_MIDIPORT_H
    00022 #define __JACK_MIDIPORT_H
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00028 #include <jack/types.h>
    00029 #include <stdlib.h>
    00030
    00031
    00033 typedef unsigned char jack_midi_data_t;
    00034
    00035
    00037 typedef struct _jack_midi_event
    00038 {
    00039         jack_nframes_t    time;
    00040         size_t            size;
    00041         jack_midi_data_t *buffer;
    00042 } jack_midi_event_t;
    00043
    00044
    00045 /* Get number of events in a port buffer.
    00046  *
    00047  * @param port_buffer Port buffer from which to retrieve event.
    00048  * @param nframes Number of valid frames this cycle.
    00049  * @return number of events inside @a port_buffer
    00050  */
    00051 jack_nframes_t
    00052 jack_midi_get_event_count(void*          port_buffer,
    00053                         jack_nframes_t nframes);
    00054
    00055
    00068 int
    00069 jack_midi_event_get(jack_midi_event_t *event,
    00070                     void              *port_buffer,
    00071                     jack_nframes_t     event_index,
    00072                     jack_nframes_t     nframes);
    00073
    00074
    00084 void
    00085 jack_midi_clear_buffer(void           *port_buffer,
    00086                        jack_nframes_t  nframes);
    00087
    00088
    00097 size_t
    00098 jack_midi_max_event_size(void* port_buffer, jack_nframes_t nframes);
    00099
    00100
    00117 jack_midi_data_t*
    00118 jack_midi_event_reserve(void           *port_buffer,
    00119                         jack_nframes_t  time,
    00120                         size_t          data_size,
    00121                         jack_nframes_t  nframes);
    00122
    00123
    00137 int
    00138 jack_midi_event_write(void                   *port_buffer,
    00139                       jack_nframes_t          time,
    00140                       const jack_midi_data_t *data,
    00141                       size_t                  data_size,
    00142                       jack_nframes_t          nframes);
    00143
    00144
    00154 jack_nframes_t
    00155 jack_midi_get_lost_event_count(void           *port_buffer,
    00156                                jack_nframes_t  nframes);
    00157
    00158
    00159 #ifdef __cplusplus
    00160 }
    00161 #endif
    00162
    00163
    00164 #endif /* __JACK_MIDIPORT_H */
    00165
    00166