• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  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 	ssize_t (*tread)(snd_rawmidi_t *rawmidi, struct timespec *tstamp, void *buffer, size_t size);
38 } snd_rawmidi_ops_t;
39 
40 struct _snd_rawmidi {
41 	void *open_func;
42 	char *name;
43 	snd_rawmidi_type_t type;
44 	snd_rawmidi_stream_t stream;
45 	int mode;
46 	int version;
47 	int poll_fd;
48 	const snd_rawmidi_ops_t *ops;
49 	void *private_data;
50 	size_t buffer_size;
51 	size_t avail_min;
52 	unsigned int no_active_sensing: 1;
53 	int params_mode;
54 };
55 
56 int snd_rawmidi_hw_open(snd_rawmidi_t **input, snd_rawmidi_t **output,
57 			const char *name, int card, int device, int subdevice,
58 			int mode);
59 
60 int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
61 			     const char *name, snd_seq_t *seq_handle, int port,
62 			     int merge, int mode);
63 
64 #define snd_rawmidi_conf_generic_id(id)	_snd_conf_generic_id(id)
65