Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 #ifndef __SOUND_SFNT_INFO_H
0003 #define __SOUND_SFNT_INFO_H
0004 
0005 /*
0006  *  Patch record compatible with AWE driver on OSS
0007  *
0008  *  Copyright (C) 1999-2000 Takashi Iwai
0009  *
0010  *   This program is free software; you can redistribute it and/or modify
0011  *   it under the terms of the GNU General Public License as published by
0012  *   the Free Software Foundation; either version 2 of the License, or
0013  *   (at your option) any later version.
0014  *
0015  *   This program is distributed in the hope that it will be useful,
0016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  *   GNU General Public License for more details.
0019  *
0020  *   You should have received a copy of the GNU General Public License
0021  *   along with this program; if not, write to the Free Software
0022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
0023  *
0024  */
0025 
0026 #include <sound/asound.h>
0027 
0028 /*
0029  * patch information record
0030  */
0031 
0032 #ifdef SNDRV_BIG_ENDIAN
0033 #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id)
0034 #else
0035 #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd)
0036 #endif
0037 
0038 /* patch interface header: 16 bytes */
0039 struct soundfont_patch_info {
0040     unsigned short key;     /* use the key below */
0041 #define SNDRV_OSS_SOUNDFONT_PATCH       SNDRV_OSS_PATCHKEY(0x07)
0042 
0043     short device_no;        /* synthesizer number */
0044     unsigned short sf_id;       /* file id (should be zero) */
0045     short optarg;           /* optional argument */
0046     int len;            /* data length (without this header) */
0047 
0048     short type;         /* patch operation type */
0049 #define SNDRV_SFNT_LOAD_INFO        0   /* awe_voice_rec */
0050 #define SNDRV_SFNT_LOAD_DATA        1   /* awe_sample_info */
0051 #define SNDRV_SFNT_OPEN_PATCH   2   /* awe_open_parm */
0052 #define SNDRV_SFNT_CLOSE_PATCH  3   /* none */
0053     /* 4 is obsolete */
0054 #define SNDRV_SFNT_REPLACE_DATA 5   /* awe_sample_info (optarg=#channels)*/
0055 #define SNDRV_SFNT_MAP_PRESET   6   /* awe_voice_map */
0056     /* 7 is not used */
0057 #define SNDRV_SFNT_PROBE_DATA       8   /* optarg=sample */
0058 #define SNDRV_SFNT_REMOVE_INFO      9   /* optarg=(bank<<8)|instr */
0059 
0060     short reserved;         /* word alignment data */
0061 
0062     /* the actual patch data begins after this */
0063 };
0064 
0065 
0066 /*
0067  * open patch
0068  */
0069 
0070 #define SNDRV_SFNT_PATCH_NAME_LEN   32
0071 
0072 struct soundfont_open_parm {
0073     unsigned short type;        /* sample type */
0074 #define SNDRV_SFNT_PAT_TYPE_MISC    0
0075 #define SNDRV_SFNT_PAT_TYPE_GUS 6
0076 #define SNDRV_SFNT_PAT_TYPE_MAP 7
0077 #define SNDRV_SFNT_PAT_LOCKED   0x100   /* lock the samples */
0078 #define SNDRV_SFNT_PAT_SHARED   0x200   /* sample is shared */
0079 
0080     short reserved;
0081     char name[SNDRV_SFNT_PATCH_NAME_LEN];
0082 };
0083 
0084 
0085 /*
0086  * raw voice information record
0087  */
0088 
0089 /* wave table envelope & effect parameters to control EMU8000 */
0090 struct soundfont_voice_parm {
0091     unsigned short moddelay;    /* modulation delay (0x8000) */
0092     unsigned short modatkhld;   /* modulation attack & hold time (0x7f7f) */
0093     unsigned short moddcysus;   /* modulation decay & sustain (0x7f7f) */
0094     unsigned short modrelease;  /* modulation release time (0x807f) */
0095     short modkeyhold, modkeydecay;  /* envelope change per key (not used) */
0096     unsigned short voldelay;    /* volume delay (0x8000) */
0097     unsigned short volatkhld;   /* volume attack & hold time (0x7f7f) */
0098     unsigned short voldcysus;   /* volume decay & sustain (0x7f7f) */
0099     unsigned short volrelease;  /* volume release time (0x807f) */
0100     short volkeyhold, volkeydecay;  /* envelope change per key (not used) */
0101     unsigned short lfo1delay;   /* LFO1 delay (0x8000) */
0102     unsigned short lfo2delay;   /* LFO2 delay (0x8000) */
0103     unsigned short pefe;        /* modulation pitch & cutoff (0x0000) */
0104     unsigned short fmmod;       /* LFO1 pitch & cutoff (0x0000) */
0105     unsigned short tremfrq;     /* LFO1 volume & freq (0x0000) */
0106     unsigned short fm2frq2;     /* LFO2 pitch & freq (0x0000) */
0107     unsigned char cutoff;       /* initial cutoff (0xff) */
0108     unsigned char filterQ;      /* initial filter Q [0-15] (0x0) */
0109     unsigned char chorus;       /* chorus send (0x00) */
0110     unsigned char reverb;       /* reverb send (0x00) */
0111     unsigned short reserved[4]; /* not used */
0112 };
0113 
0114 
0115 /* wave table parameters: 92 bytes */
0116 struct soundfont_voice_info {
0117     unsigned short sf_id;       /* file id (should be zero) */
0118     unsigned short sample;      /* sample id */
0119     int start, end;         /* sample offset correction */
0120     int loopstart, loopend;     /* loop offset correction */
0121     short rate_offset;      /* sample rate pitch offset */
0122     unsigned short mode;        /* sample mode */
0123 #define SNDRV_SFNT_MODE_ROMSOUND        0x8000
0124 #define SNDRV_SFNT_MODE_STEREO      1
0125 #define SNDRV_SFNT_MODE_LOOPING     2
0126 #define SNDRV_SFNT_MODE_NORELEASE       4   /* obsolete */
0127 #define SNDRV_SFNT_MODE_INIT_PARM       8
0128 
0129     short root;         /* midi root key */
0130     short tune;         /* pitch tuning (in cents) */
0131     unsigned char low, high;    /* key note range */
0132     unsigned char vellow, velhigh;  /* velocity range */
0133     signed char fixkey, fixvel; /* fixed key, velocity */
0134     signed char pan, fixpan;    /* panning, fixed panning */
0135     short exclusiveClass;       /* exclusive class (0 = none) */
0136     unsigned char amplitude;    /* sample volume (127 max) */
0137     unsigned char attenuation;  /* attenuation (0.375dB) */
0138     short scaleTuning;      /* pitch scale tuning(%), normally 100 */
0139     struct soundfont_voice_parm parm;   /* voice envelope parameters */
0140     unsigned short sample_mode; /* sample mode_flag (set by driver) */
0141 };
0142 
0143 
0144 /* instrument info header: 4 bytes */
0145 struct soundfont_voice_rec_hdr {
0146     unsigned char bank;     /* midi bank number */
0147     unsigned char instr;        /* midi preset number */
0148     char nvoices;           /* number of voices */
0149     char write_mode;        /* write mode; normally 0 */
0150 #define SNDRV_SFNT_WR_APPEND        0   /* append anyway */
0151 #define SNDRV_SFNT_WR_EXCLUSIVE     1   /* skip if already exists */
0152 #define SNDRV_SFNT_WR_REPLACE       2   /* replace if already exists */
0153 };
0154 
0155 
0156 /*
0157  * sample wave information
0158  */
0159 
0160 /* wave table sample header: 32 bytes */
0161 struct soundfont_sample_info {
0162     unsigned short sf_id;       /* file id (should be zero) */
0163     unsigned short sample;      /* sample id */
0164     int start, end;         /* start & end offset */
0165     int loopstart, loopend;     /* loop start & end offset */
0166     int size;           /* size (0 = ROM) */
0167     short dummy;            /* not used */
0168     unsigned short mode_flags;  /* mode flags */
0169 #define SNDRV_SFNT_SAMPLE_8BITS     1   /* wave data is 8bits */
0170 #define SNDRV_SFNT_SAMPLE_UNSIGNED  2   /* wave data is unsigned */
0171 #define SNDRV_SFNT_SAMPLE_NO_BLANK  4   /* no blank loop is attached */
0172 #define SNDRV_SFNT_SAMPLE_SINGLESHOT    8   /* single-shot w/o loop */
0173 #define SNDRV_SFNT_SAMPLE_BIDIR_LOOP    16  /* bidirectional looping */
0174 #define SNDRV_SFNT_SAMPLE_STEREO_LEFT   32  /* stereo left sound */
0175 #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT  64  /* stereo right sound */
0176 #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP  128 /* reverse looping */
0177     unsigned int truesize;      /* used memory size (set by driver) */
0178 };
0179 
0180 
0181 /*
0182  * voice preset mapping (aliasing)
0183  */
0184 
0185 struct soundfont_voice_map {
0186     int map_bank, map_instr, map_key;   /* key = -1 means all keys */
0187     int src_bank, src_instr, src_key;
0188 };
0189 
0190 
0191 /*
0192  * ioctls for hwdep
0193  */
0194 
0195 #define SNDRV_EMUX_HWDEP_NAME   "Emux WaveTable"
0196 
0197 #define SNDRV_EMUX_VERSION  ((1 << 16) | (0 << 8) | 0)  /* 1.0.0 */
0198 
0199 struct snd_emux_misc_mode {
0200     int port;   /* -1 = all */
0201     int mode;
0202     int value;
0203     int value2; /* reserved */
0204 };
0205 
0206 #define SNDRV_EMUX_IOCTL_VERSION    _IOR('H', 0x80, unsigned int)
0207 #define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info)
0208 #define SNDRV_EMUX_IOCTL_RESET_SAMPLES  _IO('H', 0x82)
0209 #define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83)
0210 #define SNDRV_EMUX_IOCTL_MEM_AVAIL  _IOW('H', 0x84, int)
0211 #define SNDRV_EMUX_IOCTL_MISC_MODE  _IOWR('H', 0x84, struct snd_emux_misc_mode)
0212 
0213 #endif /* __SOUND_SFNT_INFO_H */