source: GPL/alsa-kernel/include/sound/instr.h@ 18

Last change on this file since 18 was 18, checked in by vladest, 20 years ago

initial import

File size: 7.4 KB
Line 
1/**
2 * \file <file/instr.h>
3 * \brief Application interface library for the ALSA driver
4 * \author Jaroslav Kysela <perex@suse.cz>
5 * \author Abramo Bagnara <abramo@alsa-project.org>
6 * \author Takashi Iwai <tiwai@suse.de>
7 * \date 1998-2001
8 *
9 * Application interface library for the ALSA driver
10 *
11 *
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28#ifndef __ALSA_INSTR_H
29#define __ALSA_INSTR_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/**
36 * \defgroup Instrument Instrument Interface
37 * The Instrument Interface.
38 * \{
39 */
40
41/* instrument get/put */
42
43/** container for sequencer instrument header */
44typedef struct sndrv_seq_instr_header snd_instr_header_t;
45
46size_t snd_instr_header_sizeof(void);
47#define snd_instr_header_alloca(ptr) \
48do {\
49 assert(ptr);\
50 *ptr = (snd_instr_header_t *)alloca(snd_instr_header_sizeof());\
51 memset(*ptr, 0, snd_instr_header_sizeof());\
52} while (0) /**< allocate instrument header on stack */
53int snd_instr_header_malloc(snd_instr_header_t **ptr, size_t len);
54void snd_instr_header_free(snd_instr_header_t *ptr);
55void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *src);
56
57const snd_seq_instr_t *snd_instr_header_get_id(const snd_instr_header_t *info);
58snd_seq_instr_cluster_t snd_instr_header_get_cluster(const snd_instr_header_t *info);
59unsigned int snd_instr_header_get_cmd(const snd_instr_header_t *info);
60size_t snd_instr_header_get_len(const snd_instr_header_t *info);
61const char *snd_instr_header_get_name(const snd_instr_header_t *info);
62int snd_instr_header_get_type(const snd_instr_header_t *info);
63const char *snd_instr_header_get_format(const snd_instr_header_t *info);
64const snd_seq_instr_t *snd_instr_header_get_alias(const snd_instr_header_t *info);
65void *snd_instr_header_get_data(const snd_instr_header_t *info);
66int snd_instr_header_get_follow_alias(const snd_instr_header_t *info);
67
68void snd_instr_header_set_id(snd_instr_header_t *info, const snd_seq_instr_t *id);
69void snd_instr_header_set_cluster(snd_instr_header_t *info, snd_seq_instr_cluster_t cluster);
70void snd_instr_header_set_cmd(snd_instr_header_t *info, unsigned int cmd);
71void snd_instr_header_set_len(snd_instr_header_t *info, size_t len);
72void snd_instr_header_set_name(snd_instr_header_t *info, const char *name);
73void snd_instr_header_set_type(snd_instr_header_t *info, int type);
74void snd_instr_header_set_format(snd_instr_header_t *info, const char *format);
75void snd_instr_header_set_alias(snd_instr_header_t *info, const snd_seq_instr_t *instr);
76void snd_instr_header_set_follow_alias(snd_instr_header_t *info, int val);
77
78/**
79 * Instrument abstraction layer
80 * - based on events
81 */
82
83/** instrument types */
84#define SND_SEQ_INSTR_ATYPE_DATA 0 /**< instrument data */
85#define SND_SEQ_INSTR_ATYPE_ALIAS 1 /**< instrument alias */
86
87/** instrument ASCII identifiers */
88#define SND_SEQ_INSTR_ID_DLS1 "DLS1" /**< DLS1 */
89#define SND_SEQ_INSTR_ID_DLS2 "DLS2" /**< DLS2 */
90#define SND_SEQ_INSTR_ID_SIMPLE "Simple Wave" /**< Simple Wave */
91#define SND_SEQ_INSTR_ID_SOUNDFONT "SoundFont" /**< SoundFont */
92#define SND_SEQ_INSTR_ID_GUS_PATCH "GUS Patch" /**< Gravis Patch */
93#define SND_SEQ_INSTR_ID_INTERWAVE "Interwave FFFF" /**< InterWave FFFF */
94#define SND_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM" /**< OPL2/3 FM */
95#define SND_SEQ_INSTR_ID_OPL4 "OPL4" /**< OPL4 */
96
97/** instrument types */
98#define SND_SEQ_INSTR_TYPE0_DLS1 (1<<0) /**< MIDI DLS v1 */
99#define SND_SEQ_INSTR_TYPE0_DLS2 (1<<1) /**< MIDI DLS v2 */
100#define SND_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /**< Simple Wave */
101#define SND_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /**< EMU SoundFont */
102#define SND_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /**< Gravis UltraSound Patch */
103#define SND_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /**< InterWave FFFF */
104#define SND_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /**< Yamaha OPL2/3 FM */
105#define SND_SEQ_INSTR_TYPE2_OPL4 (1<<1) /**< Yamaha OPL4 */
106
107/** put commands */
108#define SND_SEQ_INSTR_PUT_CMD_CREATE 0 /**< create a new layer */
109#define SND_SEQ_INSTR_PUT_CMD_REPLACE 1 /**< replace the old layer with new one */
110#define SND_SEQ_INSTR_PUT_CMD_MODIFY 2 /**< modify the existing layer */
111#define SND_SEQ_INSTR_PUT_CMD_ADD 3 /**< add one to the existing layer */
112#define SND_SEQ_INSTR_PUT_CMD_REMOVE 4 /**< remove the layer */
113
114/** get commands */
115#define SND_SEQ_INSTR_GET_CMD_FULL 0 /**< get the full data stream */
116#define SND_SEQ_INSTR_GET_CMD_PARTIAL 1 /**< get the partial data stream */
117
118/* query flags */
119#define SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0) /**< follow alias to get the instrument data */
120
121/** free commands */
122#define SND_SEQ_INSTR_FREE_CMD_ALL 0 /**< remove all matching instruments */
123#define SND_SEQ_INSTR_FREE_CMD_PRIVATE 1 /**< remove only private instruments */
124#define SND_SEQ_INSTR_FREE_CMD_CLUSTER 2 /**< remove only cluster instruments */
125#define SND_SEQ_INSTR_FREE_CMD_SINGLE 3 /**< remove single instrument */
126
127
128/**
129 * FM instrument support
130 */
131
132/** FM instrument data structure */
133typedef void snd_instr_fm_t;
134
135int snd_instr_fm_convert_to_stream(snd_instr_fm_t *fm, const char *name, snd_instr_header_t **put, size_t *size);
136int snd_instr_fm_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_fm_t **fm);
137int snd_instr_fm_free(snd_instr_fm_t *fm);
138
139
140/**
141 * Simple Wave support
142 */
143
144/** simple instrument data structure */
145typedef void snd_instr_simple_t;
146
147int snd_instr_simple_convert_to_stream(snd_instr_simple_t *simple, const char *name, snd_instr_header_t **put, size_t *size);
148int snd_instr_simple_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_simple_t **simple);
149int snd_instr_simple_free(snd_instr_simple_t *simple);
150
151
152/**
153 * InterWave FFFF support
154 */
155
156/** IW FFFF instrument data structure */
157typedef void snd_instr_iwffff_t;
158/** IW FFFF handler */
159typedef struct _snd_iwffff_handle snd_iwffff_handle_t;
160
161int snd_instr_iwffff_open(snd_iwffff_handle_t **handle, const char *name_fff, const char *name_dta);
162int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank, int file);
163int snd_instr_iwffff_open_rom_file(snd_iwffff_handle_t **handle, const char *name, int bank, int file);
164int snd_instr_iwffff_close(snd_iwffff_handle_t *handle);
165int snd_instr_iwffff_load(snd_iwffff_handle_t *handle, int bank, int prg, snd_instr_iwffff_t **iwffff);
166int snd_instr_iwffff_convert_to_stream(snd_instr_iwffff_t *iwffff, const char *name, snd_instr_header_t **data, size_t *size);
167int snd_instr_iwffff_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_iwffff_t **iwffff);
168int snd_instr_iwffff_free(snd_instr_iwffff_t *iwffff);
169
170/** \} */
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif /* __ALSA_INSTR_H */
177
Note: See TracBrowser for help on using the repository browser.