121 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */2#ifndef __SOUND_ASOUND_FM_H3#define __SOUND_ASOUND_FM_H4 5/*6 * Advanced Linux Sound Architecture - ALSA7 *8 * Interface file between ALSA driver & user space9 * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,10 * 4Front Technologies11 *12 * Direct FM control13 */14 15#define SNDRV_DM_FM_MODE_OPL2 0x0016#define SNDRV_DM_FM_MODE_OPL3 0x0117 18struct snd_dm_fm_info {19 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */20 unsigned char rhythm; /* percussion mode flag */21};22 23/*24 * Data structure composing an FM "note" or sound event.25 */26 27struct snd_dm_fm_voice {28 unsigned char op; /* operator cell (0 or 1) */29 unsigned char voice; /* FM voice (0 to 17) */30 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 */38 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 */43 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 */49};50 51/*52 * This describes an FM note by its voice, octave, frequency number (10bit)53 * and key on/off.54 */55 56struct 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 */61};62 63/*64 * FM parameters that apply globally to all voices, and thus are not "notes"65 */66 67struct 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 */72 73 /* This block is the percussion instrument data */74 unsigned char bass;75 unsigned char snare;76 unsigned char tomtom;77 unsigned char cymbal;78 unsigned char hihat;79};80 81/*82 * FM mode ioctl settings83 */84 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)91/* for OPL3 only */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)95 96#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x2097#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x2198#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x2299#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23100#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24101#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25102 103/*104 * Patch Record - fixed size for write105 */106 107#define FM_KEY_SBI "SBI\032"108#define FM_KEY_2OP "2OP\032"109#define FM_KEY_4OP "4OP\032"110 111struct sbi_patch {112 unsigned char prog;113 unsigned char bank;114 char key[4];115 char name[25];116 char extension[7];117 unsigned char data[32];118};119 120#endif /* __SOUND_ASOUND_FM_H */121