1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 #ifndef __SOUND_ASOUND_FM_H
3 #define __SOUND_ASOUND_FM_H
6 * Advanced Linux Sound Architecture - ALSA
8 * Interface file between ALSA driver & user space
9 * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
15 #define SNDRV_DM_FM_MODE_OPL2 0x00
16 #define SNDRV_DM_FM_MODE_OPL3 0x01
18 struct snd_dm_fm_info {
19 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
20 unsigned char rhythm; /* percussion mode flag */
24 * Data structure composing an FM "note" or sound event.
27 struct snd_dm_fm_voice {
28 unsigned char op; /* operator cell (0 or 1) */
29 unsigned char voice; /* FM voice (0 to 17) */
31 unsigned char am; /* amplitude modulation */
32 unsigned char vibrato; /* vibrato effect */
33 unsigned char do_sustain; /* sustain phase */
34 unsigned char kbd_scale; /* keyboard scaling */
35 unsigned char harmonic; /* 4 bits: harmonic and multiplier */
36 unsigned char scale_level; /* 2 bits: decrease output freq rises */
37 unsigned char volume; /* 6 bits: volume */
39 unsigned char attack; /* 4 bits: attack rate */
40 unsigned char decay; /* 4 bits: decay rate */
41 unsigned char sustain; /* 4 bits: sustain level */
42 unsigned char release; /* 4 bits: release rate */
44 unsigned char feedback; /* 3 bits: feedback for op0 */
45 unsigned char connection; /* 0 for serial, 1 for parallel */
46 unsigned char left; /* stereo left */
47 unsigned char right; /* stereo right */
48 unsigned char waveform; /* 3 bits: waveform shape */
52 * This describes an FM note by its voice, octave, frequency number (10bit)
56 struct snd_dm_fm_note {
57 unsigned char voice; /* 0-17 voice channel */
58 unsigned char octave; /* 3 bits: what octave to play */
59 unsigned int fnum; /* 10 bits: frequency number */
60 unsigned char key_on; /* set for active, clear for silent */
64 * FM parameters that apply globally to all voices, and thus are not "notes"
67 struct snd_dm_fm_params {
68 unsigned char am_depth; /* amplitude modulation depth (1=hi) */
69 unsigned char vib_depth; /* vibrato depth (1=hi) */
70 unsigned char kbd_split; /* keyboard split */
71 unsigned char rhythm; /* percussion mode select */
73 /* This block is the percussion instrument data */
82 * FM mode ioctl settings
85 #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
86 #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
87 #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
88 #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
89 #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
90 #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
92 #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
93 /* SBI patch management */
94 #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
96 #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
97 #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
98 #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
99 #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
100 #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
101 #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
104 * Patch Record - fixed size for write
107 #define FM_KEY_SBI "SBI\032"
108 #define FM_KEY_2OP "2OP\032"
109 #define FM_KEY_4OP "4OP\032"
117 unsigned char data[32];
120 #endif /* __SOUND_ASOUND_FM_H */