1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2674e95caSDavid Howells #ifndef __SOUND_SFNT_INFO_H 3674e95caSDavid Howells #define __SOUND_SFNT_INFO_H 4674e95caSDavid Howells 5674e95caSDavid Howells /* 6674e95caSDavid Howells * Patch record compatible with AWE driver on OSS 7674e95caSDavid Howells * 8674e95caSDavid Howells * Copyright (C) 1999-2000 Takashi Iwai 9674e95caSDavid Howells * 10674e95caSDavid Howells * This program is free software; you can redistribute it and/or modify 11674e95caSDavid Howells * it under the terms of the GNU General Public License as published by 12674e95caSDavid Howells * the Free Software Foundation; either version 2 of the License, or 13674e95caSDavid Howells * (at your option) any later version. 14674e95caSDavid Howells * 15674e95caSDavid Howells * This program is distributed in the hope that it will be useful, 16674e95caSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 17674e95caSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18674e95caSDavid Howells * GNU General Public License for more details. 19674e95caSDavid Howells * 20674e95caSDavid Howells * You should have received a copy of the GNU General Public License 21674e95caSDavid Howells * along with this program; if not, write to the Free Software 22674e95caSDavid Howells * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23674e95caSDavid Howells * 24674e95caSDavid Howells */ 25674e95caSDavid Howells 26674e95caSDavid Howells #include <sound/asound.h> 27674e95caSDavid Howells 28674e95caSDavid Howells /* 29674e95caSDavid Howells * patch information record 30674e95caSDavid Howells */ 31674e95caSDavid Howells 32674e95caSDavid Howells #ifdef SNDRV_BIG_ENDIAN 33674e95caSDavid Howells #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id) 34674e95caSDavid Howells #else 35674e95caSDavid Howells #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd) 36674e95caSDavid Howells #endif 37674e95caSDavid Howells 38674e95caSDavid Howells /* patch interface header: 16 bytes */ 39674e95caSDavid Howells struct soundfont_patch_info { 40674e95caSDavid Howells unsigned short key; /* use the key below */ 41674e95caSDavid Howells #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 42674e95caSDavid Howells 43674e95caSDavid Howells short device_no; /* synthesizer number */ 44674e95caSDavid Howells unsigned short sf_id; /* file id (should be zero) */ 45674e95caSDavid Howells short optarg; /* optional argument */ 46674e95caSDavid Howells int len; /* data length (without this header) */ 47674e95caSDavid Howells 48674e95caSDavid Howells short type; /* patch operation type */ 49674e95caSDavid Howells #define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */ 50674e95caSDavid Howells #define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */ 51674e95caSDavid Howells #define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */ 52674e95caSDavid Howells #define SNDRV_SFNT_CLOSE_PATCH 3 /* none */ 53674e95caSDavid Howells /* 4 is obsolete */ 54674e95caSDavid Howells #define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ 55674e95caSDavid Howells #define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */ 56674e95caSDavid Howells /* 7 is not used */ 57674e95caSDavid Howells #define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */ 58674e95caSDavid Howells #define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */ 59674e95caSDavid Howells 60674e95caSDavid Howells short reserved; /* word alignment data */ 61674e95caSDavid Howells 62674e95caSDavid Howells /* the actual patch data begins after this */ 63674e95caSDavid Howells }; 64674e95caSDavid Howells 65674e95caSDavid Howells 66674e95caSDavid Howells /* 67674e95caSDavid Howells * open patch 68674e95caSDavid Howells */ 69674e95caSDavid Howells 70674e95caSDavid Howells #define SNDRV_SFNT_PATCH_NAME_LEN 32 71674e95caSDavid Howells 72674e95caSDavid Howells struct soundfont_open_parm { 73674e95caSDavid Howells unsigned short type; /* sample type */ 74674e95caSDavid Howells #define SNDRV_SFNT_PAT_TYPE_MISC 0 75674e95caSDavid Howells #define SNDRV_SFNT_PAT_TYPE_GUS 6 76674e95caSDavid Howells #define SNDRV_SFNT_PAT_TYPE_MAP 7 77674e95caSDavid Howells #define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */ 78674e95caSDavid Howells #define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */ 79674e95caSDavid Howells 80674e95caSDavid Howells short reserved; 81674e95caSDavid Howells char name[SNDRV_SFNT_PATCH_NAME_LEN]; 82674e95caSDavid Howells }; 83674e95caSDavid Howells 84674e95caSDavid Howells 85674e95caSDavid Howells /* 86674e95caSDavid Howells * raw voice information record 87674e95caSDavid Howells */ 88674e95caSDavid Howells 89674e95caSDavid Howells /* wave table envelope & effect parameters to control EMU8000 */ 90674e95caSDavid Howells struct soundfont_voice_parm { 91674e95caSDavid Howells unsigned short moddelay; /* modulation delay (0x8000) */ 92674e95caSDavid Howells unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 93674e95caSDavid Howells unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 94674e95caSDavid Howells unsigned short modrelease; /* modulation release time (0x807f) */ 95674e95caSDavid Howells short modkeyhold, modkeydecay; /* envelope change per key (not used) */ 96674e95caSDavid Howells unsigned short voldelay; /* volume delay (0x8000) */ 97674e95caSDavid Howells unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ 98674e95caSDavid Howells unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ 99674e95caSDavid Howells unsigned short volrelease; /* volume release time (0x807f) */ 100674e95caSDavid Howells short volkeyhold, volkeydecay; /* envelope change per key (not used) */ 101674e95caSDavid Howells unsigned short lfo1delay; /* LFO1 delay (0x8000) */ 102674e95caSDavid Howells unsigned short lfo2delay; /* LFO2 delay (0x8000) */ 103674e95caSDavid Howells unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ 104674e95caSDavid Howells unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ 105674e95caSDavid Howells unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ 106674e95caSDavid Howells unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ 107674e95caSDavid Howells unsigned char cutoff; /* initial cutoff (0xff) */ 108674e95caSDavid Howells unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ 109674e95caSDavid Howells unsigned char chorus; /* chorus send (0x00) */ 110674e95caSDavid Howells unsigned char reverb; /* reverb send (0x00) */ 111674e95caSDavid Howells unsigned short reserved[4]; /* not used */ 112674e95caSDavid Howells }; 113674e95caSDavid Howells 114674e95caSDavid Howells 115674e95caSDavid Howells /* wave table parameters: 92 bytes */ 116674e95caSDavid Howells struct soundfont_voice_info { 117674e95caSDavid Howells unsigned short sf_id; /* file id (should be zero) */ 118674e95caSDavid Howells unsigned short sample; /* sample id */ 119674e95caSDavid Howells int start, end; /* sample offset correction */ 120674e95caSDavid Howells int loopstart, loopend; /* loop offset correction */ 121674e95caSDavid Howells short rate_offset; /* sample rate pitch offset */ 122674e95caSDavid Howells unsigned short mode; /* sample mode */ 123674e95caSDavid Howells #define SNDRV_SFNT_MODE_ROMSOUND 0x8000 124674e95caSDavid Howells #define SNDRV_SFNT_MODE_STEREO 1 125674e95caSDavid Howells #define SNDRV_SFNT_MODE_LOOPING 2 126674e95caSDavid Howells #define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */ 127674e95caSDavid Howells #define SNDRV_SFNT_MODE_INIT_PARM 8 128674e95caSDavid Howells 129674e95caSDavid Howells short root; /* midi root key */ 130674e95caSDavid Howells short tune; /* pitch tuning (in cents) */ 131674e95caSDavid Howells unsigned char low, high; /* key note range */ 132674e95caSDavid Howells unsigned char vellow, velhigh; /* velocity range */ 133674e95caSDavid Howells signed char fixkey, fixvel; /* fixed key, velocity */ 134674e95caSDavid Howells signed char pan, fixpan; /* panning, fixed panning */ 135674e95caSDavid Howells short exclusiveClass; /* exclusive class (0 = none) */ 136674e95caSDavid Howells unsigned char amplitude; /* sample volume (127 max) */ 137674e95caSDavid Howells unsigned char attenuation; /* attenuation (0.375dB) */ 138674e95caSDavid Howells short scaleTuning; /* pitch scale tuning(%), normally 100 */ 139674e95caSDavid Howells struct soundfont_voice_parm parm; /* voice envelope parameters */ 140674e95caSDavid Howells unsigned short sample_mode; /* sample mode_flag (set by driver) */ 141674e95caSDavid Howells }; 142674e95caSDavid Howells 143674e95caSDavid Howells 144674e95caSDavid Howells /* instrument info header: 4 bytes */ 145674e95caSDavid Howells struct soundfont_voice_rec_hdr { 146674e95caSDavid Howells unsigned char bank; /* midi bank number */ 147674e95caSDavid Howells unsigned char instr; /* midi preset number */ 148674e95caSDavid Howells char nvoices; /* number of voices */ 149674e95caSDavid Howells char write_mode; /* write mode; normally 0 */ 150674e95caSDavid Howells #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 151674e95caSDavid Howells #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 152674e95caSDavid Howells #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 153674e95caSDavid Howells }; 154674e95caSDavid Howells 155674e95caSDavid Howells 156674e95caSDavid Howells /* 157674e95caSDavid Howells * sample wave information 158674e95caSDavid Howells */ 159674e95caSDavid Howells 160674e95caSDavid Howells /* wave table sample header: 32 bytes */ 161674e95caSDavid Howells struct soundfont_sample_info { 162674e95caSDavid Howells unsigned short sf_id; /* file id (should be zero) */ 163674e95caSDavid Howells unsigned short sample; /* sample id */ 164674e95caSDavid Howells int start, end; /* start & end offset */ 165674e95caSDavid Howells int loopstart, loopend; /* loop start & end offset */ 166674e95caSDavid Howells int size; /* size (0 = ROM) */ 167674e95caSDavid Howells short dummy; /* not used */ 168674e95caSDavid Howells unsigned short mode_flags; /* mode flags */ 169674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */ 170674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ 171674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ 172674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ 173674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ 174674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ 175674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 176674e95caSDavid Howells #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 177674e95caSDavid Howells unsigned int truesize; /* used memory size (set by driver) */ 178674e95caSDavid Howells }; 179674e95caSDavid Howells 180674e95caSDavid Howells 181674e95caSDavid Howells /* 182674e95caSDavid Howells * voice preset mapping (aliasing) 183674e95caSDavid Howells */ 184674e95caSDavid Howells 185674e95caSDavid Howells struct soundfont_voice_map { 186674e95caSDavid Howells int map_bank, map_instr, map_key; /* key = -1 means all keys */ 187674e95caSDavid Howells int src_bank, src_instr, src_key; 188674e95caSDavid Howells }; 189674e95caSDavid Howells 190674e95caSDavid Howells 191674e95caSDavid Howells /* 192674e95caSDavid Howells * ioctls for hwdep 193674e95caSDavid Howells */ 194674e95caSDavid Howells 195674e95caSDavid Howells #define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable" 196674e95caSDavid Howells 197674e95caSDavid Howells #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 198674e95caSDavid Howells 199674e95caSDavid Howells struct snd_emux_misc_mode { 200674e95caSDavid Howells int port; /* -1 = all */ 201674e95caSDavid Howells int mode; 202674e95caSDavid Howells int value; 203674e95caSDavid Howells int value2; /* reserved */ 204674e95caSDavid Howells }; 205674e95caSDavid Howells 206674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int) 207674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info) 208674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82) 209674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83) 210674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int) 211674e95caSDavid Howells #define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode) 212674e95caSDavid Howells 213674e95caSDavid Howells #endif /* __SOUND_SFNT_INFO_H */ 214