162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 262306a36Sopenharmony_ci#ifndef __SOUND_SFNT_INFO_H 362306a36Sopenharmony_ci#define __SOUND_SFNT_INFO_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci/* 662306a36Sopenharmony_ci * Patch record compatible with AWE driver on OSS 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (C) 1999-2000 Takashi Iwai 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <sound/asound.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci * patch information record 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifdef SNDRV_BIG_ENDIAN 1862306a36Sopenharmony_ci#define SNDRV_OSS_PATCHKEY(id) (0xfd00|id) 1962306a36Sopenharmony_ci#else 2062306a36Sopenharmony_ci#define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd) 2162306a36Sopenharmony_ci#endif 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* patch interface header: 16 bytes */ 2462306a36Sopenharmony_cistruct soundfont_patch_info { 2562306a36Sopenharmony_ci unsigned short key; /* use the key below */ 2662306a36Sopenharmony_ci#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci short device_no; /* synthesizer number */ 2962306a36Sopenharmony_ci unsigned short sf_id; /* file id (should be zero) */ 3062306a36Sopenharmony_ci short optarg; /* optional argument */ 3162306a36Sopenharmony_ci int len; /* data length (without this header) */ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci short type; /* patch operation type */ 3462306a36Sopenharmony_ci#define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */ 3562306a36Sopenharmony_ci#define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */ 3662306a36Sopenharmony_ci#define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */ 3762306a36Sopenharmony_ci#define SNDRV_SFNT_CLOSE_PATCH 3 /* none */ 3862306a36Sopenharmony_ci /* 4 is obsolete */ 3962306a36Sopenharmony_ci#define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ 4062306a36Sopenharmony_ci#define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */ 4162306a36Sopenharmony_ci /* 7 is not used */ 4262306a36Sopenharmony_ci#define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */ 4362306a36Sopenharmony_ci#define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */ 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci short reserved; /* word alignment data */ 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci /* the actual patch data begins after this */ 4862306a36Sopenharmony_ci}; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* 5262306a36Sopenharmony_ci * open patch 5362306a36Sopenharmony_ci */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define SNDRV_SFNT_PATCH_NAME_LEN 32 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistruct soundfont_open_parm { 5862306a36Sopenharmony_ci unsigned short type; /* sample type */ 5962306a36Sopenharmony_ci#define SNDRV_SFNT_PAT_TYPE_MISC 0 6062306a36Sopenharmony_ci#define SNDRV_SFNT_PAT_TYPE_GUS 6 6162306a36Sopenharmony_ci#define SNDRV_SFNT_PAT_TYPE_MAP 7 6262306a36Sopenharmony_ci#define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */ 6362306a36Sopenharmony_ci#define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */ 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci short reserved; 6662306a36Sopenharmony_ci char name[SNDRV_SFNT_PATCH_NAME_LEN]; 6762306a36Sopenharmony_ci}; 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci/* 7162306a36Sopenharmony_ci * raw voice information record 7262306a36Sopenharmony_ci */ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* wave table envelope & effect parameters to control EMU8000 */ 7562306a36Sopenharmony_cistruct soundfont_voice_parm { 7662306a36Sopenharmony_ci unsigned short moddelay; /* modulation delay (0x8000) */ 7762306a36Sopenharmony_ci unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 7862306a36Sopenharmony_ci unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 7962306a36Sopenharmony_ci unsigned short modrelease; /* modulation release time (0x807f) */ 8062306a36Sopenharmony_ci short modkeyhold, modkeydecay; /* envelope change per key (not used) */ 8162306a36Sopenharmony_ci unsigned short voldelay; /* volume delay (0x8000) */ 8262306a36Sopenharmony_ci unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ 8362306a36Sopenharmony_ci unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ 8462306a36Sopenharmony_ci unsigned short volrelease; /* volume release time (0x807f) */ 8562306a36Sopenharmony_ci short volkeyhold, volkeydecay; /* envelope change per key (not used) */ 8662306a36Sopenharmony_ci unsigned short lfo1delay; /* LFO1 delay (0x8000) */ 8762306a36Sopenharmony_ci unsigned short lfo2delay; /* LFO2 delay (0x8000) */ 8862306a36Sopenharmony_ci unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ 8962306a36Sopenharmony_ci unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ 9062306a36Sopenharmony_ci unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ 9162306a36Sopenharmony_ci unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ 9262306a36Sopenharmony_ci unsigned char cutoff; /* initial cutoff (0xff) */ 9362306a36Sopenharmony_ci unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ 9462306a36Sopenharmony_ci unsigned char chorus; /* chorus send (0x00) */ 9562306a36Sopenharmony_ci unsigned char reverb; /* reverb send (0x00) */ 9662306a36Sopenharmony_ci unsigned short reserved[4]; /* not used */ 9762306a36Sopenharmony_ci}; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* wave table parameters: 92 bytes */ 10162306a36Sopenharmony_cistruct soundfont_voice_info { 10262306a36Sopenharmony_ci unsigned short sf_id; /* file id (should be zero) */ 10362306a36Sopenharmony_ci unsigned short sample; /* sample id */ 10462306a36Sopenharmony_ci int start, end; /* sample offset correction */ 10562306a36Sopenharmony_ci int loopstart, loopend; /* loop offset correction */ 10662306a36Sopenharmony_ci short rate_offset; /* sample rate pitch offset */ 10762306a36Sopenharmony_ci unsigned short mode; /* sample mode */ 10862306a36Sopenharmony_ci#define SNDRV_SFNT_MODE_ROMSOUND 0x8000 10962306a36Sopenharmony_ci#define SNDRV_SFNT_MODE_STEREO 1 11062306a36Sopenharmony_ci#define SNDRV_SFNT_MODE_LOOPING 2 11162306a36Sopenharmony_ci#define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */ 11262306a36Sopenharmony_ci#define SNDRV_SFNT_MODE_INIT_PARM 8 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci short root; /* midi root key */ 11562306a36Sopenharmony_ci short tune; /* pitch tuning (in cents) */ 11662306a36Sopenharmony_ci unsigned char low, high; /* key note range */ 11762306a36Sopenharmony_ci unsigned char vellow, velhigh; /* velocity range */ 11862306a36Sopenharmony_ci signed char fixkey, fixvel; /* fixed key, velocity */ 11962306a36Sopenharmony_ci signed char pan, fixpan; /* panning, fixed panning */ 12062306a36Sopenharmony_ci short exclusiveClass; /* exclusive class (0 = none) */ 12162306a36Sopenharmony_ci unsigned char amplitude; /* sample volume (127 max) */ 12262306a36Sopenharmony_ci unsigned char attenuation; /* attenuation (0.375dB) */ 12362306a36Sopenharmony_ci short scaleTuning; /* pitch scale tuning(%), normally 100 */ 12462306a36Sopenharmony_ci struct soundfont_voice_parm parm; /* voice envelope parameters */ 12562306a36Sopenharmony_ci unsigned short sample_mode; /* sample mode_flag (set by driver) */ 12662306a36Sopenharmony_ci}; 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* instrument info header: 4 bytes */ 13062306a36Sopenharmony_cistruct soundfont_voice_rec_hdr { 13162306a36Sopenharmony_ci unsigned char bank; /* midi bank number */ 13262306a36Sopenharmony_ci unsigned char instr; /* midi preset number */ 13362306a36Sopenharmony_ci char nvoices; /* number of voices */ 13462306a36Sopenharmony_ci char write_mode; /* write mode; normally 0 */ 13562306a36Sopenharmony_ci#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 13662306a36Sopenharmony_ci#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 13762306a36Sopenharmony_ci#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 13862306a36Sopenharmony_ci}; 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci/* 14262306a36Sopenharmony_ci * sample wave information 14362306a36Sopenharmony_ci */ 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci/* wave table sample header: 32 bytes */ 14662306a36Sopenharmony_cistruct soundfont_sample_info { 14762306a36Sopenharmony_ci unsigned short sf_id; /* file id (should be zero) */ 14862306a36Sopenharmony_ci unsigned short sample; /* sample id */ 14962306a36Sopenharmony_ci int start, end; /* start & end offset */ 15062306a36Sopenharmony_ci int loopstart, loopend; /* loop start & end offset */ 15162306a36Sopenharmony_ci int size; /* size (0 = ROM) */ 15262306a36Sopenharmony_ci short dummy; /* not used */ 15362306a36Sopenharmony_ci unsigned short mode_flags; /* mode flags */ 15462306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */ 15562306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ 15662306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ 15762306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ 15862306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ 15962306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ 16062306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 16162306a36Sopenharmony_ci#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 16262306a36Sopenharmony_ci unsigned int truesize; /* used memory size (set by driver) */ 16362306a36Sopenharmony_ci}; 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci/* 16762306a36Sopenharmony_ci * voice preset mapping (aliasing) 16862306a36Sopenharmony_ci */ 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_cistruct soundfont_voice_map { 17162306a36Sopenharmony_ci int map_bank, map_instr, map_key; /* key = -1 means all keys */ 17262306a36Sopenharmony_ci int src_bank, src_instr, src_key; 17362306a36Sopenharmony_ci}; 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* 17762306a36Sopenharmony_ci * ioctls for hwdep 17862306a36Sopenharmony_ci */ 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable" 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_cistruct snd_emux_misc_mode { 18562306a36Sopenharmony_ci int port; /* -1 = all */ 18662306a36Sopenharmony_ci int mode; 18762306a36Sopenharmony_ci int value; 18862306a36Sopenharmony_ci int value2; /* reserved */ 18962306a36Sopenharmony_ci}; 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int) 19262306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info) 19362306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82) 19462306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83) 19562306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int) 19662306a36Sopenharmony_ci#define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode) 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ci#endif /* __SOUND_SFNT_INFO_H */ 199