1d5ac70f0Sopenharmony_ci/**
2d5ac70f0Sopenharmony_ci * \file include/rawmidi.h
3d5ac70f0Sopenharmony_ci * \brief Application interface library for the ALSA driver
4d5ac70f0Sopenharmony_ci * \author Jaroslav Kysela <perex@perex.cz>
5d5ac70f0Sopenharmony_ci * \author Abramo Bagnara <abramo@alsa-project.org>
6d5ac70f0Sopenharmony_ci * \author Takashi Iwai <tiwai@suse.de>
7d5ac70f0Sopenharmony_ci * \date 1998-2001
8d5ac70f0Sopenharmony_ci *
9d5ac70f0Sopenharmony_ci * Application interface library for the ALSA driver
10d5ac70f0Sopenharmony_ci */
11d5ac70f0Sopenharmony_ci/*
12d5ac70f0Sopenharmony_ci *   This library is free software; you can redistribute it and/or modify
13d5ac70f0Sopenharmony_ci *   it under the terms of the GNU Lesser General Public License as
14d5ac70f0Sopenharmony_ci *   published by the Free Software Foundation; either version 2.1 of
15d5ac70f0Sopenharmony_ci *   the License, or (at your option) any later version.
16d5ac70f0Sopenharmony_ci *
17d5ac70f0Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
18d5ac70f0Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19d5ac70f0Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20d5ac70f0Sopenharmony_ci *   GNU Lesser General Public License for more details.
21d5ac70f0Sopenharmony_ci *
22d5ac70f0Sopenharmony_ci *   You should have received a copy of the GNU Lesser General Public
23d5ac70f0Sopenharmony_ci *   License along with this library; if not, write to the Free Software
24d5ac70f0Sopenharmony_ci *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
25d5ac70f0Sopenharmony_ci *
26d5ac70f0Sopenharmony_ci */
27d5ac70f0Sopenharmony_ci
28d5ac70f0Sopenharmony_ci#ifndef __ALSA_RAWMIDI_H
29d5ac70f0Sopenharmony_ci#define __ALSA_RAWMIDI_H
30d5ac70f0Sopenharmony_ci
31d5ac70f0Sopenharmony_ci#ifdef __cplusplus
32d5ac70f0Sopenharmony_ciextern "C" {
33d5ac70f0Sopenharmony_ci#endif
34d5ac70f0Sopenharmony_ci
35d5ac70f0Sopenharmony_ci/**
36d5ac70f0Sopenharmony_ci *  \defgroup RawMidi RawMidi Interface
37d5ac70f0Sopenharmony_ci *  The RawMidi Interface. See \ref rawmidi page for more details.
38d5ac70f0Sopenharmony_ci *  \{
39d5ac70f0Sopenharmony_ci */
40d5ac70f0Sopenharmony_ci
41d5ac70f0Sopenharmony_ci/** dlsym version for interface entry callback */
42d5ac70f0Sopenharmony_ci#define SND_RAWMIDI_DLSYM_VERSION	_dlsym_rawmidi_001
43d5ac70f0Sopenharmony_ci
44d5ac70f0Sopenharmony_ci/** RawMidi information container */
45d5ac70f0Sopenharmony_citypedef struct _snd_rawmidi_info snd_rawmidi_info_t;
46d5ac70f0Sopenharmony_ci/** RawMidi settings container */
47d5ac70f0Sopenharmony_citypedef struct _snd_rawmidi_params snd_rawmidi_params_t;
48d5ac70f0Sopenharmony_ci/** RawMidi status container */
49d5ac70f0Sopenharmony_citypedef struct _snd_rawmidi_status snd_rawmidi_status_t;
50d5ac70f0Sopenharmony_ci
51d5ac70f0Sopenharmony_ci/** RawMidi stream (direction) */
52d5ac70f0Sopenharmony_citypedef enum _snd_rawmidi_stream {
53d5ac70f0Sopenharmony_ci	/** Output stream */
54d5ac70f0Sopenharmony_ci	SND_RAWMIDI_STREAM_OUTPUT = 0,
55d5ac70f0Sopenharmony_ci	/** Input stream */
56d5ac70f0Sopenharmony_ci	SND_RAWMIDI_STREAM_INPUT,
57d5ac70f0Sopenharmony_ci	SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
58d5ac70f0Sopenharmony_ci} snd_rawmidi_stream_t;
59d5ac70f0Sopenharmony_ci
60d5ac70f0Sopenharmony_ci/** Append (flag to open mode) \hideinitializer */
61d5ac70f0Sopenharmony_ci#define SND_RAWMIDI_APPEND	0x0001
62d5ac70f0Sopenharmony_ci/** Non blocking mode (flag to open mode) \hideinitializer */
63d5ac70f0Sopenharmony_ci#define SND_RAWMIDI_NONBLOCK	0x0002
64d5ac70f0Sopenharmony_ci/** Write sync mode (Flag to open mode) \hideinitializer */
65d5ac70f0Sopenharmony_ci#define SND_RAWMIDI_SYNC	0x0004
66d5ac70f0Sopenharmony_ci
67d5ac70f0Sopenharmony_ci/** RawMidi handle */
68d5ac70f0Sopenharmony_citypedef struct _snd_rawmidi snd_rawmidi_t;
69d5ac70f0Sopenharmony_ci
70d5ac70f0Sopenharmony_ci/** RawMidi type */
71d5ac70f0Sopenharmony_citypedef enum _snd_rawmidi_type {
72d5ac70f0Sopenharmony_ci	/** Kernel level RawMidi */
73d5ac70f0Sopenharmony_ci	SND_RAWMIDI_TYPE_HW,
74d5ac70f0Sopenharmony_ci	/** Shared memory client RawMidi (not yet implemented) */
75d5ac70f0Sopenharmony_ci	SND_RAWMIDI_TYPE_SHM,
76d5ac70f0Sopenharmony_ci	/** INET client RawMidi (not yet implemented) */
77d5ac70f0Sopenharmony_ci	SND_RAWMIDI_TYPE_INET,
78d5ac70f0Sopenharmony_ci	/** Virtual (sequencer) RawMidi */
79d5ac70f0Sopenharmony_ci	SND_RAWMIDI_TYPE_VIRTUAL
80d5ac70f0Sopenharmony_ci} snd_rawmidi_type_t;
81d5ac70f0Sopenharmony_ci
82d5ac70f0Sopenharmony_ci/** Type of clock used with rawmidi timestamp */
83d5ac70f0Sopenharmony_citypedef enum _snd_rawmidi_clock {
84d5ac70f0Sopenharmony_ci	SND_RAWMIDI_CLOCK_NONE = 0,
85d5ac70f0Sopenharmony_ci	SND_RAWMIDI_CLOCK_REALTIME = 1,
86d5ac70f0Sopenharmony_ci	SND_RAWMIDI_CLOCK_MONOTONIC = 2,
87d5ac70f0Sopenharmony_ci	SND_RAWMIDI_CLOCK_MONOTONIC_RAW = 3,
88d5ac70f0Sopenharmony_ci} snd_rawmidi_clock_t;
89d5ac70f0Sopenharmony_ci
90d5ac70f0Sopenharmony_ci/** Select the read mode (standard or with timestamps) */
91d5ac70f0Sopenharmony_citypedef enum _snd_rawmidi_read_mode {
92d5ac70f0Sopenharmony_ci	SND_RAWMIDI_READ_STANDARD = 0,
93d5ac70f0Sopenharmony_ci	SND_RAWMIDI_READ_TSTAMP = 1,
94d5ac70f0Sopenharmony_ci} snd_rawmidi_read_mode_t;
95d5ac70f0Sopenharmony_ci
96d5ac70f0Sopenharmony_ci/** rawmidi info bit flags */
97d5ac70f0Sopenharmony_ci#define SND_RAWMIDI_INFO_UMP			0x00000008	/* rawmidi is UMP */
98d5ac70f0Sopenharmony_ci
99d5ac70f0Sopenharmony_ciint snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
100d5ac70f0Sopenharmony_ci		     const char *name, int mode);
101d5ac70f0Sopenharmony_ciint snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
102d5ac70f0Sopenharmony_ci			   const char *name, int mode, snd_config_t *lconf);
103d5ac70f0Sopenharmony_ciint snd_rawmidi_close(snd_rawmidi_t *rmidi);
104d5ac70f0Sopenharmony_ciint snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
105d5ac70f0Sopenharmony_ciint snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
106d5ac70f0Sopenharmony_ciint snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
107d5ac70f0Sopenharmony_ciint snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
108d5ac70f0Sopenharmony_cisize_t snd_rawmidi_info_sizeof(void);
109d5ac70f0Sopenharmony_ci/** \hideinitializer
110d5ac70f0Sopenharmony_ci * \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
111d5ac70f0Sopenharmony_ci * \param ptr returned pointer
112d5ac70f0Sopenharmony_ci */
113d5ac70f0Sopenharmony_ci#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
114d5ac70f0Sopenharmony_ciint snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
115d5ac70f0Sopenharmony_civoid snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
116d5ac70f0Sopenharmony_civoid snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
117d5ac70f0Sopenharmony_ciunsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
118d5ac70f0Sopenharmony_ciunsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
119d5ac70f0Sopenharmony_cisnd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
120d5ac70f0Sopenharmony_ciint snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
121d5ac70f0Sopenharmony_ciunsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
122d5ac70f0Sopenharmony_ciconst char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
123d5ac70f0Sopenharmony_ciconst char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
124d5ac70f0Sopenharmony_ciconst char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
125d5ac70f0Sopenharmony_ciunsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
126d5ac70f0Sopenharmony_ciunsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
127d5ac70f0Sopenharmony_civoid snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
128d5ac70f0Sopenharmony_civoid snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
129d5ac70f0Sopenharmony_civoid snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
130d5ac70f0Sopenharmony_ciint snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
131d5ac70f0Sopenharmony_cisize_t snd_rawmidi_params_sizeof(void);
132d5ac70f0Sopenharmony_ci/** \hideinitializer
133d5ac70f0Sopenharmony_ci * \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
134d5ac70f0Sopenharmony_ci * \param ptr returned pointer
135d5ac70f0Sopenharmony_ci */
136d5ac70f0Sopenharmony_ci#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
137d5ac70f0Sopenharmony_ciint snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
138d5ac70f0Sopenharmony_civoid snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
139d5ac70f0Sopenharmony_civoid snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
140d5ac70f0Sopenharmony_ciint snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
141d5ac70f0Sopenharmony_cisize_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
142d5ac70f0Sopenharmony_ciint snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
143d5ac70f0Sopenharmony_cisize_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
144d5ac70f0Sopenharmony_ciint snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
145d5ac70f0Sopenharmony_ciint snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
146d5ac70f0Sopenharmony_ciint snd_rawmidi_params_set_read_mode(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_read_mode_t val);
147d5ac70f0Sopenharmony_cisnd_rawmidi_read_mode_t snd_rawmidi_params_get_read_mode(const snd_rawmidi_params_t *params);
148d5ac70f0Sopenharmony_ciint snd_rawmidi_params_set_clock_type(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_clock_t val);
149d5ac70f0Sopenharmony_cisnd_rawmidi_clock_t snd_rawmidi_params_get_clock_type(const snd_rawmidi_params_t *params);
150d5ac70f0Sopenharmony_ci
151d5ac70f0Sopenharmony_ciint snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
152d5ac70f0Sopenharmony_ciint snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
153d5ac70f0Sopenharmony_cisize_t snd_rawmidi_status_sizeof(void);
154d5ac70f0Sopenharmony_ci/** \hideinitializer
155d5ac70f0Sopenharmony_ci * \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
156d5ac70f0Sopenharmony_ci * \param ptr returned pointer
157d5ac70f0Sopenharmony_ci */
158d5ac70f0Sopenharmony_ci#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
159d5ac70f0Sopenharmony_ciint snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
160d5ac70f0Sopenharmony_civoid snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
161d5ac70f0Sopenharmony_civoid snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
162d5ac70f0Sopenharmony_civoid snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
163d5ac70f0Sopenharmony_cisize_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
164d5ac70f0Sopenharmony_cisize_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
165d5ac70f0Sopenharmony_ciint snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
166d5ac70f0Sopenharmony_ciint snd_rawmidi_drain(snd_rawmidi_t *rmidi);
167d5ac70f0Sopenharmony_ciint snd_rawmidi_drop(snd_rawmidi_t *rmidi);
168d5ac70f0Sopenharmony_cissize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
169d5ac70f0Sopenharmony_cissize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
170d5ac70f0Sopenharmony_cissize_t snd_rawmidi_tread(snd_rawmidi_t *rmidi, struct timespec *tstamp, void *buffer, size_t size);
171d5ac70f0Sopenharmony_ciconst char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
172d5ac70f0Sopenharmony_cisnd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
173d5ac70f0Sopenharmony_cisnd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
174d5ac70f0Sopenharmony_ci
175d5ac70f0Sopenharmony_ci/** \} */
176d5ac70f0Sopenharmony_ci
177d5ac70f0Sopenharmony_ci#ifdef __cplusplus
178d5ac70f0Sopenharmony_ci}
179d5ac70f0Sopenharmony_ci#endif
180d5ac70f0Sopenharmony_ci
181d5ac70f0Sopenharmony_ci#endif /* __RAWMIDI_H */
182d5ac70f0Sopenharmony_ci
183