Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Advanced Linux Sound Architecture |
| 3 | * |
| 4 | * FM (OPL2/3) Instrument Format |
| 5 | * Copyright (c) 2000 Uros Bizjak <uros@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 | #ifndef __KERNEL__ |
| 28 | #include <asm/types.h> |
| 29 | #include <asm/byteorder.h> |
| 30 | #endif |
| 31 | |
| 32 | /* |
| 33 | * share types (share ID 1) |
| 34 | */ |
| 35 | |
| 36 | #define FM_SHARE_FILE 0 |
| 37 | |
| 38 | /* |
| 39 | * FM operator |
| 40 | */ |
| 41 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 42 | struct fm_operator { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | unsigned char am_vib; |
| 44 | unsigned char ksl_level; |
| 45 | unsigned char attack_decay; |
| 46 | unsigned char sustain_release; |
| 47 | unsigned char wave_select; |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 48 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | * Instrument |
| 52 | */ |
| 53 | |
| 54 | #define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ |
| 55 | #define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ |
| 56 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 57 | struct fm_instrument { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | unsigned int share_id[4]; /* share id - zero = no sharing */ |
| 59 | unsigned char type; /* instrument type */ |
| 60 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 61 | struct fm_operator op[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | unsigned char feedback_connection[2]; |
| 63 | |
| 64 | unsigned char echo_delay; |
| 65 | unsigned char echo_atten; |
| 66 | unsigned char chorus_spread; |
| 67 | unsigned char trnsps; |
| 68 | unsigned char fix_dur; |
| 69 | unsigned char modes; |
| 70 | unsigned char fix_key; |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 71 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | |
| 73 | /* |
| 74 | * |
| 75 | * Kernel <-> user space |
| 76 | * Hardware (CPU) independent section |
| 77 | * |
| 78 | * * = zero or more |
| 79 | * + = one or more |
| 80 | * |
| 81 | * fm_xinstrument FM_STRU_INSTR |
| 82 | * |
| 83 | */ |
| 84 | |
| 85 | #define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T') |
| 86 | |
| 87 | /* |
| 88 | * FM operator |
| 89 | */ |
| 90 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 91 | struct fm_xoperator { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | __u8 am_vib; |
| 93 | __u8 ksl_level; |
| 94 | __u8 attack_decay; |
| 95 | __u8 sustain_release; |
| 96 | __u8 wave_select; |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 97 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * Instrument |
| 101 | */ |
| 102 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 103 | struct fm_xinstrument { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | __u32 stype; /* structure type */ |
| 105 | |
| 106 | __u32 share_id[4]; /* share id - zero = no sharing */ |
| 107 | __u8 type; /* instrument type */ |
| 108 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 109 | struct fm_xoperator op[4]; /* fm operators */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | __u8 feedback_connection[2]; |
| 111 | |
| 112 | __u8 echo_delay; |
| 113 | __u8 echo_atten; |
| 114 | __u8 chorus_spread; |
| 115 | __u8 trnsps; |
| 116 | __u8 fix_dur; |
| 117 | __u8 modes; |
| 118 | __u8 fix_key; |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 119 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
| 121 | #ifdef __KERNEL__ |
| 122 | |
| 123 | #include "seq_instr.h" |
| 124 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 125 | int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops, |
| 126 | struct snd_seq_kinstr_ops * next); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | #endif |
| 129 | |
Takashi Iwai | 19ac31e | 2005-11-17 14:04:44 +0100 | [diff] [blame] | 130 | /* typedefs for compatibility to user-space */ |
| 131 | typedef struct fm_xoperator fm_xoperator_t; |
| 132 | typedef struct fm_xinstrument fm_xinstrument_t; |
| 133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | #endif /* __SOUND_AINSTR_FM_H */ |