Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / sound / asound_fm.h
blobb0da677f8f7596f0ae97e2107874428cf9404317
1 #ifndef __SOUND_ASOUND_FM_H
2 #define __SOUND_ASOUND_FM_H
4 /*
5 * Advanced Linux Sound Architecture - ALSA
7 * Interface file between ALSA driver & user space
8 * Copyright (c) 1994-98 by Jaroslav Kysela <perex@suse.cz>,
9 * 4Front Technologies
11 * Direct FM control
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.
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.
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
29 #define SNDRV_DM_FM_MODE_OPL2 0x00
30 #define SNDRV_DM_FM_MODE_OPL3 0x01
32 typedef 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 } snd_dm_fm_info_t;
38 * Data structure composing an FM "note" or sound event.
41 typedef struct snd_dm_fm_voice {
42 unsigned char op; /* operator cell (0 or 1) */
43 unsigned char voice; /* FM voice (0 to 17) */
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 */
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 */
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 } snd_dm_fm_voice_t;
66 * This describes an FM note by its voice, octave, frequency number (10bit)
67 * and key on/off.
70 typedef 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 } snd_dm_fm_note_t;
78 * FM parameters that apply globally to all voices, and thus are not "notes"
81 typedef 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 */
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 } snd_dm_fm_params_t;
96 * FM mode ioctl settings
99 #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t)
100 #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
101 #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t)
102 #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t)
103 #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t)
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)
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
115 #endif /* __SOUND_ASOUND_FM_H */