Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


sfnt_info.h
001: #ifndef __SOUND_SFNT_INFO_H
002: #define __SOUND_SFNT_INFO_H
003: 
004: /*
005:  *  Patch record compatible with AWE driver on OSS
006:  *
007:  *  Copyright (C) 1999-2000 Takashi Iwai
008:  *
009:  *   This program is free software; you can redistribute it and/or modify
010:  *   it under the terms of the GNU General Public License as published by
011:  *   the Free Software Foundation; either version 2 of the License, or
012:  *   (at your option) any later version.
013:  *
014:  *   This program is distributed in the hope that it will be useful,
015:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
016:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017:  *   GNU General Public License for more details.
018:  *
019:  *   You should have received a copy of the GNU General Public License
020:  *   along with this program; if not, write to the Free Software
021:  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
022:  *
023:  */
024: 
025: #include <sound/asound.h>
026: 
027: /*
028:  * patch information record
029:  */
030: 
031: #ifdef SNDRV_BIG_ENDIAN
032: #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id)
033: #else
034: #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd)
035: #endif
036: 
037: /* patch interface header: 16 bytes */
038: struct soundfont_patch_info {
039:         unsigned short key;             /* use the key below */
040: #define SNDRV_OSS_SOUNDFONT_PATCH               SNDRV_OSS_PATCHKEY(0x07)
041: 
042:         short device_no;                /* synthesizer number */
043:         unsigned short sf_id;           /* file id (should be zero) */
044:         short optarg;                   /* optional argument */
045:         int len;                        /* data length (without this header) */
046: 
047:         short type;                     /* patch operation type */
048: #define SNDRV_SFNT_LOAD_INFO            0       /* awe_voice_rec */
049: #define SNDRV_SFNT_LOAD_DATA            1       /* awe_sample_info */
050: #define SNDRV_SFNT_OPEN_PATCH   2       /* awe_open_parm */
051: #define SNDRV_SFNT_CLOSE_PATCH  3       /* none */
052:         /* 4 is obsolete */
053: #define SNDRV_SFNT_REPLACE_DATA 5       /* awe_sample_info (optarg=#channels)*/
054: #define SNDRV_SFNT_MAP_PRESET   6       /* awe_voice_map */
055:         /* 7 is not used */
056: #define SNDRV_SFNT_PROBE_DATA           8       /* optarg=sample */
057: #define SNDRV_SFNT_REMOVE_INFO          9       /* optarg=(bank<<8)|instr */
058: 
059:         short reserved;                 /* word alignment data */
060: 
061:         /* the actual patch data begins after this */
062: };
063: 
064: 
065: /*
066:  * open patch
067:  */
068: 
069: #define SNDRV_SFNT_PATCH_NAME_LEN       32
070: 
071: struct soundfont_open_parm {
072:         unsigned short type;            /* sample type */
073: #define SNDRV_SFNT_PAT_TYPE_MISC        0
074: #define SNDRV_SFNT_PAT_TYPE_GUS 6
075: #define SNDRV_SFNT_PAT_TYPE_MAP 7
076: #define SNDRV_SFNT_PAT_LOCKED   0x100   /* lock the samples */
077: #define SNDRV_SFNT_PAT_SHARED   0x200   /* sample is shared */
078: 
079:         short reserved;
080:         char name[SNDRV_SFNT_PATCH_NAME_LEN];
081: };
082: 
083: 
084: /*
085:  * raw voice information record
086:  */
087: 
088: /* wave table envelope & effect parameters to control EMU8000 */
089: struct soundfont_voice_parm {
090:         unsigned short moddelay;        /* modulation delay (0x8000) */
091:         unsigned short modatkhld;       /* modulation attack & hold time (0x7f7f) */
092:         unsigned short moddcysus;       /* modulation decay & sustain (0x7f7f) */
093:         unsigned short modrelease;      /* modulation release time (0x807f) */
094:         short modkeyhold, modkeydecay;  /* envelope change per key (not used) */
095:         unsigned short voldelay;        /* volume delay (0x8000) */
096:         unsigned short volatkhld;       /* volume attack & hold time (0x7f7f) */
097:         unsigned short voldcysus;       /* volume decay & sustain (0x7f7f) */
098:         unsigned short volrelease;      /* volume release time (0x807f) */
099:         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: };
112: 
113: 
114: /* wave table parameters: 92 bytes */
115: struct soundfont_voice_info {
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
127: 
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:         struct soundfont_voice_parm parm;       /* voice envelope parameters */
139:         unsigned short sample_mode;     /* sample mode_flag (set by driver) */
140: };
141: 
142: 
143: /* instrument info header: 4 bytes */
144: struct soundfont_voice_rec_hdr {
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: };
153: 
154: 
155: /*
156:  * sample wave information
157:  */
158: 
159: /* wave table sample header: 32 bytes */
160: struct soundfont_sample_info {
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: };
178: 
179: 
180: /*
181:  * voice preset mapping (aliasing)
182:  */
183: 
184: struct soundfont_voice_map {
185:         int map_bank, map_instr, map_key;       /* key = -1 means all keys */
186:         int src_bank, src_instr, src_key;
187: };
188: 
189: 
190: /*
191:  * ioctls for hwdep
192:  */
193: 
194: #define SNDRV_EMUX_HWDEP_NAME   "Emux WaveTable"
195: 
196: #define SNDRV_EMUX_VERSION      ((1 << 16) | (0 << 8) | 0)      /* 1.0.0 */
197: 
198: struct snd_emux_misc_mode {
199:         int port;       /* -1 = all */
200:         int mode;
201:         int value;
202:         int value2;     /* reserved */
203: };
204: 
205: #define SNDRV_EMUX_IOCTL_VERSION        _IOR('H', 0x80, unsigned int)
206: #define SNDRV_EMUX_IOCTL_LOAD_PATCH     _IOWR('H', 0x81, struct soundfont_patch_info)
207: #define SNDRV_EMUX_IOCTL_RESET_SAMPLES  _IO('H', 0x82)
208: #define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83)
209: #define SNDRV_EMUX_IOCTL_MEM_AVAIL      _IOW('H', 0x84, int)
210: #define SNDRV_EMUX_IOCTL_MISC_MODE      _IOWR('H', 0x84, struct snd_emux_misc_mode)
211: 
212: #endif /* __SOUND_SFNT_INFO_H */
213: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/