1 #ifndef __SOUND_SFNT_INFO_H
2 #define __SOUND_SFNT_INFO_H
5 * Patch record compatible with AWE driver on OSS
7 * Copyright (C) 1999-2000 Takashi Iwai
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <sound/asound.h>
28 * patch information record
31 #ifdef SNDRV_BIG_ENDIAN
32 #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id)
34 #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd)
37 /* patch interface header: 16 bytes */
38 typedef struct soundfont_patch_info_t
{
39 unsigned short key
; /* use the key below */
40 #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
42 short device_no
; /* synthesizer number */
43 unsigned short sf_id
; /* file id (should be zero) */
44 short optarg
; /* optional argument */
45 int len
; /* data length (without this header) */
47 short type
; /* patch operation type */
48 #define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */
49 #define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */
50 #define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */
51 #define SNDRV_SFNT_CLOSE_PATCH 3 /* none */
53 #define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/
54 #define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */
56 #define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */
57 #define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */
59 short reserved
; /* word alignment data */
61 /* the actual patch data begins after this */
62 } soundfont_patch_info_t
;
69 #define SNDRV_SFNT_PATCH_NAME_LEN 32
71 typedef struct soundfont_open_parm_t
{
72 unsigned short type
; /* sample type */
73 #define SNDRV_SFNT_PAT_TYPE_MISC 0
74 #define SNDRV_SFNT_PAT_TYPE_GUS 6
75 #define SNDRV_SFNT_PAT_TYPE_MAP 7
76 #define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */
77 #define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */
80 char name
[SNDRV_SFNT_PATCH_NAME_LEN
];
81 } soundfont_open_parm_t
;
85 * raw voice information record
88 /* wave table envelope & effect parameters to control EMU8000 */
89 typedef struct soundfont_voice_parm_t
{
90 unsigned short moddelay
; /* modulation delay (0x8000) */
91 unsigned short modatkhld
; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus
; /* modulation decay & sustain (0x7f7f) */
93 unsigned short modrelease
; /* modulation release time (0x807f) */
94 short modkeyhold
, modkeydecay
; /* envelope change per key (not used) */
95 unsigned short voldelay
; /* volume delay (0x8000) */
96 unsigned short volatkhld
; /* volume attack & hold time (0x7f7f) */
97 unsigned short voldcysus
; /* volume decay & sustain (0x7f7f) */
98 unsigned short volrelease
; /* volume release time (0x807f) */
99 short volkeyhold
, volkeydecay
; /* envelope change per key (not used) */
100 unsigned short lfo1delay
; /* LFO1 delay (0x8000) */
101 unsigned short lfo2delay
; /* LFO2 delay (0x8000) */
102 unsigned short pefe
; /* modulation pitch & cutoff (0x0000) */
103 unsigned short fmmod
; /* LFO1 pitch & cutoff (0x0000) */
104 unsigned short tremfrq
; /* LFO1 volume & freq (0x0000) */
105 unsigned short fm2frq2
; /* LFO2 pitch & freq (0x0000) */
106 unsigned char cutoff
; /* initial cutoff (0xff) */
107 unsigned char filterQ
; /* initial filter Q [0-15] (0x0) */
108 unsigned char chorus
; /* chorus send (0x00) */
109 unsigned char reverb
; /* reverb send (0x00) */
110 unsigned short reserved
[4]; /* not used */
111 } soundfont_voice_parm_t
;
114 /* wave table parameters: 92 bytes */
115 typedef struct soundfont_voice_info_t
{
116 unsigned short sf_id
; /* file id (should be zero) */
117 unsigned short sample
; /* sample id */
118 int start
, end
; /* sample offset correction */
119 int loopstart
, loopend
; /* loop offset correction */
120 short rate_offset
; /* sample rate pitch offset */
121 unsigned short mode
; /* sample mode */
122 #define SNDRV_SFNT_MODE_ROMSOUND 0x8000
123 #define SNDRV_SFNT_MODE_STEREO 1
124 #define SNDRV_SFNT_MODE_LOOPING 2
125 #define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */
126 #define SNDRV_SFNT_MODE_INIT_PARM 8
128 short root
; /* midi root key */
129 short tune
; /* pitch tuning (in cents) */
130 unsigned char low
, high
; /* key note range */
131 unsigned char vellow
, velhigh
; /* velocity range */
132 signed char fixkey
, fixvel
; /* fixed key, velocity */
133 signed char pan
, fixpan
; /* panning, fixed panning */
134 short exclusiveClass
; /* exclusive class (0 = none) */
135 unsigned char amplitude
; /* sample volume (127 max) */
136 unsigned char attenuation
; /* attenuation (0.375dB) */
137 short scaleTuning
; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm
; /* voice envelope parameters */
139 unsigned short sample_mode
; /* sample mode_flag (set by driver) */
140 } soundfont_voice_info_t
;
143 /* instrument info header: 4 bytes */
144 typedef struct soundfont_voice_rec_hdr_t
{
145 unsigned char bank
; /* midi bank number */
146 unsigned char instr
; /* midi preset number */
147 char nvoices
; /* number of voices */
148 char write_mode
; /* write mode; normally 0 */
149 #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150 #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151 #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152 } soundfont_voice_rec_hdr_t
;
156 * sample wave information
159 /* wave table sample header: 32 bytes */
160 typedef struct soundfont_sample_info_t
{
161 unsigned short sf_id
; /* file id (should be zero) */
162 unsigned short sample
; /* sample id */
163 int start
, end
; /* start & end offset */
164 int loopstart
, loopend
; /* loop start & end offset */
165 int size
; /* size (0 = ROM) */
166 short dummy
; /* not used */
167 unsigned short mode_flags
; /* mode flags */
168 #define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */
169 #define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */
170 #define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */
171 #define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */
172 #define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */
173 #define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */
174 #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175 #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize
; /* used memory size (set by driver) */
177 } soundfont_sample_info_t
;
181 * voice preset mapping (aliasing)
184 typedef struct soundfont_voice_map_t
{
185 int map_bank
, map_instr
, map_key
; /* key = -1 means all keys */
186 int src_bank
, src_instr
, src_key
;
187 } soundfont_voice_map_t
;
194 #define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable"
196 #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
198 struct sndrv_emux_misc_mode
{
199 int port
; /* -1 = all */
202 int value2
; /* reserved */
206 SNDRV_EMUX_IOCTL_VERSION
= _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH
= _IOWR('H', 0x81, soundfont_patch_info_t
),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES
= _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES
= _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL
= _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE
= _IOWR('H', 0x84, struct sndrv_emux_misc_mode
),
214 #endif /* __SOUND_SFNT_INFO_H */