Initial Import
[profile/ivi/alsa-lib.git] / src / rawmidi / rawmidi_local.h
1 /*
2  *  Rawmidi interface - local header file
3  *  Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
4  *
5  *
6  *   This library is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU Lesser General Public License as
8  *   published by the Free Software Foundation; either version 2.1 of
9  *   the License, or (at your option) any later version.
10  *
11  *   This program is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU Lesser General Public License for more details.
15  *
16  *   You should have received a copy of the GNU Lesser General Public
17  *   License along with this library; if not, write to the Free Software
18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19  *
20  */
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <limits.h>
25 #include "local.h"
26
27 typedef struct {
28         int (*close)(snd_rawmidi_t *rawmidi);
29         int (*nonblock)(snd_rawmidi_t *rawmidi, int nonblock);
30         int (*info)(snd_rawmidi_t *rawmidi, snd_rawmidi_info_t *info);
31         int (*params)(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params);
32         int (*status)(snd_rawmidi_t *rawmidi, snd_rawmidi_status_t *status);
33         int (*drop)(snd_rawmidi_t *rawmidi);
34         int (*drain)(snd_rawmidi_t *rawmidi);
35         ssize_t (*write)(snd_rawmidi_t *rawmidi, const void *buffer, size_t size);
36         ssize_t (*read)(snd_rawmidi_t *rawmidi, void *buffer, size_t size);
37 } snd_rawmidi_ops_t;
38
39 struct _snd_rawmidi {
40         void *dl_handle;
41         char *name;
42         snd_rawmidi_type_t type;
43         snd_rawmidi_stream_t stream;
44         int mode;
45         int poll_fd;
46         const snd_rawmidi_ops_t *ops;
47         void *private_data;
48         size_t buffer_size;
49         size_t avail_min;
50         unsigned int no_active_sensing: 1;
51 };
52
53 int snd_rawmidi_hw_open(snd_rawmidi_t **input, snd_rawmidi_t **output,
54                         const char *name, int card, int device, int subdevice,
55                         int mode);
56
57 int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
58                              const char *name, snd_seq_t *seq_handle, int port,
59                              int merge, int mode);
60
61 int snd_rawmidi_conf_generic_id(const char *id);