Blame include/sound/asound_fm.h

Packit 4a16fb
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
Packit 4a16fb
#ifndef __SOUND_ASOUND_FM_H
Packit 4a16fb
#define __SOUND_ASOUND_FM_H
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 *  Advanced Linux Sound Architecture - ALSA
Packit 4a16fb
 *
Packit 4a16fb
 *  Interface file between ALSA driver & user space
Packit 4a16fb
 *  Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
Packit 4a16fb
 *                           4Front Technologies
Packit 4a16fb
 *
Packit 4a16fb
 *  Direct FM control
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is free software; you can redistribute it and/or modify
Packit 4a16fb
 *   it under the terms of the GNU General Public License as published by
Packit 4a16fb
 *   the Free Software Foundation; either version 2 of the License, or
Packit 4a16fb
 *   (at your option) any later version.
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is distributed in the hope that it will be useful,
Packit 4a16fb
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
 *   GNU General Public License for more details.
Packit 4a16fb
 *
Packit 4a16fb
 *   You should have received a copy of the GNU General Public License
Packit 4a16fb
 *   along with this program; if not, write to the Free Software
Packit 4a16fb
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Packit 4a16fb
 *
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#define SNDRV_DM_FM_MODE_OPL2	0x00
Packit 4a16fb
#define SNDRV_DM_FM_MODE_OPL3	0x01
Packit 4a16fb
Packit 4a16fb
struct snd_dm_fm_info {
Packit 4a16fb
	unsigned char fm_mode;		/* OPL mode, see SNDRV_DM_FM_MODE_XXX */
Packit 4a16fb
	unsigned char rhythm;		/* percussion mode flag */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 *  Data structure composing an FM "note" or sound event.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
struct snd_dm_fm_voice {
Packit 4a16fb
	unsigned char op;		/* operator cell (0 or 1) */
Packit 4a16fb
	unsigned char voice;		/* FM voice (0 to 17) */
Packit 4a16fb
Packit 4a16fb
	unsigned char am;		/* amplitude modulation */
Packit 4a16fb
	unsigned char vibrato;		/* vibrato effect */
Packit 4a16fb
	unsigned char do_sustain;	/* sustain phase */
Packit 4a16fb
	unsigned char kbd_scale;	/* keyboard scaling */
Packit 4a16fb
	unsigned char harmonic;		/* 4 bits: harmonic and multiplier */
Packit 4a16fb
	unsigned char scale_level;	/* 2 bits: decrease output freq rises */
Packit 4a16fb
	unsigned char volume;		/* 6 bits: volume */
Packit 4a16fb
Packit 4a16fb
	unsigned char attack;		/* 4 bits: attack rate */
Packit 4a16fb
	unsigned char decay;		/* 4 bits: decay rate */
Packit 4a16fb
	unsigned char sustain;		/* 4 bits: sustain level */
Packit 4a16fb
	unsigned char release;		/* 4 bits: release rate */
Packit 4a16fb
Packit 4a16fb
	unsigned char feedback;		/* 3 bits: feedback for op0 */
Packit 4a16fb
	unsigned char connection;	/* 0 for serial, 1 for parallel */
Packit 4a16fb
	unsigned char left;		/* stereo left */
Packit 4a16fb
	unsigned char right;		/* stereo right */
Packit 4a16fb
	unsigned char waveform;		/* 3 bits: waveform shape */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 *  This describes an FM note by its voice, octave, frequency number (10bit)
Packit 4a16fb
 *  and key on/off.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
struct snd_dm_fm_note {
Packit 4a16fb
	unsigned char voice;	/* 0-17 voice channel */
Packit 4a16fb
	unsigned char octave;	/* 3 bits: what octave to play */
Packit 4a16fb
	unsigned int fnum;	/* 10 bits: frequency number */
Packit 4a16fb
	unsigned char key_on;	/* set for active, clear for silent */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 *  FM parameters that apply globally to all voices, and thus are not "notes"
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
struct snd_dm_fm_params {
Packit 4a16fb
	unsigned char am_depth;		/* amplitude modulation depth (1=hi) */
Packit 4a16fb
	unsigned char vib_depth;	/* vibrato depth (1=hi) */
Packit 4a16fb
	unsigned char kbd_split;	/* keyboard split */
Packit 4a16fb
	unsigned char rhythm;		/* percussion mode select */
Packit 4a16fb
Packit 4a16fb
	/* This block is the percussion instrument data */
Packit 4a16fb
	unsigned char bass;
Packit 4a16fb
	unsigned char snare;
Packit 4a16fb
	unsigned char tomtom;
Packit 4a16fb
	unsigned char cymbal;
Packit 4a16fb
	unsigned char hihat;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 *  FM mode ioctl settings
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_INFO		_IOR('H', 0x20, struct snd_dm_fm_info)
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_RESET		_IO ('H', 0x21)
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE	_IOW('H', 0x22, struct snd_dm_fm_note)
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_SET_VOICE	_IOW('H', 0x23, struct snd_dm_fm_voice)
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_SET_PARAMS	_IOW('H', 0x24, struct snd_dm_fm_params)
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_SET_MODE	_IOW('H', 0x25, int)
Packit 4a16fb
/* for OPL3 only */
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION	_IOW('H', 0x26, int)
Packit 4a16fb
/* SBI patch management */
Packit 4a16fb
#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES	_IO ('H', 0x40)
Packit 4a16fb
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_RESET		0x20
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE		0x21
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE		0x22
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS	0x23
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE		0x24
Packit 4a16fb
#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL		0x25
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 * Patch Record - fixed size for write
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#define FM_KEY_SBI	"SBI\032"
Packit 4a16fb
#define FM_KEY_2OP	"2OP\032"
Packit 4a16fb
#define FM_KEY_4OP	"4OP\032"
Packit 4a16fb
Packit 4a16fb
struct sbi_patch {
Packit 4a16fb
	unsigned char prog;
Packit 4a16fb
	unsigned char bank;
Packit 4a16fb
	char key[4];
Packit 4a16fb
	char name[25];
Packit 4a16fb
	char extension[7];
Packit 4a16fb
	unsigned char data[32];
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#endif /* __SOUND_ASOUND_FM_H */