1*674e95caSDavid Howells #ifndef __SOUND_ASOUND_FM_H 2*674e95caSDavid Howells #define __SOUND_ASOUND_FM_H 3*674e95caSDavid Howells 4*674e95caSDavid Howells /* 5*674e95caSDavid Howells * Advanced Linux Sound Architecture - ALSA 6*674e95caSDavid Howells * 7*674e95caSDavid Howells * Interface file between ALSA driver & user space 8*674e95caSDavid Howells * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>, 9*674e95caSDavid Howells * 4Front Technologies 10*674e95caSDavid Howells * 11*674e95caSDavid Howells * Direct FM control 12*674e95caSDavid Howells * 13*674e95caSDavid Howells * This program is free software; you can redistribute it and/or modify 14*674e95caSDavid Howells * it under the terms of the GNU General Public License as published by 15*674e95caSDavid Howells * the Free Software Foundation; either version 2 of the License, or 16*674e95caSDavid Howells * (at your option) any later version. 17*674e95caSDavid Howells * 18*674e95caSDavid Howells * This program is distributed in the hope that it will be useful, 19*674e95caSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 20*674e95caSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*674e95caSDavid Howells * GNU General Public License for more details. 22*674e95caSDavid Howells * 23*674e95caSDavid Howells * You should have received a copy of the GNU General Public License 24*674e95caSDavid Howells * along with this program; if not, write to the Free Software 25*674e95caSDavid Howells * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26*674e95caSDavid Howells * 27*674e95caSDavid Howells */ 28*674e95caSDavid Howells 29*674e95caSDavid Howells #define SNDRV_DM_FM_MODE_OPL2 0x00 30*674e95caSDavid Howells #define SNDRV_DM_FM_MODE_OPL3 0x01 31*674e95caSDavid Howells 32*674e95caSDavid Howells struct snd_dm_fm_info { 33*674e95caSDavid Howells unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 34*674e95caSDavid Howells unsigned char rhythm; /* percussion mode flag */ 35*674e95caSDavid Howells }; 36*674e95caSDavid Howells 37*674e95caSDavid Howells /* 38*674e95caSDavid Howells * Data structure composing an FM "note" or sound event. 39*674e95caSDavid Howells */ 40*674e95caSDavid Howells 41*674e95caSDavid Howells struct snd_dm_fm_voice { 42*674e95caSDavid Howells unsigned char op; /* operator cell (0 or 1) */ 43*674e95caSDavid Howells unsigned char voice; /* FM voice (0 to 17) */ 44*674e95caSDavid Howells 45*674e95caSDavid Howells unsigned char am; /* amplitude modulation */ 46*674e95caSDavid Howells unsigned char vibrato; /* vibrato effect */ 47*674e95caSDavid Howells unsigned char do_sustain; /* sustain phase */ 48*674e95caSDavid Howells unsigned char kbd_scale; /* keyboard scaling */ 49*674e95caSDavid Howells unsigned char harmonic; /* 4 bits: harmonic and multiplier */ 50*674e95caSDavid Howells unsigned char scale_level; /* 2 bits: decrease output freq rises */ 51*674e95caSDavid Howells unsigned char volume; /* 6 bits: volume */ 52*674e95caSDavid Howells 53*674e95caSDavid Howells unsigned char attack; /* 4 bits: attack rate */ 54*674e95caSDavid Howells unsigned char decay; /* 4 bits: decay rate */ 55*674e95caSDavid Howells unsigned char sustain; /* 4 bits: sustain level */ 56*674e95caSDavid Howells unsigned char release; /* 4 bits: release rate */ 57*674e95caSDavid Howells 58*674e95caSDavid Howells unsigned char feedback; /* 3 bits: feedback for op0 */ 59*674e95caSDavid Howells unsigned char connection; /* 0 for serial, 1 for parallel */ 60*674e95caSDavid Howells unsigned char left; /* stereo left */ 61*674e95caSDavid Howells unsigned char right; /* stereo right */ 62*674e95caSDavid Howells unsigned char waveform; /* 3 bits: waveform shape */ 63*674e95caSDavid Howells }; 64*674e95caSDavid Howells 65*674e95caSDavid Howells /* 66*674e95caSDavid Howells * This describes an FM note by its voice, octave, frequency number (10bit) 67*674e95caSDavid Howells * and key on/off. 68*674e95caSDavid Howells */ 69*674e95caSDavid Howells 70*674e95caSDavid Howells struct snd_dm_fm_note { 71*674e95caSDavid Howells unsigned char voice; /* 0-17 voice channel */ 72*674e95caSDavid Howells unsigned char octave; /* 3 bits: what octave to play */ 73*674e95caSDavid Howells unsigned int fnum; /* 10 bits: frequency number */ 74*674e95caSDavid Howells unsigned char key_on; /* set for active, clear for silent */ 75*674e95caSDavid Howells }; 76*674e95caSDavid Howells 77*674e95caSDavid Howells /* 78*674e95caSDavid Howells * FM parameters that apply globally to all voices, and thus are not "notes" 79*674e95caSDavid Howells */ 80*674e95caSDavid Howells 81*674e95caSDavid Howells struct snd_dm_fm_params { 82*674e95caSDavid Howells unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 83*674e95caSDavid Howells unsigned char vib_depth; /* vibrato depth (1=hi) */ 84*674e95caSDavid Howells unsigned char kbd_split; /* keyboard split */ 85*674e95caSDavid Howells unsigned char rhythm; /* percussion mode select */ 86*674e95caSDavid Howells 87*674e95caSDavid Howells /* This block is the percussion instrument data */ 88*674e95caSDavid Howells unsigned char bass; 89*674e95caSDavid Howells unsigned char snare; 90*674e95caSDavid Howells unsigned char tomtom; 91*674e95caSDavid Howells unsigned char cymbal; 92*674e95caSDavid Howells unsigned char hihat; 93*674e95caSDavid Howells }; 94*674e95caSDavid Howells 95*674e95caSDavid Howells /* 96*674e95caSDavid Howells * FM mode ioctl settings 97*674e95caSDavid Howells */ 98*674e95caSDavid Howells 99*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) 100*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 101*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) 102*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) 103*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) 104*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 105*674e95caSDavid Howells /* for OPL3 only */ 106*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 107*674e95caSDavid Howells /* SBI patch management */ 108*674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) 109*674e95caSDavid Howells 110*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 111*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 112*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 113*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 114*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 115*674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 116*674e95caSDavid Howells 117*674e95caSDavid Howells /* 118*674e95caSDavid Howells * Patch Record - fixed size for write 119*674e95caSDavid Howells */ 120*674e95caSDavid Howells 121*674e95caSDavid Howells #define FM_KEY_SBI "SBI\032" 122*674e95caSDavid Howells #define FM_KEY_2OP "2OP\032" 123*674e95caSDavid Howells #define FM_KEY_4OP "4OP\032" 124*674e95caSDavid Howells 125*674e95caSDavid Howells struct sbi_patch { 126*674e95caSDavid Howells unsigned char prog; 127*674e95caSDavid Howells unsigned char bank; 128*674e95caSDavid Howells char key[4]; 129*674e95caSDavid Howells char name[25]; 130*674e95caSDavid Howells char extension[7]; 131*674e95caSDavid Howells unsigned char data[32]; 132*674e95caSDavid Howells }; 133*674e95caSDavid Howells 134*674e95caSDavid Howells #endif /* __SOUND_ASOUND_FM_H */ 135