1/*
2 *  Sequencer Interface - definition of sequencer event handler
3 *  Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
4 *                        Abramo Bagnara <abramo@alsa-project.org>
5 *
6 *
7 *   This library is free software; you can redistribute it and/or modify
8 *   it under the terms of the GNU Lesser General Public License as
9 *   published by the Free Software Foundation; either version 2.1 of
10 *   the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU Lesser General Public License for more details.
16 *
17 *   You should have received a copy of the GNU Lesser General Public
18 *   License along with this library; if not, write to the Free Software
19 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 *
21 */
22
23#ifndef __SEQ_LOCAL_H
24#define __SEQ_LOCAL_H
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <limits.h>
29#include "local.h"
30
31#define SND_SEQ_OBUF_SIZE	(16*1024)	/* default size */
32#define SND_SEQ_IBUF_SIZE	500		/* in event_size aligned */
33#define DEFAULT_TMPBUF_SIZE	20
34
35typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
36
37
38typedef struct {
39	int (*close)(snd_seq_t *seq);
40	int (*nonblock)(snd_seq_t *seq, int nonblock);
41	int (*system_info)(snd_seq_t *seq, snd_seq_system_info_t * info);
42	int (*get_client_info)(snd_seq_t *seq, snd_seq_client_info_t * info);
43	int (*set_client_info)(snd_seq_t *seq, snd_seq_client_info_t * info);
44	int (*create_port)(snd_seq_t *seq, snd_seq_port_info_t * port);
45	int (*delete_port)(snd_seq_t *seq, snd_seq_port_info_t * port);
46	int (*get_port_info)(snd_seq_t *seq, snd_seq_port_info_t * info);
47	int (*set_port_info)(snd_seq_t *seq, snd_seq_port_info_t * info);
48	int (*get_port_subscription)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
49	int (*subscribe_port)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
50	int (*unsubscribe_port)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
51	int (*query_port_subscribers)(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
52	int (*get_queue_status)(snd_seq_t *seq, snd_seq_queue_status_t * status);
53	int (*get_queue_tempo)(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo);
54	int (*set_queue_tempo)(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo);
55	int (*get_queue_timer)(snd_seq_t *seq, snd_seq_queue_timer_t * timer);
56	int (*set_queue_timer)(snd_seq_t *seq, snd_seq_queue_timer_t * timer);
57	int (*get_queue_client)(snd_seq_t *seq, snd_seq_queue_client_t * client);
58	int (*set_queue_client)(snd_seq_t *seq, snd_seq_queue_client_t * client);
59	int (*create_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
60	int (*delete_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
61	int (*get_queue_info)(snd_seq_t *seq, snd_seq_queue_info_t *info);
62	int (*set_queue_info)(snd_seq_t *seq, snd_seq_queue_info_t *info);
63	int (*get_named_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
64	ssize_t (*write)(snd_seq_t *seq, void *buf, size_t len);
65	ssize_t (*read)(snd_seq_t *seq, void *buf, size_t len);
66	int (*remove_events)(snd_seq_t *seq, snd_seq_remove_events_t *rmp);
67	int (*get_client_pool)(snd_seq_t *seq, snd_seq_client_pool_t *info);
68	int (*set_client_pool)(snd_seq_t *seq, snd_seq_client_pool_t *info);
69	int (*query_next_client)(snd_seq_t *seq, snd_seq_client_info_t *info);
70	int (*query_next_port)(snd_seq_t *seq, snd_seq_port_info_t *info);
71} snd_seq_ops_t;
72
73struct _snd_seq {
74	char *name;
75	snd_seq_type_t type;
76	int streams;
77	int mode;
78	int poll_fd;
79	void *dl_handle;
80	const snd_seq_ops_t *ops;
81	void *private_data;
82	int client;		/* client number */
83	/* buffers */
84	char *obuf;		/* output buffer */
85	size_t obufsize;		/* output buffer size */
86	size_t obufused;		/* output buffer used size */
87	snd_seq_event_t *ibuf;	/* input buffer */
88	size_t ibufptr;		/* current pointer of input buffer */
89	size_t ibuflen;		/* queued length */
90	size_t ibufsize;		/* input buffer size */
91	snd_seq_event_t *tmpbuf;	/* temporary event for extracted event */
92	size_t tmpbufsize;		/* size of errbuf */
93};
94
95int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode);
96
97#endif
98