Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


asound_fm.h
001: #ifndef __SOUND_ASOUND_FM_H
002: #define __SOUND_ASOUND_FM_H
003: 
004: /*
005:  *  Advanced Linux Sound Architecture - ALSA
006:  *
007:  *  Interface file between ALSA driver & user space
008:  *  Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
009:  *                           4Front Technologies
010:  *
011:  *  Direct FM control
012:  *
013:  *   This program is free software; you can redistribute it and/or modify
014:  *   it under the terms of the GNU General Public License as published by
015:  *   the Free Software Foundation; either version 2 of the License, or
016:  *   (at your option) any later version.
017:  *
018:  *   This program is distributed in the hope that it will be useful,
019:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
020:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021:  *   GNU General Public License for more details.
022:  *
023:  *   You should have received a copy of the GNU General Public License
024:  *   along with this program; if not, write to the Free Software
025:  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
026:  *
027:  */
028: 
029: #define SNDRV_DM_FM_MODE_OPL2   0x00
030: #define SNDRV_DM_FM_MODE_OPL3   0x01
031: 
032: struct snd_dm_fm_info {
033:         unsigned char fm_mode;          /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
034:         unsigned char rhythm;           /* percussion mode flag */
035: };
036: 
037: /*
038:  *  Data structure composing an FM "note" or sound event.
039:  */
040: 
041: struct snd_dm_fm_voice {
042:         unsigned char op;               /* operator cell (0 or 1) */
043:         unsigned char voice;            /* FM voice (0 to 17) */
044: 
045:         unsigned char am;               /* amplitude modulation */
046:         unsigned char vibrato;          /* vibrato effect */
047:         unsigned char do_sustain;       /* sustain phase */
048:         unsigned char kbd_scale;        /* keyboard scaling */
049:         unsigned char harmonic;         /* 4 bits: harmonic and multiplier */
050:         unsigned char scale_level;      /* 2 bits: decrease output freq rises */
051:         unsigned char volume;           /* 6 bits: volume */
052: 
053:         unsigned char attack;           /* 4 bits: attack rate */
054:         unsigned char decay;            /* 4 bits: decay rate */
055:         unsigned char sustain;          /* 4 bits: sustain level */
056:         unsigned char release;          /* 4 bits: release rate */
057: 
058:         unsigned char feedback;         /* 3 bits: feedback for op0 */
059:         unsigned char connection;       /* 0 for serial, 1 for parallel */
060:         unsigned char left;             /* stereo left */
061:         unsigned char right;            /* stereo right */
062:         unsigned char waveform;         /* 3 bits: waveform shape */
063: };
064: 
065: /*
066:  *  This describes an FM note by its voice, octave, frequency number (10bit)
067:  *  and key on/off.
068:  */
069: 
070: struct snd_dm_fm_note {
071:         unsigned char voice;    /* 0-17 voice channel */
072:         unsigned char octave;   /* 3 bits: what octave to play */
073:         unsigned int fnum;      /* 10 bits: frequency number */
074:         unsigned char key_on;   /* set for active, clear for silent */
075: };
076: 
077: /*
078:  *  FM parameters that apply globally to all voices, and thus are not "notes"
079:  */
080: 
081: struct snd_dm_fm_params {
082:         unsigned char am_depth;         /* amplitude modulation depth (1=hi) */
083:         unsigned char vib_depth;        /* vibrato depth (1=hi) */
084:         unsigned char kbd_split;        /* keyboard split */
085:         unsigned char rhythm;           /* percussion mode select */
086: 
087:         /* This block is the percussion instrument data */
088:         unsigned char bass;
089:         unsigned char snare;
090:         unsigned char tomtom;
091:         unsigned char cymbal;
092:         unsigned char hihat;
093: };
094: 
095: /*
096:  *  FM mode ioctl settings
097:  */
098: 
099: #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: /* SBI patch management */
108: #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
109: 
110: #define SNDRV_DM_FM_OSS_IOCTL_RESET             0x20
111: #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE         0x21
112: #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE         0x22
113: #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS        0x23
114: #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE          0x24
115: #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL           0x25
116: 
117: /*
118:  * Patch Record - fixed size for write
119:  */
120: 
121: #define FM_KEY_SBI      "SBI\032"
122: #define FM_KEY_2OP      "2OP\032"
123: #define FM_KEY_4OP      "4OP\032"
124: 
125: struct sbi_patch {
126:         unsigned char prog;
127:         unsigned char bank;
128:         char key[4];
129:         char name[25];
130:         char extension[7];
131:         unsigned char data[32];
132: };
133: 
134: #endif /* __SOUND_ASOUND_FM_H */
135: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/