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