Home | History | Annotate | Download | only in sound
      1 /*
      2  *  Advanced Linux Sound Architecture
      3  *
      4  *  FM (OPL2/3) Instrument Format
      5  *  Copyright (c) 2000 Uros Bizjak <uros (at) kss-loka.si>
      6  *
      7  *
      8  *   This program is free software; you can redistribute it and/or modify
      9  *   it under the terms of the GNU General Public License as published by
     10  *   the Free Software Foundation; either version 2 of the License, or
     11  *   (at your option) any later version.
     12  *
     13  *   This program is distributed in the hope that it will be useful,
     14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *   GNU General Public License for more details.
     17  *
     18  *   You should have received a copy of the GNU General Public License
     19  *   along with this program; if not, write to the Free Software
     20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     21  *
     22  */
     23 
     24 #ifndef __SOUND_AINSTR_FM_H
     25 #define __SOUND_AINSTR_FM_H
     26 
     27 #include "type_compat.h"
     28 
     29 /*
     30  *  share types (share ID 1)
     31  */
     32 
     33 #define FM_SHARE_FILE		0
     34 
     35 /*
     36  * FM operator
     37  */
     38 
     39 typedef struct fm_operator {
     40 	unsigned char am_vib;
     41 	unsigned char ksl_level;
     42 	unsigned char attack_decay;
     43 	unsigned char sustain_release;
     44 	unsigned char wave_select;
     45 } fm_operator_t;
     46 
     47 /*
     48  *  Instrument
     49  */
     50 
     51 #define FM_PATCH_OPL2	0x01		/* OPL2 2 operators FM instrument */
     52 #define FM_PATCH_OPL3	0x02		/* OPL3 4 operators FM instrument */
     53 
     54 typedef struct {
     55 	unsigned int share_id[4];	/* share id - zero = no sharing */
     56 	unsigned char type;		/* instrument type */
     57 
     58 	fm_operator_t op[4];
     59 	unsigned char feedback_connection[2];
     60 
     61 	unsigned char echo_delay;
     62 	unsigned char echo_atten;
     63 	unsigned char chorus_spread;
     64 	unsigned char trnsps;
     65 	unsigned char fix_dur;
     66 	unsigned char modes;
     67 	unsigned char fix_key;
     68 } fm_instrument_t;
     69 
     70 /*
     71  *
     72  *    Kernel <-> user space
     73  *    Hardware (CPU) independent section
     74  *
     75  *    * = zero or more
     76  *    + = one or more
     77  *
     78  *    fm_xinstrument	FM_STRU_INSTR
     79  *
     80  */
     81 
     82 #define FM_STRU_INSTR	__cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
     83 
     84 /*
     85  * FM operator
     86  */
     87 
     88 typedef struct fm_xoperator {
     89 	__u8 am_vib;
     90 	__u8 ksl_level;
     91 	__u8 attack_decay;
     92 	__u8 sustain_release;
     93 	__u8 wave_select;
     94 } fm_xoperator_t;
     95 
     96 /*
     97  *  Instrument
     98  */
     99 
    100 typedef struct fm_xinstrument {
    101 	__u32 stype;			/* structure type */
    102 
    103 	__u32 share_id[4];		/* share id - zero = no sharing */
    104 	__u8 type;			/* instrument type */
    105 
    106 	fm_xoperator_t op[4];		/* fm operators */
    107 	__u8 feedback_connection[2];
    108 
    109 	__u8 echo_delay;
    110 	__u8 echo_atten;
    111 	__u8 chorus_spread;
    112 	__u8 trnsps;
    113 	__u8 fix_dur;
    114 	__u8 modes;
    115 	__u8 fix_key;
    116 } fm_xinstrument_t;
    117 
    118 #ifdef __KERNEL__
    119 
    120 #include "seq_instr.h"
    121 
    122 extern char *snd_seq_fm_id;
    123 
    124 int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops,
    125 		    snd_seq_kinstr_ops_t * next);
    126 
    127 #endif
    128 
    129 #endif	/* __SOUND_AINSTR_FM_H */
    130