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