aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/opl4
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/opl4')
-rw-r--r--sound/drivers/opl4/Makefile18
-rw-r--r--sound/drivers/opl4/opl4_lib.c281
-rw-r--r--sound/drivers/opl4/opl4_local.h232
-rw-r--r--sound/drivers/opl4/opl4_mixer.c95
-rw-r--r--sound/drivers/opl4/opl4_proc.c166
-rw-r--r--sound/drivers/opl4/opl4_seq.c223
-rw-r--r--sound/drivers/opl4/opl4_synth.c630
-rw-r--r--sound/drivers/opl4/yrw801.c961
8 files changed, 2606 insertions, 0 deletions
diff --git a/sound/drivers/opl4/Makefile b/sound/drivers/opl4/Makefile
new file mode 100644
index 000000000000..141aacbaf315
--- /dev/null
+++ b/sound/drivers/opl4/Makefile
@@ -0,0 +1,18 @@
1#
2# Makefile for ALSA
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4#
5
6snd-opl4-lib-objs := opl4_lib.o opl4_mixer.o opl4_proc.o
7snd-opl4-synth-objs := opl4_seq.o opl4_synth.o yrw801.o
8
9#
10# this function returns:
11# "m" - CONFIG_SND_SEQUENCER is m
12# <empty string> - CONFIG_SND_SEQUENCER is undefined
13# otherwise parameter #1 value
14#
15sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
16
17obj-$(CONFIG_SND_OPL4_LIB) += snd-opl4-lib.o
18obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-opl4-synth.o
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c
new file mode 100644
index 000000000000..8261464dade8
--- /dev/null
+++ b/sound/drivers/opl4/opl4_lib.c
@@ -0,0 +1,281 @@
1/*
2 * Functions for accessing OPL4 devices
3 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include "opl4_local.h"
21#include <sound/initval.h>
22#include <linux/ioport.h>
23#include <linux/init.h>
24#include <asm/io.h>
25
26MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
27MODULE_DESCRIPTION("OPL4 driver");
28MODULE_LICENSE("GPL");
29
30static void inline snd_opl4_wait(opl4_t *opl4)
31{
32 int timeout = 10;
33 while ((inb(opl4->fm_port) & OPL4_STATUS_BUSY) && --timeout > 0)
34 ;
35}
36
37void snd_opl4_write(opl4_t *opl4, u8 reg, u8 value)
38{
39 snd_opl4_wait(opl4);
40 outb(reg, opl4->pcm_port);
41
42 snd_opl4_wait(opl4);
43 outb(value, opl4->pcm_port + 1);
44}
45
46u8 snd_opl4_read(opl4_t *opl4, u8 reg)
47{
48 snd_opl4_wait(opl4);
49 outb(reg, opl4->pcm_port);
50
51 snd_opl4_wait(opl4);
52 return inb(opl4->pcm_port + 1);
53}
54
55void snd_opl4_read_memory(opl4_t *opl4, char *buf, int offset, int size)
56{
57 unsigned long flags;
58 u8 memcfg;
59
60 spin_lock_irqsave(&opl4->reg_lock, flags);
61
62 memcfg = snd_opl4_read(opl4, OPL4_REG_MEMORY_CONFIGURATION);
63 snd_opl4_write(opl4, OPL4_REG_MEMORY_CONFIGURATION, memcfg | OPL4_MODE_BIT);
64
65 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_HIGH, offset >> 16);
66 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_MID, offset >> 8);
67 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_LOW, offset);
68
69 snd_opl4_wait(opl4);
70 outb(OPL4_REG_MEMORY_DATA, opl4->pcm_port);
71 snd_opl4_wait(opl4);
72 insb(opl4->pcm_port + 1, buf, size);
73
74 snd_opl4_write(opl4, OPL4_REG_MEMORY_CONFIGURATION, memcfg);
75
76 spin_unlock_irqrestore(&opl4->reg_lock, flags);
77}
78
79void snd_opl4_write_memory(opl4_t *opl4, const char *buf, int offset, int size)
80{
81 unsigned long flags;
82 u8 memcfg;
83
84 spin_lock_irqsave(&opl4->reg_lock, flags);
85
86 memcfg = snd_opl4_read(opl4, OPL4_REG_MEMORY_CONFIGURATION);
87 snd_opl4_write(opl4, OPL4_REG_MEMORY_CONFIGURATION, memcfg | OPL4_MODE_BIT);
88
89 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_HIGH, offset >> 16);
90 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_MID, offset >> 8);
91 snd_opl4_write(opl4, OPL4_REG_MEMORY_ADDRESS_LOW, offset);
92
93 snd_opl4_wait(opl4);
94 outb(OPL4_REG_MEMORY_DATA, opl4->pcm_port);
95 snd_opl4_wait(opl4);
96 outsb(opl4->pcm_port + 1, buf, size);
97
98 snd_opl4_write(opl4, OPL4_REG_MEMORY_CONFIGURATION, memcfg);
99
100 spin_unlock_irqrestore(&opl4->reg_lock, flags);
101}
102
103static void snd_opl4_enable_opl4(opl4_t *opl4)
104{
105 outb(OPL3_REG_MODE, opl4->fm_port + 2);
106 inb(opl4->fm_port);
107 inb(opl4->fm_port);
108 outb(OPL3_OPL3_ENABLE | OPL3_OPL4_ENABLE, opl4->fm_port + 3);
109 inb(opl4->fm_port);
110 inb(opl4->fm_port);
111}
112
113static int snd_opl4_detect(opl4_t *opl4)
114{
115 u8 id1, id2;
116
117 snd_opl4_enable_opl4(opl4);
118
119 id1 = snd_opl4_read(opl4, OPL4_REG_MEMORY_CONFIGURATION);
120 snd_printdd("OPL4[02]=%02x\n", id1);
121 switch (id1 & OPL4_DEVICE_ID_MASK) {
122 case 0x20:
123 opl4->hardware = OPL3_HW_OPL4;
124 break;
125 case 0x40:
126 opl4->hardware = OPL3_HW_OPL4_ML;
127 break;
128 default:
129 return -ENODEV;
130 }
131
132 snd_opl4_write(opl4, OPL4_REG_MIX_CONTROL_FM, 0x00);
133 snd_opl4_write(opl4, OPL4_REG_MIX_CONTROL_PCM, 0xff);
134 id1 = snd_opl4_read(opl4, OPL4_REG_MIX_CONTROL_FM);
135 id2 = snd_opl4_read(opl4, OPL4_REG_MIX_CONTROL_PCM);
136 snd_printdd("OPL4 id1=%02x id2=%02x\n", id1, id2);
137 if (id1 != 0x00 || id2 != 0xff)
138 return -ENODEV;
139
140 snd_opl4_write(opl4, OPL4_REG_MIX_CONTROL_FM, 0x3f);
141 snd_opl4_write(opl4, OPL4_REG_MIX_CONTROL_PCM, 0x3f);
142 snd_opl4_write(opl4, OPL4_REG_MEMORY_CONFIGURATION, 0x00);
143 return 0;
144}
145
146#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
147static void snd_opl4_seq_dev_free(snd_seq_device_t *seq_dev)
148{
149 opl4_t *opl4 = seq_dev->private_data;
150 opl4->seq_dev = NULL;
151}
152
153static int snd_opl4_create_seq_dev(opl4_t *opl4, int seq_device)
154{
155 opl4->seq_dev_num = seq_device;
156 if (snd_seq_device_new(opl4->card, seq_device, SNDRV_SEQ_DEV_ID_OPL4,
157 sizeof(opl4_t *), &opl4->seq_dev) >= 0) {
158 strcpy(opl4->seq_dev->name, "OPL4 Wavetable");
159 *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(opl4->seq_dev) = opl4;
160 opl4->seq_dev->private_data = opl4;
161 opl4->seq_dev->private_free = snd_opl4_seq_dev_free;
162 }
163 return 0;
164}
165#endif
166
167static void snd_opl4_free(opl4_t *opl4)
168{
169#ifdef CONFIG_PROC_FS
170 snd_opl4_free_proc(opl4);
171#endif
172 if (opl4->res_fm_port) {
173 release_resource(opl4->res_fm_port);
174 kfree_nocheck(opl4->res_fm_port);
175 }
176 if (opl4->res_pcm_port) {
177 release_resource(opl4->res_pcm_port);
178 kfree_nocheck(opl4->res_pcm_port);
179 }
180 kfree(opl4);
181}
182
183static int snd_opl4_dev_free(snd_device_t *device)
184{
185 opl4_t *opl4 = device->device_data;
186 snd_opl4_free(opl4);
187 return 0;
188}
189
190int snd_opl4_create(snd_card_t *card,
191 unsigned long fm_port, unsigned long pcm_port,
192 int seq_device,
193 opl3_t **ropl3, opl4_t **ropl4)
194{
195 opl4_t *opl4;
196 opl3_t *opl3;
197 int err;
198 static snd_device_ops_t ops = {
199 .dev_free = snd_opl4_dev_free
200 };
201
202 if (ropl3)
203 *ropl3 = NULL;
204 if (ropl4)
205 *ropl4 = NULL;
206
207 opl4 = kcalloc(1, sizeof(*opl4), GFP_KERNEL);
208 if (!opl4)
209 return -ENOMEM;
210
211 opl4->res_fm_port = request_region(fm_port, 8, "OPL4 FM");
212 opl4->res_pcm_port = request_region(pcm_port, 8, "OPL4 PCM/MIX");
213 if (!opl4->res_fm_port || !opl4->res_pcm_port) {
214 snd_printk(KERN_ERR "opl4: can't grab ports 0x%lx, 0x%lx\n", fm_port, pcm_port);
215 snd_opl4_free(opl4);
216 return -EBUSY;
217 }
218
219 opl4->card = card;
220 opl4->fm_port = fm_port;
221 opl4->pcm_port = pcm_port;
222 spin_lock_init(&opl4->reg_lock);
223 init_MUTEX(&opl4->access_mutex);
224
225 err = snd_opl4_detect(opl4);
226 if (err < 0) {
227 snd_opl4_free(opl4);
228 snd_printd("OPL4 chip not detected at %#lx/%#lx\n", fm_port, pcm_port);
229 return err;
230 }
231
232 err = snd_device_new(card, SNDRV_DEV_CODEC, opl4, &ops);
233 if (err < 0) {
234 snd_opl4_free(opl4);
235 return err;
236 }
237
238 err = snd_opl3_create(card, fm_port, fm_port + 2, opl4->hardware, 1, &opl3);
239 if (err < 0) {
240 snd_device_free(card, opl4);
241 return err;
242 }
243
244 /* opl3 initialization disabled opl4, so reenable */
245 snd_opl4_enable_opl4(opl4);
246
247 snd_opl4_create_mixer(opl4);
248#ifdef CONFIG_PROC_FS
249 snd_opl4_create_proc(opl4);
250#endif
251
252#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
253 opl4->seq_client = -1;
254 if (opl4->hardware < OPL3_HW_OPL4_ML)
255 snd_opl4_create_seq_dev(opl4, seq_device);
256#endif
257
258 if (ropl3)
259 *ropl3 = opl3;
260 if (ropl4)
261 *ropl4 = opl4;
262 return 0;
263}
264
265EXPORT_SYMBOL(snd_opl4_write);
266EXPORT_SYMBOL(snd_opl4_read);
267EXPORT_SYMBOL(snd_opl4_write_memory);
268EXPORT_SYMBOL(snd_opl4_read_memory);
269EXPORT_SYMBOL(snd_opl4_create);
270
271static int __init alsa_opl4_init(void)
272{
273 return 0;
274}
275
276static void __exit alsa_opl4_exit(void)
277{
278}
279
280module_init(alsa_opl4_init)
281module_exit(alsa_opl4_exit)
diff --git a/sound/drivers/opl4/opl4_local.h b/sound/drivers/opl4/opl4_local.h
new file mode 100644
index 000000000000..c455680843f6
--- /dev/null
+++ b/sound/drivers/opl4/opl4_local.h
@@ -0,0 +1,232 @@
1/*
2 * Local definitions for the OPL4 driver
3 *
4 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * Alternatively, this software may be distributed and/or modified under the
17 * terms of the GNU General Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at your option) any later
19 * version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef __OPL4_LOCAL_H
35#define __OPL4_LOCAL_H
36
37#include <sound/opl4.h>
38
39/*
40 * Register numbers
41 */
42
43#define OPL4_REG_TEST0 0x00
44#define OPL4_REG_TEST1 0x01
45
46#define OPL4_REG_MEMORY_CONFIGURATION 0x02
47#define OPL4_MODE_BIT 0x01
48#define OPL4_MTYPE_BIT 0x02
49#define OPL4_TONE_HEADER_MASK 0x1c
50#define OPL4_DEVICE_ID_MASK 0xe0
51
52#define OPL4_REG_MEMORY_ADDRESS_HIGH 0x03
53#define OPL4_REG_MEMORY_ADDRESS_MID 0x04
54#define OPL4_REG_MEMORY_ADDRESS_LOW 0x05
55#define OPL4_REG_MEMORY_DATA 0x06
56
57/*
58 * Offsets to the register banks for voices. To get the
59 * register number just add the voice number to the bank offset.
60 *
61 * Wave Table Number low bits (0x08 to 0x1F)
62 */
63#define OPL4_REG_TONE_NUMBER 0x08
64
65/* Wave Table Number high bit, F-Number low bits (0x20 to 0x37) */
66#define OPL4_REG_F_NUMBER 0x20
67#define OPL4_TONE_NUMBER_BIT8 0x01
68#define OPL4_F_NUMBER_LOW_MASK 0xfe
69
70/* F-Number high bits, Octave, Pseudo-Reverb (0x38 to 0x4F) */
71#define OPL4_REG_OCTAVE 0x38
72#define OPL4_F_NUMBER_HIGH_MASK 0x07
73#define OPL4_BLOCK_MASK 0xf0
74#define OPL4_PSEUDO_REVERB_BIT 0x08
75
76/* Total Level, Level Direct (0x50 to 0x67) */
77#define OPL4_REG_LEVEL 0x50
78#define OPL4_TOTAL_LEVEL_MASK 0xfe
79#define OPL4_LEVEL_DIRECT_BIT 0x01
80
81/* Key On, Damp, LFO RST, CH, Panpot (0x68 to 0x7F) */
82#define OPL4_REG_MISC 0x68
83#define OPL4_KEY_ON_BIT 0x80
84#define OPL4_DAMP_BIT 0x40
85#define OPL4_LFO_RESET_BIT 0x20
86#define OPL4_OUTPUT_CHANNEL_BIT 0x10
87#define OPL4_PAN_POT_MASK 0x0f
88
89/* LFO, VIB (0x80 to 0x97) */
90#define OPL4_REG_LFO_VIBRATO 0x80
91#define OPL4_LFO_FREQUENCY_MASK 0x38
92#define OPL4_VIBRATO_DEPTH_MASK 0x07
93#define OPL4_CHORUS_SEND_MASK 0xc0 /* ML only */
94
95/* Attack / Decay 1 rate (0x98 to 0xAF) */
96#define OPL4_REG_ATTACK_DECAY1 0x98
97#define OPL4_ATTACK_RATE_MASK 0xf0
98#define OPL4_DECAY1_RATE_MASK 0x0f
99
100/* Decay level / 2 rate (0xB0 to 0xC7) */
101#define OPL4_REG_LEVEL_DECAY2 0xb0
102#define OPL4_DECAY_LEVEL_MASK 0xf0
103#define OPL4_DECAY2_RATE_MASK 0x0f
104
105/* Release rate / Rate correction (0xC8 to 0xDF) */
106#define OPL4_REG_RELEASE_CORRECTION 0xc8
107#define OPL4_RELEASE_RATE_MASK 0x0f
108#define OPL4_RATE_INTERPOLATION_MASK 0xf0
109
110/* AM (0xE0 to 0xF7) */
111#define OPL4_REG_TREMOLO 0xe0
112#define OPL4_TREMOLO_DEPTH_MASK 0x07
113#define OPL4_REVERB_SEND_MASK 0xe0 /* ML only */
114
115/* Mixer */
116#define OPL4_REG_MIX_CONTROL_FM 0xf8
117#define OPL4_REG_MIX_CONTROL_PCM 0xf9
118#define OPL4_MIX_LEFT_MASK 0x07
119#define OPL4_MIX_RIGHT_MASK 0x38
120
121#define OPL4_REG_ATC 0xfa
122#define OPL4_ATC_BIT 0x01 /* ???, ML only */
123
124/* bits in the OPL3 Status register */
125#define OPL4_STATUS_BUSY 0x01
126#define OPL4_STATUS_LOAD 0x02
127
128
129#define OPL4_MAX_VOICES 24
130
131#define SNDRV_SEQ_DEV_ID_OPL4 "opl4-synth"
132
133
134typedef struct opl4_sound {
135 u16 tone;
136 s16 pitch_offset;
137 u8 key_scaling;
138 s8 panpot;
139 u8 vibrato;
140 u8 tone_attenuate;
141 u8 volume_factor;
142 u8 reg_lfo_vibrato;
143 u8 reg_attack_decay1;
144 u8 reg_level_decay2;
145 u8 reg_release_correction;
146 u8 reg_tremolo;
147} opl4_sound_t;
148
149typedef struct opl4_region {
150 u8 key_min, key_max;
151 opl4_sound_t sound;
152} opl4_region_t;
153
154typedef struct opl4_region_ptr {
155 int count;
156 const opl4_region_t *regions;
157} opl4_region_ptr_t;
158
159typedef struct opl4_voice {
160 struct list_head list;
161 int number;
162 snd_midi_channel_t *chan;
163 int note;
164 int velocity;
165 const opl4_sound_t *sound;
166 u8 level_direct;
167 u8 reg_f_number;
168 u8 reg_misc;
169 u8 reg_lfo_vibrato;
170} opl4_voice_t;
171
172struct opl4 {
173 unsigned long fm_port;
174 unsigned long pcm_port;
175 struct resource *res_fm_port;
176 struct resource *res_pcm_port;
177 unsigned short hardware;
178 spinlock_t reg_lock;
179 snd_card_t *card;
180
181#ifdef CONFIG_PROC_FS
182 snd_info_entry_t *proc_entry;
183 int memory_access;
184#endif
185 struct semaphore access_mutex;
186
187#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
188 int used;
189
190 int seq_dev_num;
191 int seq_client;
192 snd_seq_device_t *seq_dev;
193
194 snd_midi_channel_set_t *chset;
195 opl4_voice_t voices[OPL4_MAX_VOICES];
196 struct list_head off_voices;
197 struct list_head on_voices;
198#endif
199};
200
201/* opl4_lib.c */
202void snd_opl4_write(opl4_t *opl4, u8 reg, u8 value);
203u8 snd_opl4_read(opl4_t *opl4, u8 reg);
204void snd_opl4_read_memory(opl4_t *opl4, char *buf, int offset, int size);
205void snd_opl4_write_memory(opl4_t *opl4, const char *buf, int offset, int size);
206
207/* opl4_mixer.c */
208int snd_opl4_create_mixer(opl4_t *opl4);
209
210#ifdef CONFIG_PROC_FS
211/* opl4_proc.c */
212int snd_opl4_create_proc(opl4_t *opl4);
213void snd_opl4_free_proc(opl4_t *opl4);
214#endif
215
216/* opl4_seq.c */
217extern int volume_boost;
218
219/* opl4_synth.c */
220void snd_opl4_synth_reset(opl4_t *opl4);
221void snd_opl4_synth_shutdown(opl4_t *opl4);
222void snd_opl4_note_on(void *p, int note, int vel, snd_midi_channel_t *chan);
223void snd_opl4_note_off(void *p, int note, int vel, snd_midi_channel_t *chan);
224void snd_opl4_terminate_note(void *p, int note, snd_midi_channel_t *chan);
225void snd_opl4_control(void *p, int type, snd_midi_channel_t *chan);
226void snd_opl4_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset);
227
228/* yrw801.c */
229int snd_yrw801_detect(opl4_t *opl4);
230extern const opl4_region_ptr_t snd_yrw801_regions[];
231
232#endif /* __OPL4_LOCAL_H */
diff --git a/sound/drivers/opl4/opl4_mixer.c b/sound/drivers/opl4/opl4_mixer.c
new file mode 100644
index 000000000000..ec7a228fbe7e
--- /dev/null
+++ b/sound/drivers/opl4/opl4_mixer.c
@@ -0,0 +1,95 @@
1/*
2 * OPL4 mixer functions
3 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include "opl4_local.h"
21#include <sound/control.h>
22
23static int snd_opl4_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
24{
25 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
26 uinfo->count = 2;
27 uinfo->value.integer.min = 0;
28 uinfo->value.integer.max = 7;
29 return 0;
30}
31
32static int snd_opl4_ctl_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
33{
34 opl4_t *opl4 = snd_kcontrol_chip(kcontrol);
35 unsigned long flags;
36 u8 reg = kcontrol->private_value;
37 u8 value;
38
39 spin_lock_irqsave(&opl4->reg_lock, flags);
40 value = snd_opl4_read(opl4, reg);
41 spin_unlock_irqrestore(&opl4->reg_lock, flags);
42 ucontrol->value.integer.value[0] = 7 - (value & 7);
43 ucontrol->value.integer.value[1] = 7 - ((value >> 3) & 7);
44 return 0;
45}
46
47static int snd_opl4_ctl_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
48{
49 opl4_t *opl4 = snd_kcontrol_chip(kcontrol);
50 unsigned long flags;
51 u8 reg = kcontrol->private_value;
52 u8 value, old_value;
53
54 value = (7 - (ucontrol->value.integer.value[0] & 7)) |
55 ((7 - (ucontrol->value.integer.value[1] & 7)) << 3);
56 spin_lock_irqsave(&opl4->reg_lock, flags);
57 old_value = snd_opl4_read(opl4, reg);
58 snd_opl4_write(opl4, reg, value);
59 spin_unlock_irqrestore(&opl4->reg_lock, flags);
60 return value != old_value;
61}
62
63static snd_kcontrol_new_t snd_opl4_controls[] = {
64 {
65 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
66 .name = "FM Playback Volume",
67 .info = snd_opl4_ctl_info,
68 .get = snd_opl4_ctl_get,
69 .put = snd_opl4_ctl_put,
70 .private_value = OPL4_REG_MIX_CONTROL_FM
71 },
72 {
73 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
74 .name = "Wavetable Playback Volume",
75 .info = snd_opl4_ctl_info,
76 .get = snd_opl4_ctl_get,
77 .put = snd_opl4_ctl_put,
78 .private_value = OPL4_REG_MIX_CONTROL_PCM
79 }
80};
81
82int snd_opl4_create_mixer(opl4_t *opl4)
83{
84 snd_card_t *card = opl4->card;
85 int i, err;
86
87 strcat(card->mixername, ",OPL4");
88
89 for (i = 0; i < 2; ++i) {
90 err = snd_ctl_add(card, snd_ctl_new1(&snd_opl4_controls[i], opl4));
91 if (err < 0)
92 return err;
93 }
94 return 0;
95}
diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c
new file mode 100644
index 000000000000..6a1486258acf
--- /dev/null
+++ b/sound/drivers/opl4/opl4_proc.c
@@ -0,0 +1,166 @@
1/*
2 * Functions for the OPL4 proc file
3 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include "opl4_local.h"
21#include <linux/vmalloc.h>
22#include <sound/info.h>
23
24#ifdef CONFIG_PROC_FS
25
26static int snd_opl4_mem_proc_open(snd_info_entry_t *entry,
27 unsigned short mode, void **file_private_data)
28{
29 opl4_t *opl4 = entry->private_data;
30
31 down(&opl4->access_mutex);
32 if (opl4->memory_access) {
33 up(&opl4->access_mutex);
34 return -EBUSY;
35 }
36 opl4->memory_access++;
37 up(&opl4->access_mutex);
38 return 0;
39}
40
41static int snd_opl4_mem_proc_release(snd_info_entry_t *entry,
42 unsigned short mode, void *file_private_data)
43{
44 opl4_t *opl4 = entry->private_data;
45
46 down(&opl4->access_mutex);
47 opl4->memory_access--;
48 up(&opl4->access_mutex);
49 return 0;
50}
51
52static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data,
53 struct file *file, char __user *_buf,
54 unsigned long count, unsigned long pos)
55{
56 opl4_t *opl4 = entry->private_data;
57 long size;
58 char* buf;
59
60 size = count;
61 if (pos + size > entry->size)
62 size = entry->size - pos;
63 if (size > 0) {
64 buf = vmalloc(size);
65 if (!buf)
66 return -ENOMEM;
67 snd_opl4_read_memory(opl4, buf, pos, size);
68 if (copy_to_user(_buf, buf, size)) {
69 vfree(buf);
70 return -EFAULT;
71 }
72 vfree(buf);
73 return size;
74 }
75 return 0;
76}
77
78static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data,
79 struct file *file, const char __user *_buf,
80 unsigned long count, unsigned long pos)
81{
82 opl4_t *opl4 = entry->private_data;
83 long size;
84 char *buf;
85
86 size = count;
87 if (pos + size > entry->size)
88 size = entry->size - pos;
89 if (size > 0) {
90 buf = vmalloc(size);
91 if (!buf)
92 return -ENOMEM;
93 if (copy_from_user(buf, _buf, size)) {
94 vfree(buf);
95 return -EFAULT;
96 }
97 snd_opl4_write_memory(opl4, buf, pos, size);
98 vfree(buf);
99 return size;
100 }
101 return 0;
102}
103
104static long long snd_opl4_mem_proc_llseek(snd_info_entry_t *entry, void *file_private_data,
105 struct file *file, long long offset, int orig)
106{
107 switch (orig) {
108 case 0: /* SEEK_SET */
109 file->f_pos = offset;
110 break;
111 case 1: /* SEEK_CUR */
112 file->f_pos += offset;
113 break;
114 case 2: /* SEEK_END, offset is negative */
115 file->f_pos = entry->size + offset;
116 break;
117 default:
118 return -EINVAL;
119 }
120 if (file->f_pos > entry->size)
121 file->f_pos = entry->size;
122 return file->f_pos;
123}
124
125static struct snd_info_entry_ops snd_opl4_mem_proc_ops = {
126 .open = snd_opl4_mem_proc_open,
127 .release = snd_opl4_mem_proc_release,
128 .read = snd_opl4_mem_proc_read,
129 .write = snd_opl4_mem_proc_write,
130 .llseek = snd_opl4_mem_proc_llseek,
131};
132
133int snd_opl4_create_proc(opl4_t *opl4)
134{
135 snd_info_entry_t *entry;
136
137 entry = snd_info_create_card_entry(opl4->card, "opl4-mem", opl4->card->proc_root);
138 if (entry) {
139 if (opl4->hardware < OPL3_HW_OPL4_ML) {
140 /* OPL4 can access 4 MB external ROM/SRAM */
141 entry->mode |= S_IWUSR;
142 entry->size = 4 * 1024 * 1024;
143 } else {
144 /* OPL4-ML has 1 MB internal ROM */
145 entry->size = 1 * 1024 * 1024;
146 }
147 entry->content = SNDRV_INFO_CONTENT_DATA;
148 entry->c.ops = &snd_opl4_mem_proc_ops;
149 entry->module = THIS_MODULE;
150 entry->private_data = opl4;
151 if (snd_info_register(entry) < 0) {
152 snd_info_free_entry(entry);
153 entry = NULL;
154 }
155 }
156 opl4->proc_entry = entry;
157 return 0;
158}
159
160void snd_opl4_free_proc(opl4_t *opl4)
161{
162 if (opl4->proc_entry)
163 snd_info_unregister(opl4->proc_entry);
164}
165
166#endif /* CONFIG_PROC_FS */
diff --git a/sound/drivers/opl4/opl4_seq.c b/sound/drivers/opl4/opl4_seq.c
new file mode 100644
index 000000000000..958dfe88479a
--- /dev/null
+++ b/sound/drivers/opl4/opl4_seq.c
@@ -0,0 +1,223 @@
1/*
2 * OPL4 sequencer functions
3 *
4 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * Alternatively, this software may be distributed and/or modified under the
17 * terms of the GNU General Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at your option) any later
19 * version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "opl4_local.h"
35#include <linux/init.h>
36#include <linux/moduleparam.h>
37#include <sound/initval.h>
38
39MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
40MODULE_DESCRIPTION("OPL4 wavetable synth driver");
41MODULE_LICENSE("Dual BSD/GPL");
42
43int volume_boost = 8;
44
45module_param(volume_boost, int, 0644);
46MODULE_PARM_DESC(volume_boost, "Additional volume for OPL4 wavetable sounds.");
47
48static int snd_opl4_seq_use_inc(opl4_t *opl4)
49{
50 if (!try_module_get(opl4->card->module))
51 return -EFAULT;
52 return 0;
53}
54
55static void snd_opl4_seq_use_dec(opl4_t *opl4)
56{
57 module_put(opl4->card->module);
58}
59
60static int snd_opl4_seq_use(void *private_data, snd_seq_port_subscribe_t *info)
61{
62 opl4_t *opl4 = private_data;
63 int err;
64
65 down(&opl4->access_mutex);
66
67 if (opl4->used) {
68 up(&opl4->access_mutex);
69 return -EBUSY;
70 }
71 opl4->used++;
72
73 if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM) {
74 err = snd_opl4_seq_use_inc(opl4);
75 if (err < 0) {
76 up(&opl4->access_mutex);
77 return err;
78 }
79 }
80
81 up(&opl4->access_mutex);
82
83 snd_opl4_synth_reset(opl4);
84 return 0;
85}
86
87static int snd_opl4_seq_unuse(void *private_data, snd_seq_port_subscribe_t *info)
88{
89 opl4_t *opl4 = private_data;
90
91 snd_opl4_synth_shutdown(opl4);
92
93 down(&opl4->access_mutex);
94 opl4->used--;
95 up(&opl4->access_mutex);
96
97 if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM)
98 snd_opl4_seq_use_dec(opl4);
99 return 0;
100}
101
102static snd_midi_op_t opl4_ops = {
103 .note_on = snd_opl4_note_on,
104 .note_off = snd_opl4_note_off,
105 .note_terminate = snd_opl4_terminate_note,
106 .control = snd_opl4_control,
107 .sysex = snd_opl4_sysex,
108};
109
110static int snd_opl4_seq_event_input(snd_seq_event_t *ev, int direct,
111 void *private_data, int atomic, int hop)
112{
113 opl4_t *opl4 = private_data;
114
115 snd_midi_process_event(&opl4_ops, ev, opl4->chset);
116 return 0;
117}
118
119static void snd_opl4_seq_free_port(void *private_data)
120{
121 opl4_t *opl4 = private_data;
122
123 snd_midi_channel_free_set(opl4->chset);
124}
125
126static int snd_opl4_seq_new_device(snd_seq_device_t *dev)
127{
128 opl4_t *opl4;
129 int client;
130 snd_seq_client_callback_t callbacks;
131 snd_seq_client_info_t cinfo;
132 snd_seq_port_callback_t pcallbacks;
133
134 opl4 = *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
135 if (!opl4)
136 return -EINVAL;
137
138 if (snd_yrw801_detect(opl4) < 0)
139 return -ENODEV;
140
141 opl4->chset = snd_midi_channel_alloc_set(16);
142 if (!opl4->chset)
143 return -ENOMEM;
144 opl4->chset->private_data = opl4;
145
146 /* allocate new client */
147 memset(&callbacks, 0, sizeof(callbacks));
148 callbacks.private_data = opl4;
149 callbacks.allow_output = callbacks.allow_input = 1;
150 client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num, &callbacks);
151 if (client < 0) {
152 snd_midi_channel_free_set(opl4->chset);
153 return client;
154 }
155 opl4->seq_client = client;
156 opl4->chset->client = client;
157
158 /* change name of client */
159 memset(&cinfo, 0, sizeof(cinfo));
160 cinfo.client = client;
161 cinfo.type = KERNEL_CLIENT;
162 strcpy(cinfo.name, "OPL4 Wavetable");
163 snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo);
164
165 /* create new port */
166 memset(&pcallbacks, 0, sizeof(pcallbacks));
167 pcallbacks.owner = THIS_MODULE;
168 pcallbacks.use = snd_opl4_seq_use;
169 pcallbacks.unuse = snd_opl4_seq_unuse;
170 pcallbacks.event_input = snd_opl4_seq_event_input;
171 pcallbacks.private_free = snd_opl4_seq_free_port;
172 pcallbacks.private_data = opl4;
173
174 opl4->chset->port = snd_seq_event_port_attach(client, &pcallbacks,
175 SNDRV_SEQ_PORT_CAP_WRITE |
176 SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
177 SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
178 SNDRV_SEQ_PORT_TYPE_MIDI_GM,
179 16, 24,
180 "OPL4 Wavetable Port");
181 if (opl4->chset->port < 0) {
182 int err = opl4->chset->port;
183 snd_midi_channel_free_set(opl4->chset);
184 snd_seq_delete_kernel_client(client);
185 opl4->seq_client = -1;
186 return err;
187 }
188 return 0;
189}
190
191static int snd_opl4_seq_delete_device(snd_seq_device_t *dev)
192{
193 opl4_t *opl4;
194
195 opl4 = *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
196 if (!opl4)
197 return -EINVAL;
198
199 if (opl4->seq_client >= 0) {
200 snd_seq_delete_kernel_client(opl4->seq_client);
201 opl4->seq_client = -1;
202 }
203 return 0;
204}
205
206static int __init alsa_opl4_synth_init(void)
207{
208 static snd_seq_dev_ops_t ops = {
209 snd_opl4_seq_new_device,
210 snd_opl4_seq_delete_device
211 };
212
213 return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OPL4, &ops,
214 sizeof(opl4_t*));
215}
216
217static void __exit alsa_opl4_synth_exit(void)
218{
219 snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_OPL4);
220}
221
222module_init(alsa_opl4_synth_init)
223module_exit(alsa_opl4_synth_exit)
diff --git a/sound/drivers/opl4/opl4_synth.c b/sound/drivers/opl4/opl4_synth.c
new file mode 100644
index 000000000000..b146a1c995d9
--- /dev/null
+++ b/sound/drivers/opl4/opl4_synth.c
@@ -0,0 +1,630 @@
1/*
2 * OPL4 MIDI synthesizer functions
3 *
4 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * Alternatively, this software may be distributed and/or modified under the
17 * terms of the GNU General Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at your option) any later
19 * version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "opl4_local.h"
35#include <linux/delay.h>
36#include <asm/io.h>
37#include <sound/asoundef.h>
38
39/* GM2 controllers */
40#ifndef MIDI_CTL_RELEASE_TIME
41#define MIDI_CTL_RELEASE_TIME 0x48
42#define MIDI_CTL_ATTACK_TIME 0x49
43#define MIDI_CTL_DECAY_TIME 0x4b
44#define MIDI_CTL_VIBRATO_RATE 0x4c
45#define MIDI_CTL_VIBRATO_DEPTH 0x4d
46#define MIDI_CTL_VIBRATO_DELAY 0x4e
47#endif
48
49/*
50 * This table maps 100/128 cents to F_NUMBER.
51 */
52static const s16 snd_opl4_pitch_map[0x600] = {
53 0x000,0x000,0x001,0x001,0x002,0x002,0x003,0x003,
54 0x004,0x004,0x005,0x005,0x006,0x006,0x006,0x007,
55 0x007,0x008,0x008,0x009,0x009,0x00a,0x00a,0x00b,
56 0x00b,0x00c,0x00c,0x00d,0x00d,0x00d,0x00e,0x00e,
57 0x00f,0x00f,0x010,0x010,0x011,0x011,0x012,0x012,
58 0x013,0x013,0x014,0x014,0x015,0x015,0x015,0x016,
59 0x016,0x017,0x017,0x018,0x018,0x019,0x019,0x01a,
60 0x01a,0x01b,0x01b,0x01c,0x01c,0x01d,0x01d,0x01e,
61 0x01e,0x01e,0x01f,0x01f,0x020,0x020,0x021,0x021,
62 0x022,0x022,0x023,0x023,0x024,0x024,0x025,0x025,
63 0x026,0x026,0x027,0x027,0x028,0x028,0x029,0x029,
64 0x029,0x02a,0x02a,0x02b,0x02b,0x02c,0x02c,0x02d,
65 0x02d,0x02e,0x02e,0x02f,0x02f,0x030,0x030,0x031,
66 0x031,0x032,0x032,0x033,0x033,0x034,0x034,0x035,
67 0x035,0x036,0x036,0x037,0x037,0x038,0x038,0x038,
68 0x039,0x039,0x03a,0x03a,0x03b,0x03b,0x03c,0x03c,
69 0x03d,0x03d,0x03e,0x03e,0x03f,0x03f,0x040,0x040,
70 0x041,0x041,0x042,0x042,0x043,0x043,0x044,0x044,
71 0x045,0x045,0x046,0x046,0x047,0x047,0x048,0x048,
72 0x049,0x049,0x04a,0x04a,0x04b,0x04b,0x04c,0x04c,
73 0x04d,0x04d,0x04e,0x04e,0x04f,0x04f,0x050,0x050,
74 0x051,0x051,0x052,0x052,0x053,0x053,0x054,0x054,
75 0x055,0x055,0x056,0x056,0x057,0x057,0x058,0x058,
76 0x059,0x059,0x05a,0x05a,0x05b,0x05b,0x05c,0x05c,
77 0x05d,0x05d,0x05e,0x05e,0x05f,0x05f,0x060,0x060,
78 0x061,0x061,0x062,0x062,0x063,0x063,0x064,0x064,
79 0x065,0x065,0x066,0x066,0x067,0x067,0x068,0x068,
80 0x069,0x069,0x06a,0x06a,0x06b,0x06b,0x06c,0x06c,
81 0x06d,0x06d,0x06e,0x06e,0x06f,0x06f,0x070,0x071,
82 0x071,0x072,0x072,0x073,0x073,0x074,0x074,0x075,
83 0x075,0x076,0x076,0x077,0x077,0x078,0x078,0x079,
84 0x079,0x07a,0x07a,0x07b,0x07b,0x07c,0x07c,0x07d,
85 0x07d,0x07e,0x07e,0x07f,0x07f,0x080,0x081,0x081,
86 0x082,0x082,0x083,0x083,0x084,0x084,0x085,0x085,
87 0x086,0x086,0x087,0x087,0x088,0x088,0x089,0x089,
88 0x08a,0x08a,0x08b,0x08b,0x08c,0x08d,0x08d,0x08e,
89 0x08e,0x08f,0x08f,0x090,0x090,0x091,0x091,0x092,
90 0x092,0x093,0x093,0x094,0x094,0x095,0x096,0x096,
91 0x097,0x097,0x098,0x098,0x099,0x099,0x09a,0x09a,
92 0x09b,0x09b,0x09c,0x09c,0x09d,0x09d,0x09e,0x09f,
93 0x09f,0x0a0,0x0a0,0x0a1,0x0a1,0x0a2,0x0a2,0x0a3,
94 0x0a3,0x0a4,0x0a4,0x0a5,0x0a6,0x0a6,0x0a7,0x0a7,
95 0x0a8,0x0a8,0x0a9,0x0a9,0x0aa,0x0aa,0x0ab,0x0ab,
96 0x0ac,0x0ad,0x0ad,0x0ae,0x0ae,0x0af,0x0af,0x0b0,
97 0x0b0,0x0b1,0x0b1,0x0b2,0x0b2,0x0b3,0x0b4,0x0b4,
98 0x0b5,0x0b5,0x0b6,0x0b6,0x0b7,0x0b7,0x0b8,0x0b8,
99 0x0b9,0x0ba,0x0ba,0x0bb,0x0bb,0x0bc,0x0bc,0x0bd,
100 0x0bd,0x0be,0x0be,0x0bf,0x0c0,0x0c0,0x0c1,0x0c1,
101 0x0c2,0x0c2,0x0c3,0x0c3,0x0c4,0x0c4,0x0c5,0x0c6,
102 0x0c6,0x0c7,0x0c7,0x0c8,0x0c8,0x0c9,0x0c9,0x0ca,
103 0x0cb,0x0cb,0x0cc,0x0cc,0x0cd,0x0cd,0x0ce,0x0ce,
104 0x0cf,0x0d0,0x0d0,0x0d1,0x0d1,0x0d2,0x0d2,0x0d3,
105 0x0d3,0x0d4,0x0d5,0x0d5,0x0d6,0x0d6,0x0d7,0x0d7,
106 0x0d8,0x0d8,0x0d9,0x0da,0x0da,0x0db,0x0db,0x0dc,
107 0x0dc,0x0dd,0x0de,0x0de,0x0df,0x0df,0x0e0,0x0e0,
108 0x0e1,0x0e1,0x0e2,0x0e3,0x0e3,0x0e4,0x0e4,0x0e5,
109 0x0e5,0x0e6,0x0e7,0x0e7,0x0e8,0x0e8,0x0e9,0x0e9,
110 0x0ea,0x0eb,0x0eb,0x0ec,0x0ec,0x0ed,0x0ed,0x0ee,
111 0x0ef,0x0ef,0x0f0,0x0f0,0x0f1,0x0f1,0x0f2,0x0f3,
112 0x0f3,0x0f4,0x0f4,0x0f5,0x0f5,0x0f6,0x0f7,0x0f7,
113 0x0f8,0x0f8,0x0f9,0x0f9,0x0fa,0x0fb,0x0fb,0x0fc,
114 0x0fc,0x0fd,0x0fd,0x0fe,0x0ff,0x0ff,0x100,0x100,
115 0x101,0x101,0x102,0x103,0x103,0x104,0x104,0x105,
116 0x106,0x106,0x107,0x107,0x108,0x108,0x109,0x10a,
117 0x10a,0x10b,0x10b,0x10c,0x10c,0x10d,0x10e,0x10e,
118 0x10f,0x10f,0x110,0x111,0x111,0x112,0x112,0x113,
119 0x114,0x114,0x115,0x115,0x116,0x116,0x117,0x118,
120 0x118,0x119,0x119,0x11a,0x11b,0x11b,0x11c,0x11c,
121 0x11d,0x11e,0x11e,0x11f,0x11f,0x120,0x120,0x121,
122 0x122,0x122,0x123,0x123,0x124,0x125,0x125,0x126,
123 0x126,0x127,0x128,0x128,0x129,0x129,0x12a,0x12b,
124 0x12b,0x12c,0x12c,0x12d,0x12e,0x12e,0x12f,0x12f,
125 0x130,0x131,0x131,0x132,0x132,0x133,0x134,0x134,
126 0x135,0x135,0x136,0x137,0x137,0x138,0x138,0x139,
127 0x13a,0x13a,0x13b,0x13b,0x13c,0x13d,0x13d,0x13e,
128 0x13e,0x13f,0x140,0x140,0x141,0x141,0x142,0x143,
129 0x143,0x144,0x144,0x145,0x146,0x146,0x147,0x148,
130 0x148,0x149,0x149,0x14a,0x14b,0x14b,0x14c,0x14c,
131 0x14d,0x14e,0x14e,0x14f,0x14f,0x150,0x151,0x151,
132 0x152,0x153,0x153,0x154,0x154,0x155,0x156,0x156,
133 0x157,0x157,0x158,0x159,0x159,0x15a,0x15b,0x15b,
134 0x15c,0x15c,0x15d,0x15e,0x15e,0x15f,0x160,0x160,
135 0x161,0x161,0x162,0x163,0x163,0x164,0x165,0x165,
136 0x166,0x166,0x167,0x168,0x168,0x169,0x16a,0x16a,
137 0x16b,0x16b,0x16c,0x16d,0x16d,0x16e,0x16f,0x16f,
138 0x170,0x170,0x171,0x172,0x172,0x173,0x174,0x174,
139 0x175,0x175,0x176,0x177,0x177,0x178,0x179,0x179,
140 0x17a,0x17a,0x17b,0x17c,0x17c,0x17d,0x17e,0x17e,
141 0x17f,0x180,0x180,0x181,0x181,0x182,0x183,0x183,
142 0x184,0x185,0x185,0x186,0x187,0x187,0x188,0x188,
143 0x189,0x18a,0x18a,0x18b,0x18c,0x18c,0x18d,0x18e,
144 0x18e,0x18f,0x190,0x190,0x191,0x191,0x192,0x193,
145 0x193,0x194,0x195,0x195,0x196,0x197,0x197,0x198,
146 0x199,0x199,0x19a,0x19a,0x19b,0x19c,0x19c,0x19d,
147 0x19e,0x19e,0x19f,0x1a0,0x1a0,0x1a1,0x1a2,0x1a2,
148 0x1a3,0x1a4,0x1a4,0x1a5,0x1a6,0x1a6,0x1a7,0x1a8,
149 0x1a8,0x1a9,0x1a9,0x1aa,0x1ab,0x1ab,0x1ac,0x1ad,
150 0x1ad,0x1ae,0x1af,0x1af,0x1b0,0x1b1,0x1b1,0x1b2,
151 0x1b3,0x1b3,0x1b4,0x1b5,0x1b5,0x1b6,0x1b7,0x1b7,
152 0x1b8,0x1b9,0x1b9,0x1ba,0x1bb,0x1bb,0x1bc,0x1bd,
153 0x1bd,0x1be,0x1bf,0x1bf,0x1c0,0x1c1,0x1c1,0x1c2,
154 0x1c3,0x1c3,0x1c4,0x1c5,0x1c5,0x1c6,0x1c7,0x1c7,
155 0x1c8,0x1c9,0x1c9,0x1ca,0x1cb,0x1cb,0x1cc,0x1cd,
156 0x1cd,0x1ce,0x1cf,0x1cf,0x1d0,0x1d1,0x1d1,0x1d2,
157 0x1d3,0x1d3,0x1d4,0x1d5,0x1d5,0x1d6,0x1d7,0x1d7,
158 0x1d8,0x1d9,0x1d9,0x1da,0x1db,0x1db,0x1dc,0x1dd,
159 0x1dd,0x1de,0x1df,0x1df,0x1e0,0x1e1,0x1e1,0x1e2,
160 0x1e3,0x1e4,0x1e4,0x1e5,0x1e6,0x1e6,0x1e7,0x1e8,
161 0x1e8,0x1e9,0x1ea,0x1ea,0x1eb,0x1ec,0x1ec,0x1ed,
162 0x1ee,0x1ee,0x1ef,0x1f0,0x1f0,0x1f1,0x1f2,0x1f3,
163 0x1f3,0x1f4,0x1f5,0x1f5,0x1f6,0x1f7,0x1f7,0x1f8,
164 0x1f9,0x1f9,0x1fa,0x1fb,0x1fb,0x1fc,0x1fd,0x1fe,
165 0x1fe,0x1ff,0x200,0x200,0x201,0x202,0x202,0x203,
166 0x204,0x205,0x205,0x206,0x207,0x207,0x208,0x209,
167 0x209,0x20a,0x20b,0x20b,0x20c,0x20d,0x20e,0x20e,
168 0x20f,0x210,0x210,0x211,0x212,0x212,0x213,0x214,
169 0x215,0x215,0x216,0x217,0x217,0x218,0x219,0x21a,
170 0x21a,0x21b,0x21c,0x21c,0x21d,0x21e,0x21e,0x21f,
171 0x220,0x221,0x221,0x222,0x223,0x223,0x224,0x225,
172 0x226,0x226,0x227,0x228,0x228,0x229,0x22a,0x22b,
173 0x22b,0x22c,0x22d,0x22d,0x22e,0x22f,0x230,0x230,
174 0x231,0x232,0x232,0x233,0x234,0x235,0x235,0x236,
175 0x237,0x237,0x238,0x239,0x23a,0x23a,0x23b,0x23c,
176 0x23c,0x23d,0x23e,0x23f,0x23f,0x240,0x241,0x241,
177 0x242,0x243,0x244,0x244,0x245,0x246,0x247,0x247,
178 0x248,0x249,0x249,0x24a,0x24b,0x24c,0x24c,0x24d,
179 0x24e,0x24f,0x24f,0x250,0x251,0x251,0x252,0x253,
180 0x254,0x254,0x255,0x256,0x257,0x257,0x258,0x259,
181 0x259,0x25a,0x25b,0x25c,0x25c,0x25d,0x25e,0x25f,
182 0x25f,0x260,0x261,0x262,0x262,0x263,0x264,0x265,
183 0x265,0x266,0x267,0x267,0x268,0x269,0x26a,0x26a,
184 0x26b,0x26c,0x26d,0x26d,0x26e,0x26f,0x270,0x270,
185 0x271,0x272,0x273,0x273,0x274,0x275,0x276,0x276,
186 0x277,0x278,0x279,0x279,0x27a,0x27b,0x27c,0x27c,
187 0x27d,0x27e,0x27f,0x27f,0x280,0x281,0x282,0x282,
188 0x283,0x284,0x285,0x285,0x286,0x287,0x288,0x288,
189 0x289,0x28a,0x28b,0x28b,0x28c,0x28d,0x28e,0x28e,
190 0x28f,0x290,0x291,0x291,0x292,0x293,0x294,0x294,
191 0x295,0x296,0x297,0x298,0x298,0x299,0x29a,0x29b,
192 0x29b,0x29c,0x29d,0x29e,0x29e,0x29f,0x2a0,0x2a1,
193 0x2a1,0x2a2,0x2a3,0x2a4,0x2a5,0x2a5,0x2a6,0x2a7,
194 0x2a8,0x2a8,0x2a9,0x2aa,0x2ab,0x2ab,0x2ac,0x2ad,
195 0x2ae,0x2af,0x2af,0x2b0,0x2b1,0x2b2,0x2b2,0x2b3,
196 0x2b4,0x2b5,0x2b5,0x2b6,0x2b7,0x2b8,0x2b9,0x2b9,
197 0x2ba,0x2bb,0x2bc,0x2bc,0x2bd,0x2be,0x2bf,0x2c0,
198 0x2c0,0x2c1,0x2c2,0x2c3,0x2c4,0x2c4,0x2c5,0x2c6,
199 0x2c7,0x2c7,0x2c8,0x2c9,0x2ca,0x2cb,0x2cb,0x2cc,
200 0x2cd,0x2ce,0x2ce,0x2cf,0x2d0,0x2d1,0x2d2,0x2d2,
201 0x2d3,0x2d4,0x2d5,0x2d6,0x2d6,0x2d7,0x2d8,0x2d9,
202 0x2da,0x2da,0x2db,0x2dc,0x2dd,0x2dd,0x2de,0x2df,
203 0x2e0,0x2e1,0x2e1,0x2e2,0x2e3,0x2e4,0x2e5,0x2e5,
204 0x2e6,0x2e7,0x2e8,0x2e9,0x2e9,0x2ea,0x2eb,0x2ec,
205 0x2ed,0x2ed,0x2ee,0x2ef,0x2f0,0x2f1,0x2f1,0x2f2,
206 0x2f3,0x2f4,0x2f5,0x2f5,0x2f6,0x2f7,0x2f8,0x2f9,
207 0x2f9,0x2fa,0x2fb,0x2fc,0x2fd,0x2fd,0x2fe,0x2ff,
208 0x300,0x301,0x302,0x302,0x303,0x304,0x305,0x306,
209 0x306,0x307,0x308,0x309,0x30a,0x30a,0x30b,0x30c,
210 0x30d,0x30e,0x30f,0x30f,0x310,0x311,0x312,0x313,
211 0x313,0x314,0x315,0x316,0x317,0x318,0x318,0x319,
212 0x31a,0x31b,0x31c,0x31c,0x31d,0x31e,0x31f,0x320,
213 0x321,0x321,0x322,0x323,0x324,0x325,0x326,0x326,
214 0x327,0x328,0x329,0x32a,0x32a,0x32b,0x32c,0x32d,
215 0x32e,0x32f,0x32f,0x330,0x331,0x332,0x333,0x334,
216 0x334,0x335,0x336,0x337,0x338,0x339,0x339,0x33a,
217 0x33b,0x33c,0x33d,0x33e,0x33e,0x33f,0x340,0x341,
218 0x342,0x343,0x343,0x344,0x345,0x346,0x347,0x348,
219 0x349,0x349,0x34a,0x34b,0x34c,0x34d,0x34e,0x34e,
220 0x34f,0x350,0x351,0x352,0x353,0x353,0x354,0x355,
221 0x356,0x357,0x358,0x359,0x359,0x35a,0x35b,0x35c,
222 0x35d,0x35e,0x35f,0x35f,0x360,0x361,0x362,0x363,
223 0x364,0x364,0x365,0x366,0x367,0x368,0x369,0x36a,
224 0x36a,0x36b,0x36c,0x36d,0x36e,0x36f,0x370,0x370,
225 0x371,0x372,0x373,0x374,0x375,0x376,0x377,0x377,
226 0x378,0x379,0x37a,0x37b,0x37c,0x37d,0x37d,0x37e,
227 0x37f,0x380,0x381,0x382,0x383,0x383,0x384,0x385,
228 0x386,0x387,0x388,0x389,0x38a,0x38a,0x38b,0x38c,
229 0x38d,0x38e,0x38f,0x390,0x391,0x391,0x392,0x393,
230 0x394,0x395,0x396,0x397,0x398,0x398,0x399,0x39a,
231 0x39b,0x39c,0x39d,0x39e,0x39f,0x39f,0x3a0,0x3a1,
232 0x3a2,0x3a3,0x3a4,0x3a5,0x3a6,0x3a7,0x3a7,0x3a8,
233 0x3a9,0x3aa,0x3ab,0x3ac,0x3ad,0x3ae,0x3ae,0x3af,
234 0x3b0,0x3b1,0x3b2,0x3b3,0x3b4,0x3b5,0x3b6,0x3b6,
235 0x3b7,0x3b8,0x3b9,0x3ba,0x3bb,0x3bc,0x3bd,0x3be,
236 0x3bf,0x3bf,0x3c0,0x3c1,0x3c2,0x3c3,0x3c4,0x3c5,
237 0x3c6,0x3c7,0x3c7,0x3c8,0x3c9,0x3ca,0x3cb,0x3cc,
238 0x3cd,0x3ce,0x3cf,0x3d0,0x3d1,0x3d1,0x3d2,0x3d3,
239 0x3d4,0x3d5,0x3d6,0x3d7,0x3d8,0x3d9,0x3da,0x3da,
240 0x3db,0x3dc,0x3dd,0x3de,0x3df,0x3e0,0x3e1,0x3e2,
241 0x3e3,0x3e4,0x3e4,0x3e5,0x3e6,0x3e7,0x3e8,0x3e9,
242 0x3ea,0x3eb,0x3ec,0x3ed,0x3ee,0x3ef,0x3ef,0x3f0,
243 0x3f1,0x3f2,0x3f3,0x3f4,0x3f5,0x3f6,0x3f7,0x3f8,
244 0x3f9,0x3fa,0x3fa,0x3fb,0x3fc,0x3fd,0x3fe,0x3ff
245};
246
247/*
248 * Attenuation according to GM recommendations, in -0.375 dB units.
249 * table[v] = 40 * log(v / 127) / -0.375
250 */
251static unsigned char snd_opl4_volume_table[128] = {
252 255,224,192,173,160,150,141,134,
253 128,122,117,113,109,105,102, 99,
254 96, 93, 90, 88, 85, 83, 81, 79,
255 77, 75, 73, 71, 70, 68, 67, 65,
256 64, 62, 61, 59, 58, 57, 56, 54,
257 53, 52, 51, 50, 49, 48, 47, 46,
258 45, 44, 43, 42, 41, 40, 39, 39,
259 38, 37, 36, 35, 34, 34, 33, 32,
260 31, 31, 30, 29, 29, 28, 27, 27,
261 26, 25, 25, 24, 24, 23, 22, 22,
262 21, 21, 20, 19, 19, 18, 18, 17,
263 17, 16, 16, 15, 15, 14, 14, 13,
264 13, 12, 12, 11, 11, 10, 10, 9,
265 9, 9, 8, 8, 7, 7, 6, 6,
266 6, 5, 5, 4, 4, 4, 3, 3,
267 2, 2, 2, 1, 1, 0, 0, 0
268};
269
270/*
271 * Initializes all voices.
272 */
273void snd_opl4_synth_reset(opl4_t *opl4)
274{
275 unsigned long flags;
276 int i;
277
278 spin_lock_irqsave(&opl4->reg_lock, flags);
279 for (i = 0; i < OPL4_MAX_VOICES; i++)
280 snd_opl4_write(opl4, OPL4_REG_MISC + i, OPL4_DAMP_BIT);
281 spin_unlock_irqrestore(&opl4->reg_lock, flags);
282
283 INIT_LIST_HEAD(&opl4->off_voices);
284 INIT_LIST_HEAD(&opl4->on_voices);
285 memset(opl4->voices, 0, sizeof(opl4->voices));
286 for (i = 0; i < OPL4_MAX_VOICES; i++) {
287 opl4->voices[i].number = i;
288 list_add_tail(&opl4->voices[i].list, &opl4->off_voices);
289 }
290
291 snd_midi_channel_set_clear(opl4->chset);
292}
293
294/*
295 * Shuts down all voices.
296 */
297void snd_opl4_synth_shutdown(opl4_t *opl4)
298{
299 unsigned long flags;
300 int i;
301
302 spin_lock_irqsave(&opl4->reg_lock, flags);
303 for (i = 0; i < OPL4_MAX_VOICES; i++)
304 snd_opl4_write(opl4, OPL4_REG_MISC + i,
305 opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT);
306 spin_unlock_irqrestore(&opl4->reg_lock, flags);
307}
308
309/*
310 * Executes the callback for all voices playing the specified note.
311 */
312static void snd_opl4_do_for_note(opl4_t *opl4, int note, snd_midi_channel_t *chan,
313 void (*func)(opl4_t *opl4, opl4_voice_t *voice))
314{
315 int i;
316 unsigned long flags;
317 opl4_voice_t *voice;
318
319 spin_lock_irqsave(&opl4->reg_lock, flags);
320 for (i = 0; i < OPL4_MAX_VOICES; i++) {
321 voice = &opl4->voices[i];
322 if (voice->chan == chan && voice->note == note) {
323 func(opl4, voice);
324 }
325 }
326 spin_unlock_irqrestore(&opl4->reg_lock, flags);
327}
328
329/*
330 * Executes the callback for all voices of to the specified channel.
331 */
332static void snd_opl4_do_for_channel(opl4_t *opl4, snd_midi_channel_t *chan,
333 void (*func)(opl4_t *opl4, opl4_voice_t *voice))
334{
335 int i;
336 unsigned long flags;
337 opl4_voice_t *voice;
338
339 spin_lock_irqsave(&opl4->reg_lock, flags);
340 for (i = 0; i < OPL4_MAX_VOICES; i++) {
341 voice = &opl4->voices[i];
342 if (voice->chan == chan) {
343 func(opl4, voice);
344 }
345 }
346 spin_unlock_irqrestore(&opl4->reg_lock, flags);
347}
348
349/*
350 * Executes the callback for all active voices.
351 */
352static void snd_opl4_do_for_all(opl4_t *opl4,
353 void (*func)(opl4_t *opl4, opl4_voice_t *voice))
354{
355 int i;
356 unsigned long flags;
357 opl4_voice_t *voice;
358
359 spin_lock_irqsave(&opl4->reg_lock, flags);
360 for (i = 0; i < OPL4_MAX_VOICES; i++) {
361 voice = &opl4->voices[i];
362 if (voice->chan)
363 func(opl4, voice);
364 }
365 spin_unlock_irqrestore(&opl4->reg_lock, flags);
366}
367
368static void snd_opl4_update_volume(opl4_t *opl4, opl4_voice_t *voice)
369{
370 int att;
371
372 att = voice->sound->tone_attenuate;
373 att += snd_opl4_volume_table[opl4->chset->gs_master_volume & 0x7f];
374 att += snd_opl4_volume_table[voice->chan->gm_volume & 0x7f];
375 att += snd_opl4_volume_table[voice->chan->gm_expression & 0x7f];
376 att += snd_opl4_volume_table[voice->velocity];
377 att = 0x7f - (0x7f - att) * (voice->sound->volume_factor) / 0xfe - volume_boost;
378 if (att < 0)
379 att = 0;
380 else if (att > 0x7e)
381 att = 0x7e;
382 snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
383 (att << 1) | voice->level_direct);
384 voice->level_direct = 0;
385}
386
387static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice)
388{
389 int pan = voice->sound->panpot;
390
391 if (!voice->chan->drum_channel)
392 pan += (voice->chan->control[MIDI_CTL_MSB_PAN] - 0x40) >> 3;
393 if (pan < -7)
394 pan = -7;
395 else if (pan > 7)
396 pan = 7;
397 voice->reg_misc = (voice->reg_misc & ~OPL4_PAN_POT_MASK)
398 | (pan & OPL4_PAN_POT_MASK);
399 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
400}
401
402static void snd_opl4_update_vibrato_depth(opl4_t *opl4, opl4_voice_t *voice)
403{
404 int depth;
405
406 if (voice->chan->drum_channel)
407 return;
408 depth = (7 - voice->sound->vibrato)
409 * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
410 depth = (depth >> 7) + voice->sound->vibrato;
411 voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
412 voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
413 snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
414 voice->reg_lfo_vibrato);
415}
416
417static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice)
418{
419 snd_midi_channel_t *chan = voice->chan;
420 int note, pitch, octave;
421
422 note = chan->drum_channel ? 60 : voice->note;
423 /*
424 * pitch is in 100/128 cents, so 0x80 is one semitone and
425 * 0x600 is one octave.
426 */
427 pitch = ((note - 60) << 7) * voice->sound->key_scaling / 100 + (60 << 7);
428 pitch += voice->sound->pitch_offset;
429 if (!chan->drum_channel)
430 pitch += chan->gm_rpn_coarse_tuning;
431 pitch += chan->gm_rpn_fine_tuning >> 7;
432 pitch += chan->midi_pitchbend * chan->gm_rpn_pitch_bend_range / 0x2000;
433 if (pitch < 0)
434 pitch = 0;
435 else if (pitch >= 0x6000)
436 pitch = 0x5fff;
437 octave = pitch / 0x600 - 8;
438 pitch = snd_opl4_pitch_map[pitch % 0x600];
439
440 snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number,
441 (octave << 4) | ((pitch >> 7) & OPL4_F_NUMBER_HIGH_MASK));
442 voice->reg_f_number = (voice->reg_f_number & OPL4_TONE_NUMBER_BIT8)
443 | ((pitch << 1) & OPL4_F_NUMBER_LOW_MASK);
444 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number);
445}
446
447static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice)
448{
449 snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
450 voice->sound->reg_attack_decay1);
451 snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
452 voice->sound->reg_level_decay2);
453 snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number,
454 voice->sound->reg_release_correction);
455 snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number,
456 voice->sound->reg_tremolo);
457}
458
459/* allocate one voice */
460static opl4_voice_t *snd_opl4_get_voice(opl4_t *opl4)
461{
462 /* first, try to get the oldest key-off voice */
463 if (!list_empty(&opl4->off_voices))
464 return list_entry(opl4->off_voices.next, opl4_voice_t, list);
465 /* then get the oldest key-on voice */
466 snd_assert(!list_empty(&opl4->on_voices), );
467 return list_entry(opl4->on_voices.next, opl4_voice_t, list);
468}
469
470static void snd_opl4_wait_for_wave_headers(opl4_t *opl4)
471{
472 int timeout = 200;
473
474 while ((inb(opl4->fm_port) & OPL4_STATUS_LOAD) && --timeout > 0)
475 udelay(10);
476}
477
478void snd_opl4_note_on(void *private_data, int note, int vel, snd_midi_channel_t *chan)
479{
480 opl4_t *opl4 = private_data;
481 const opl4_region_ptr_t *regions;
482 opl4_voice_t *voice[2];
483 const opl4_sound_t *sound[2];
484 int voices = 0, i;
485 unsigned long flags;
486
487 /* determine the number of voices and voice parameters */
488 i = chan->drum_channel ? 0x80 : (chan->midi_program & 0x7f);
489 regions = &snd_yrw801_regions[i];
490 for (i = 0; i < regions->count; i++) {
491 if (note >= regions->regions[i].key_min &&
492 note <= regions->regions[i].key_max) {
493 sound[voices] = &regions->regions[i].sound;
494 if (++voices >= 2)
495 break;
496 }
497 }
498
499 /* allocate and initialize the needed voices */
500 spin_lock_irqsave(&opl4->reg_lock, flags);
501 for (i = 0; i < voices; i++) {
502 voice[i] = snd_opl4_get_voice(opl4);
503 list_del(&voice[i]->list);
504 list_add_tail(&voice[i]->list, &opl4->on_voices);
505 voice[i]->chan = chan;
506 voice[i]->note = note;
507 voice[i]->velocity = vel & 0x7f;
508 voice[i]->sound = sound[i];
509 }
510
511 /* set tone number (triggers header loading) */
512 for (i = 0; i < voices; i++) {
513 voice[i]->reg_f_number =
514 (sound[i]->tone >> 8) & OPL4_TONE_NUMBER_BIT8;
515 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number,
516 voice[i]->reg_f_number);
517 snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number,
518 sound[i]->tone & 0xff);
519 }
520
521 /* set parameters which can be set while loading */
522 for (i = 0; i < voices; i++) {
523 voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
524 snd_opl4_update_pan(opl4, voice[i]);
525 snd_opl4_update_pitch(opl4, voice[i]);
526 voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
527 snd_opl4_update_volume(opl4, voice[i]);
528 }
529 spin_unlock_irqrestore(&opl4->reg_lock, flags);
530
531 /* wait for completion of loading */
532 snd_opl4_wait_for_wave_headers(opl4);
533
534 /* set remaining parameters */
535 spin_lock_irqsave(&opl4->reg_lock, flags);
536 for (i = 0; i < voices; i++) {
537 snd_opl4_update_tone_parameters(opl4, voice[i]);
538 voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
539 snd_opl4_update_vibrato_depth(opl4, voice[i]);
540 }
541
542 /* finally, switch on all voices */
543 for (i = 0; i < voices; i++) {
544 voice[i]->reg_misc =
545 (voice[i]->reg_misc & 0x1f) | OPL4_KEY_ON_BIT;
546 snd_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number,
547 voice[i]->reg_misc);
548 }
549 spin_unlock_irqrestore(&opl4->reg_lock, flags);
550}
551
552static void snd_opl4_voice_off(opl4_t *opl4, opl4_voice_t *voice)
553{
554 list_del(&voice->list);
555 list_add_tail(&voice->list, &opl4->off_voices);
556
557 voice->reg_misc &= ~OPL4_KEY_ON_BIT;
558 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
559}
560
561void snd_opl4_note_off(void *private_data, int note, int vel, snd_midi_channel_t *chan)
562{
563 opl4_t *opl4 = private_data;
564
565 snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off);
566}
567
568static void snd_opl4_terminate_voice(opl4_t *opl4, opl4_voice_t *voice)
569{
570 list_del(&voice->list);
571 list_add_tail(&voice->list, &opl4->off_voices);
572
573 voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT;
574 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
575}
576
577void snd_opl4_terminate_note(void *private_data, int note, snd_midi_channel_t *chan)
578{
579 opl4_t *opl4 = private_data;
580
581 snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice);
582}
583
584void snd_opl4_control(void *private_data, int type, snd_midi_channel_t *chan)
585{
586 opl4_t *opl4 = private_data;
587
588 switch (type) {
589 case MIDI_CTL_MSB_MODWHEEL:
590 chan->control[MIDI_CTL_VIBRATO_DEPTH] = chan->control[MIDI_CTL_MSB_MODWHEEL];
591 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
592 break;
593 case MIDI_CTL_MSB_MAIN_VOLUME:
594 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
595 break;
596 case MIDI_CTL_MSB_PAN:
597 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pan);
598 break;
599 case MIDI_CTL_MSB_EXPRESSION:
600 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
601 break;
602 case MIDI_CTL_VIBRATO_RATE:
603 /* not yet supported */
604 break;
605 case MIDI_CTL_VIBRATO_DEPTH:
606 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
607 break;
608 case MIDI_CTL_VIBRATO_DELAY:
609 /* not yet supported */
610 break;
611 case MIDI_CTL_E1_REVERB_DEPTH:
612 /*
613 * Each OPL4 voice has a bit called "Pseudo-Reverb", but
614 * IMHO _not_ using it enhances the listening experience.
615 */
616 break;
617 case MIDI_CTL_PITCHBEND:
618 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pitch);
619 break;
620 }
621}
622
623void snd_opl4_sysex(void *private_data, unsigned char *buf, int len,
624 int parsed, snd_midi_channel_set_t *chset)
625{
626 opl4_t *opl4 = private_data;
627
628 if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME)
629 snd_opl4_do_for_all(opl4, snd_opl4_update_volume);
630}
diff --git a/sound/drivers/opl4/yrw801.c b/sound/drivers/opl4/yrw801.c
new file mode 100644
index 000000000000..a51174dd3e56
--- /dev/null
+++ b/sound/drivers/opl4/yrw801.c
@@ -0,0 +1,961 @@
1/*
2 * Information about the Yamaha YRW801 wavetable ROM chip
3 *
4 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * Alternatively, this software may be distributed and/or modified under the
17 * terms of the GNU General Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at your option) any later
19 * version.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "opl4_local.h"
35
36int snd_yrw801_detect(opl4_t *opl4)
37{
38 char buf[15];
39
40 snd_opl4_read_memory(opl4, buf, 0x001200, 15);
41 if (memcmp(buf, "CopyrightYAMAHA", 15))
42 return -ENODEV;
43 snd_opl4_read_memory(opl4, buf, 0x1ffffe, 2);
44 if (buf[0] != 0x01)
45 return -ENODEV;
46 snd_printdd("YRW801 ROM version %02x.%02x\n", buf[0], buf[1]);
47 return 0;
48}
49
50/*
51 * The instrument definitions are stored statically because, in practice, the
52 * OPL4 is always coupled with a YRW801. Dynamic instrument loading would be
53 * required if downloading sample data to external SRAM was actually supported
54 * by this driver.
55 */
56
57static const opl4_region_t regions_00[] = { /* Acoustic Grand Piano */
58 {0x14, 0x27, {0x12c,7474,100, 0,0,0x00,0xc8,0x20,0xf2,0x13,0x08,0x0}},
59 {0x28, 0x2d, {0x12d,6816,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
60 {0x2e, 0x33, {0x12e,5899,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
61 {0x34, 0x39, {0x12f,5290,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
62 {0x3a, 0x3f, {0x130,4260,100, 0,0,0x0a,0xc8,0x20,0xf2,0x14,0x08,0x0}},
63 {0x40, 0x45, {0x131,3625,100, 0,0,0x0a,0xc8,0x20,0xf2,0x14,0x08,0x0}},
64 {0x46, 0x4b, {0x132,3116,100, 0,0,0x04,0xc8,0x20,0xf2,0x14,0x08,0x0}},
65 {0x4c, 0x52, {0x133,2081,100, 0,0,0x03,0xc8,0x20,0xf2,0x14,0x18,0x0}},
66 {0x53, 0x58, {0x134,1444,100, 0,0,0x07,0xc8,0x20,0xf3,0x14,0x18,0x0}},
67 {0x59, 0x6d, {0x135,1915,100, 0,0,0x00,0xc8,0x20,0xf4,0x15,0x08,0x0}}
68};
69static const opl4_region_t regions_01[] = { /* Bright Acoustic Piano */
70 {0x14, 0x2d, {0x12c,7474,100, 0,0,0x00,0xc8,0x20,0xf2,0x13,0x08,0x0}},
71 {0x2e, 0x33, {0x12d,6816,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
72 {0x34, 0x39, {0x12e,5899,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
73 {0x3a, 0x3f, {0x12f,5290,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}},
74 {0x40, 0x45, {0x130,4260,100, 0,0,0x0a,0xc8,0x20,0xf2,0x14,0x08,0x0}},
75 {0x46, 0x4b, {0x131,3625,100, 0,0,0x0a,0xc8,0x20,0xf2,0x14,0x08,0x0}},
76 {0x4c, 0x52, {0x132,3116,100, 0,0,0x04,0xc8,0x20,0xf2,0x14,0x08,0x0}},
77 {0x53, 0x58, {0x133,2081,100, 0,0,0x07,0xc8,0x20,0xf2,0x14,0x18,0x0}},
78 {0x59, 0x5e, {0x134,1444,100, 0,0,0x0a,0xc8,0x20,0xf3,0x14,0x18,0x0}},
79 {0x5f, 0x6d, {0x135,1915,100, 0,0,0x00,0xc8,0x20,0xf4,0x15,0x08,0x0}}
80};
81static const opl4_region_t regions_02[] = { /* Electric Grand Piano */
82 {0x14, 0x2d, {0x12c,7476,100, 1,0,0x00,0xae,0x20,0xf2,0x13,0x07,0x0}},
83 {0x2e, 0x33, {0x12d,6818,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
84 {0x34, 0x39, {0x12e,5901,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
85 {0x3a, 0x3f, {0x12f,5292,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
86 {0x40, 0x45, {0x130,4262,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
87 {0x46, 0x4b, {0x131,3627,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
88 {0x4c, 0x52, {0x132,3118,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}},
89 {0x53, 0x58, {0x133,2083,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x17,0x0}},
90 {0x59, 0x5e, {0x134,1446,100, 1,0,0x00,0xae,0x20,0xf3,0x14,0x17,0x0}},
91 {0x5f, 0x6d, {0x135,1917,100, 1,0,0x00,0xae,0x20,0xf4,0x15,0x07,0x0}},
92 {0x00, 0x7f, {0x06c,6375,100,-1,0,0x00,0xc2,0x28,0xf4,0x23,0x18,0x0}}
93};
94static const opl4_region_t regions_03[] = { /* Honky-Tonk Piano */
95 {0x14, 0x27, {0x12c,7474,100, 0,0,0x00,0xb4,0x20,0xf2,0x13,0x08,0x0}},
96 {0x28, 0x2d, {0x12d,6816,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
97 {0x2e, 0x33, {0x12e,5899,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
98 {0x34, 0x39, {0x12f,5290,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
99 {0x3a, 0x3f, {0x130,4260,100, 0,0,0x0a,0xb4,0x20,0xf2,0x14,0x08,0x0}},
100 {0x40, 0x45, {0x131,3625,100, 0,0,0x0a,0xb4,0x20,0xf2,0x14,0x08,0x0}},
101 {0x46, 0x4b, {0x132,3116,100, 0,0,0x04,0xb4,0x20,0xf2,0x14,0x08,0x0}},
102 {0x4c, 0x52, {0x133,2081,100, 0,0,0x03,0xb4,0x20,0xf2,0x14,0x18,0x0}},
103 {0x53, 0x58, {0x134,1444,100, 0,0,0x07,0xb4,0x20,0xf3,0x14,0x18,0x0}},
104 {0x59, 0x6d, {0x135,1915,100, 0,0,0x00,0xb4,0x20,0xf4,0x15,0x08,0x0}},
105 {0x14, 0x27, {0x12c,7486,100, 0,0,0x00,0xb4,0x20,0xf2,0x13,0x08,0x0}},
106 {0x28, 0x2d, {0x12d,6803,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
107 {0x2e, 0x33, {0x12e,5912,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
108 {0x34, 0x39, {0x12f,5275,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}},
109 {0x3a, 0x3f, {0x130,4274,100, 0,0,0x0a,0xb4,0x20,0xf2,0x14,0x08,0x0}},
110 {0x40, 0x45, {0x131,3611,100, 0,0,0x0a,0xb4,0x20,0xf2,0x14,0x08,0x0}},
111 {0x46, 0x4b, {0x132,3129,100, 0,0,0x04,0xb4,0x20,0xf2,0x14,0x08,0x0}},
112 {0x4c, 0x52, {0x133,2074,100, 0,0,0x07,0xb4,0x20,0xf2,0x14,0x18,0x0}},
113 {0x53, 0x58, {0x134,1457,100, 0,0,0x01,0xb4,0x20,0xf3,0x14,0x18,0x0}},
114 {0x59, 0x6d, {0x135,1903,100, 0,0,0x00,0xb4,0x20,0xf4,0x15,0x08,0x0}}
115};
116static const opl4_region_t regions_04[] = { /* Electric Piano 1 */
117 {0x15, 0x6c, {0x00b,6570,100, 0,0,0x00,0x28,0x38,0xf0,0x00,0x0c,0x0}},
118 {0x00, 0x7f, {0x06c,6375,100, 0,2,0x00,0xb0,0x22,0xf4,0x23,0x19,0x0}}
119};
120static const opl4_region_t regions_05[] = { /* Electric Piano 2 */
121 {0x14, 0x27, {0x12c,7476,100, 0,3,0x00,0xa2,0x1b,0xf2,0x13,0x08,0x0}},
122 {0x28, 0x2d, {0x12d,6818,100, 0,3,0x00,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
123 {0x2e, 0x33, {0x12e,5901,100, 0,3,0x00,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
124 {0x34, 0x39, {0x12f,5292,100, 0,3,0x00,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
125 {0x3a, 0x3f, {0x130,4262,100, 0,3,0x0a,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
126 {0x40, 0x45, {0x131,3627,100, 0,3,0x0a,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
127 {0x46, 0x4b, {0x132,3118,100, 0,3,0x04,0xa2,0x1b,0xf2,0x14,0x08,0x0}},
128 {0x4c, 0x52, {0x133,2083,100, 0,3,0x03,0xa2,0x1b,0xf2,0x14,0x18,0x0}},
129 {0x53, 0x58, {0x134,1446,100, 0,3,0x07,0xa2,0x1b,0xf3,0x14,0x18,0x0}},
130 {0x59, 0x6d, {0x135,1917,100, 0,3,0x00,0xa2,0x1b,0xf4,0x15,0x08,0x0}},
131 {0x14, 0x2d, {0x12c,7472,100, 0,0,0x00,0xa2,0x18,0xf2,0x13,0x08,0x0}},
132 {0x2e, 0x33, {0x12d,6814,100, 0,0,0x00,0xa2,0x18,0xf2,0x14,0x08,0x0}},
133 {0x34, 0x39, {0x12e,5897,100, 0,0,0x00,0xa2,0x18,0xf2,0x14,0x08,0x0}},
134 {0x3a, 0x3f, {0x12f,5288,100, 0,0,0x00,0xa2,0x18,0xf2,0x14,0x08,0x0}},
135 {0x40, 0x45, {0x130,4258,100, 0,0,0x0a,0xa2,0x18,0xf2,0x14,0x08,0x0}},
136 {0x46, 0x4b, {0x131,3623,100, 0,0,0x0a,0xa2,0x18,0xf2,0x14,0x08,0x0}},
137 {0x4c, 0x52, {0x132,3114,100, 0,0,0x04,0xa2,0x18,0xf2,0x14,0x08,0x0}},
138 {0x53, 0x58, {0x133,2079,100, 0,0,0x07,0xa2,0x18,0xf2,0x14,0x18,0x0}},
139 {0x59, 0x5e, {0x134,1442,100, 0,0,0x0a,0xa2,0x18,0xf3,0x14,0x18,0x0}},
140 {0x5f, 0x6d, {0x135,1913,100, 0,0,0x00,0xa2,0x18,0xf4,0x15,0x08,0x0}}
141};
142static const opl4_region_t regions_06[] = { /* Harpsichord */
143 {0x15, 0x39, {0x080,5158,100, 0,0,0x00,0xb2,0x20,0xf5,0x24,0x19,0x0}},
144 {0x3a, 0x3f, {0x081,4408,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x09,0x0}},
145 {0x40, 0x45, {0x082,3622,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x09,0x0}},
146 {0x46, 0x4d, {0x083,2843,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x19,0x0}},
147 {0x4e, 0x6c, {0x084,1307,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x29,0x0}}
148};
149static const opl4_region_t regions_07[] = { /* Clavinet */
150 {0x15, 0x51, {0x027,5009,100, 0,0,0x00,0xd2,0x28,0xf5,0x13,0x2b,0x0}},
151 {0x52, 0x6c, {0x028,3495,100, 0,0,0x00,0xd2,0x28,0xf5,0x13,0x3b,0x0}}
152};
153static const opl4_region_t regions_08[] = { /* Celesta */
154 {0x15, 0x6c, {0x02b,3267,100, 0,0,0x00,0xdc,0x20,0xf4,0x15,0x07,0x3}}
155};
156static const opl4_region_t regions_09[] = { /* Glockenspiel */
157 {0x15, 0x78, {0x0f3, 285,100, 0,0,0x00,0xc2,0x28,0xf6,0x25,0x25,0x0}}
158};
159static const opl4_region_t regions_0a[] = { /* Music Box */
160 {0x15, 0x6c, {0x0f3,3362,100, 0,0,0x00,0xb6,0x20,0xa6,0x25,0x25,0x0}},
161 {0x15, 0x6c, {0x101,4773,100, 0,0,0x00,0xaa,0x20,0xd4,0x14,0x16,0x0}}
162};
163static const opl4_region_t regions_0b[] = { /* Vibraphone */
164 {0x15, 0x6c, {0x101,4778,100, 0,0,0x00,0xc0,0x28,0xf4,0x14,0x16,0x4}}
165};
166static const opl4_region_t regions_0c[] = { /* Marimba */
167 {0x15, 0x3f, {0x0f4,4778,100, 0,0,0x00,0xc4,0x38,0xf7,0x47,0x08,0x0}},
168 {0x40, 0x4c, {0x0f5,3217,100, 0,0,0x00,0xc4,0x38,0xf7,0x47,0x08,0x0}},
169 {0x4d, 0x5a, {0x0f5,3217,100, 0,0,0x00,0xc4,0x38,0xf7,0x48,0x08,0x0}},
170 {0x5b, 0x7f, {0x0f5,3218,100, 0,0,0x00,0xc4,0x38,0xf7,0x48,0x18,0x0}}
171};
172static const opl4_region_t regions_0d[] = { /* Xylophone */
173 {0x00, 0x7f, {0x136,1729,100, 0,0,0x00,0xd2,0x38,0xf0,0x06,0x36,0x0}}
174};
175static const opl4_region_t regions_0e[] = { /* Tubular Bell */
176 {0x01, 0x7f, {0x0ff,3999,100, 0,1,0x00,0x90,0x21,0xf4,0xa3,0x25,0x1}}
177};
178static const opl4_region_t regions_0f[] = { /* Dulcimer */
179 {0x00, 0x7f, {0x03f,4236,100, 0,1,0x00,0xbc,0x29,0xf5,0x16,0x07,0x0}},
180 {0x00, 0x7f, {0x040,4236,100, 0,2,0x0e,0x94,0x2a,0xf5,0x16,0x07,0x0}}
181};
182static const opl4_region_t regions_10[] = { /* Drawbar Organ */
183 {0x01, 0x7f, {0x08e,4394,100, 0,2,0x14,0xc2,0x3a,0xf0,0x00,0x0a,0x0}}
184};
185static const opl4_region_t regions_11[] = { /* Percussive Organ */
186 {0x15, 0x3b, {0x08c,6062,100, 0,3,0x00,0xbe,0x3b,0xf0,0x00,0x09,0x0}},
187 {0x3c, 0x6c, {0x08d,2984,100, 0,3,0x00,0xbe,0x3b,0xf0,0x00,0x09,0x0}}
188};
189static const opl4_region_t regions_12[] = { /* Rock Organ */
190 {0x15, 0x30, {0x128,6574,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}},
191 {0x31, 0x3c, {0x129,5040,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}},
192 {0x3d, 0x48, {0x12a,3498,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}},
193 {0x49, 0x54, {0x12b,1957,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}},
194 {0x55, 0x6c, {0x127, 423,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}}
195};
196static const opl4_region_t regions_13[] = { /* Church Organ */
197 {0x15, 0x29, {0x087,7466,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}},
198 {0x2a, 0x30, {0x088,6456,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}},
199 {0x31, 0x38, {0x089,5428,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}},
200 {0x39, 0x41, {0x08a,4408,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}},
201 {0x42, 0x6c, {0x08b,3406,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}}
202};
203static const opl4_region_t regions_14[] = { /* Reed Organ */
204 {0x00, 0x53, {0x0ac,5570,100, 0,0,0x06,0xc0,0x38,0xf0,0x00,0x09,0x1}},
205 {0x54, 0x7f, {0x0ad,2497,100, 0,0,0x00,0xc0,0x38,0xf0,0x00,0x09,0x1}}
206};
207static const opl4_region_t regions_15[] = { /* Accordion */
208 {0x15, 0x4c, {0x006,4261,100, 0,2,0x00,0xa4,0x22,0x90,0x00,0x09,0x0}},
209 {0x4d, 0x6c, {0x007,1530,100, 0,2,0x00,0xa4,0x22,0x90,0x00,0x09,0x0}},
210 {0x15, 0x6c, {0x070,4391,100, 0,3,0x00,0x8a,0x23,0xa0,0x00,0x09,0x0}}
211};
212static const opl4_region_t regions_16[] = { /* Harmonica */
213 {0x15, 0x6c, {0x070,4408,100, 0,0,0x00,0xae,0x30,0xa0,0x00,0x09,0x2}}
214};
215static const opl4_region_t regions_17[] = { /* Tango Accordion */
216 {0x00, 0x53, {0x0ac,5573,100, 0,0,0x00,0xae,0x38,0xf0,0x00,0x09,0x0}},
217 {0x54, 0x7f, {0x0ad,2500,100, 0,0,0x00,0xae,0x38,0xf0,0x00,0x09,0x0}},
218 {0x15, 0x6c, {0x041,8479,100, 0,2,0x00,0x6a,0x3a,0x75,0x20,0x0a,0x0}}
219};
220static const opl4_region_t regions_18[] = { /* Nylon Guitar */
221 {0x15, 0x2f, {0x0b3,6964,100, 0,0,0x05,0xca,0x28,0xf5,0x34,0x09,0x0}},
222 {0x30, 0x36, {0x0b7,5567,100, 0,0,0x0c,0xca,0x28,0xf5,0x34,0x09,0x0}},
223 {0x37, 0x3c, {0x0b5,4653,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}},
224 {0x3d, 0x43, {0x0b4,3892,100, 0,0,0x00,0xca,0x28,0xf6,0x35,0x09,0x0}},
225 {0x44, 0x60, {0x0b6,2723,100, 0,0,0x00,0xca,0x28,0xf6,0x35,0x19,0x0}}
226};
227static const opl4_region_t regions_19[] = { /* Steel Guitar */
228 {0x15, 0x31, {0x00c,6937,100, 0,0,0x00,0xbc,0x28,0xf0,0x04,0x19,0x0}},
229 {0x32, 0x38, {0x00d,5410,100, 0,0,0x00,0xbc,0x28,0xf0,0x05,0x09,0x0}},
230 {0x39, 0x47, {0x00e,4379,100, 0,0,0x00,0xbc,0x28,0xf5,0x94,0x09,0x0}},
231 {0x48, 0x6c, {0x00f,2843,100, 0,0,0x00,0xbc,0x28,0xf6,0x95,0x09,0x0}}
232};
233static const opl4_region_t regions_1a[] = { /* Jazz Guitar */
234 {0x15, 0x31, {0x05a,6832,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}},
235 {0x32, 0x3f, {0x05b,4897,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}},
236 {0x40, 0x6c, {0x05c,3218,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}}
237};
238static const opl4_region_t regions_1b[] = { /* Clean Guitar */
239 {0x15, 0x2c, {0x061,7053,100, 0,1,0x00,0xb4,0x29,0xf5,0x54,0x0a,0x0}},
240 {0x2d, 0x31, {0x060,6434,100, 0,1,0x00,0xb4,0x29,0xf5,0x54,0x0a,0x0}},
241 {0x32, 0x38, {0x063,5764,100, 0,1,0x00,0xbe,0x29,0xf5,0x55,0x0a,0x0}},
242 {0x39, 0x3f, {0x062,4627,100, 0,1,0x00,0xb4,0x29,0xf5,0x55,0x0a,0x0}},
243 {0x40, 0x44, {0x065,3963,100, 0,1,0x00,0xb4,0x29,0xf5,0x55,0x1a,0x0}},
244 {0x45, 0x4b, {0x064,3313,100, 0,1,0x00,0xb4,0x29,0xf5,0x55,0x1a,0x0}},
245 {0x4c, 0x54, {0x066,2462,100, 0,1,0x00,0xb4,0x29,0xf5,0x55,0x2a,0x0}},
246 {0x55, 0x6c, {0x067,1307,100, 0,1,0x00,0xb4,0x29,0xf6,0x56,0x0a,0x0}}
247};
248static const opl4_region_t regions_1c[] = { /* Muted Guitar */
249 {0x01, 0x7f, {0x068,4408,100, 0,0,0x00,0xcc,0x28,0xf6,0x15,0x09,0x0}}
250};
251static const opl4_region_t regions_1d[] = { /* Overdriven Guitar */
252 {0x00, 0x40, {0x0a5,6589,100, 0,1,0x00,0xc0,0x29,0xf2,0x11,0x09,0x0}},
253 {0x41, 0x7f, {0x0a6,5428,100, 0,1,0x00,0xc0,0x29,0xf2,0x11,0x09,0x0}}
254};
255static const opl4_region_t regions_1e[] = { /* Distortion Guitar */
256 {0x15, 0x2a, {0x051,6928,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
257 {0x2b, 0x2e, {0x052,6433,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
258 {0x2f, 0x32, {0x053,5944,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
259 {0x33, 0x36, {0x054,5391,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
260 {0x37, 0x3a, {0x055,4897,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
261 {0x3b, 0x3e, {0x056,4408,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
262 {0x3f, 0x42, {0x057,3892,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
263 {0x43, 0x46, {0x058,3361,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}},
264 {0x47, 0x6c, {0x059,2784,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}}
265};
266static const opl4_region_t regions_1f[] = { /* Guitar Harmonics */
267 {0x15, 0x44, {0x05e,5499,100, 0,0,0x00,0xce,0x28,0xf4,0x24,0x09,0x0}},
268 {0x45, 0x49, {0x05d,4850,100, 0,0,0x00,0xe2,0x28,0xf4,0x24,0x09,0x0}},
269 {0x4a, 0x6c, {0x05f,4259,100, 0,0,0x00,0xce,0x28,0xf4,0x24,0x09,0x0}}
270};
271static const opl4_region_t regions_20[] = { /* Acoustic Bass */
272 {0x15, 0x30, {0x004,8053,100, 0,0,0x00,0xe2,0x18,0xf5,0x15,0x09,0x0}},
273 {0x31, 0x6c, {0x005,4754,100, 0,0,0x00,0xe2,0x18,0xf5,0x15,0x09,0x0}}
274};
275static const opl4_region_t regions_21[] = { /* Fingered Bass */
276 {0x01, 0x20, {0x04a,8762,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}},
277 {0x21, 0x25, {0x04b,8114,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}},
278 {0x26, 0x2a, {0x04c,7475,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}},
279 {0x2b, 0x7f, {0x04d,6841,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}}
280};
281static const opl4_region_t regions_22[] = { /* Picked Bass */
282 {0x15, 0x23, {0x04f,7954,100, 0,0,0x00,0xcc,0x18,0xf3,0x90,0x0a,0x0}},
283 {0x24, 0x2a, {0x050,7318,100, 0,0,0x05,0xcc,0x18,0xf3,0x90,0x1a,0x0}},
284 {0x2b, 0x2f, {0x06b,6654,100, 0,0,0x00,0xcc,0x18,0xf3,0x90,0x2a,0x0}},
285 {0x30, 0x47, {0x069,6031,100, 0,0,0x00,0xcc,0x18,0xf5,0xb0,0x0a,0x0}},
286 {0x48, 0x6c, {0x06a,5393,100, 0,0,0x00,0xcc,0x18,0xf5,0xb0,0x0a,0x0}}
287};
288static const opl4_region_t regions_23[] = { /* Fretless Bass */
289 {0x01, 0x7f, {0x04e,5297,100, 0,0,0x00,0xd2,0x10,0xf3,0x63,0x19,0x0}}
290};
291static const opl4_region_t regions_24[] = { /* Slap Bass 1 */
292 {0x15, 0x6c, {0x0a3,7606,100, 0,1,0x00,0xde,0x19,0xf5,0x32,0x1a,0x0}}
293};
294static const opl4_region_t regions_25[] = { /* Slap Bass 2 */
295 {0x01, 0x7f, {0x0a2,6694,100, 0,0,0x00,0xda,0x20,0xb0,0x02,0x09,0x0}}
296};
297static const opl4_region_t regions_26[] = { /* Synth Bass 1 */
298 {0x15, 0x6c, {0x0be,7466,100, 0,1,0x00,0xb8,0x39,0xf4,0x14,0x09,0x0}}
299};
300static const opl4_region_t regions_27[] = { /* Synth Bass 2 */
301 {0x00, 0x7f, {0x117,8103,100, 0,1,0x00,0xca,0x39,0xf3,0x50,0x08,0x0}}
302};
303static const opl4_region_t regions_28[] = { /* Violin */
304 {0x15, 0x3a, {0x105,5158,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
305 {0x3b, 0x3f, {0x102,4754,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
306 {0x40, 0x41, {0x106,4132,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
307 {0x42, 0x44, {0x107,4033,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
308 {0x45, 0x47, {0x108,3580,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
309 {0x48, 0x4a, {0x10a,2957,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
310 {0x4b, 0x4c, {0x10b,2724,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
311 {0x4d, 0x4e, {0x10c,2530,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
312 {0x4f, 0x51, {0x10d,2166,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}},
313 {0x52, 0x6c, {0x109,1825,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}}
314};
315static const opl4_region_t regions_29[] = { /* Viola */
316 {0x15, 0x32, {0x103,5780,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}},
317 {0x33, 0x35, {0x104,5534,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}},
318 {0x36, 0x38, {0x105,5158,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}},
319 {0x39, 0x3d, {0x102,4754,100, 0,3,0x00,0xca,0x3b,0xa3,0x20,0x09,0x0}},
320 {0x3e, 0x3f, {0x106,4132,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}},
321 {0x40, 0x42, {0x107,4033,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}},
322 {0x43, 0x45, {0x108,3580,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}},
323 {0x46, 0x48, {0x10a,2957,100, 0,3,0x00,0xca,0x3b,0xa3,0x20,0x09,0x0}},
324 {0x49, 0x4a, {0x10b,2724,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}},
325 {0x4b, 0x4c, {0x10c,2530,100, 0,3,0x00,0xca,0x3b,0xa3,0x20,0x09,0x0}},
326 {0x4d, 0x4f, {0x10d,2166,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}},
327 {0x50, 0x6c, {0x109,1825,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}}
328};
329static const opl4_region_t regions_2a[] = { /* Cello */
330 {0x15, 0x2d, {0x112,6545,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x08,0x0}},
331 {0x2e, 0x37, {0x113,5764,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x08,0x0}},
332 {0x38, 0x3e, {0x115,4378,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}},
333 {0x3f, 0x44, {0x116,3998,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}},
334 {0x45, 0x6c, {0x114,3218,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}}
335};
336static const opl4_region_t regions_2b[] = { /* Contrabass */
337 {0x15, 0x29, {0x110,7713,100, 0,1,0x00,0xc2,0x19,0x90,0x00,0x09,0x0}},
338 {0x2a, 0x6c, {0x111,6162,100, 0,1,0x00,0xc2,0x19,0x90,0x00,0x09,0x0}}
339};
340static const opl4_region_t regions_2c[] = { /* Tremolo Strings */
341 {0x15, 0x3b, {0x0b0,4810,100, 0,0,0x0a,0xde,0x38,0xf0,0x00,0x07,0x6}},
342 {0x3c, 0x41, {0x035,4035,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}},
343 {0x42, 0x47, {0x033,3129,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}},
344 {0x48, 0x52, {0x034,2625,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}},
345 {0x53, 0x6c, {0x0af, 936,100, 0,0,0x00,0xde,0x38,0xf0,0x00,0x07,0x6}}
346};
347static const opl4_region_t regions_2d[] = { /* Pizzicato Strings */
348 {0x15, 0x32, {0x0b8,6186,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}},
349 {0x33, 0x3b, {0x0b9,5031,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}},
350 {0x3c, 0x42, {0x0bb,4146,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}},
351 {0x43, 0x48, {0x0ba,3245,100, 0,0,0x00,0xc2,0x28,0xf0,0x00,0x05,0x0}},
352 {0x49, 0x6c, {0x0bc,2352,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}}
353};
354static const opl4_region_t regions_2e[] = { /* Harp */
355 {0x15, 0x46, {0x07e,3740,100, 0,1,0x00,0xd2,0x29,0xf5,0x25,0x07,0x0}},
356 {0x47, 0x6c, {0x07f,2319,100, 0,1,0x00,0xd2,0x29,0xf5,0x25,0x07,0x0}}
357};
358static const opl4_region_t regions_2f[] = { /* Timpani */
359 {0x15, 0x6c, {0x100,6570,100, 0,0,0x00,0xf8,0x28,0xf0,0x05,0x16,0x0}}
360};
361static const opl4_region_t regions_30[] = { /* Strings */
362 {0x15, 0x3b, {0x13c,4806,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}},
363 {0x3c, 0x41, {0x13e,4035,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}},
364 {0x42, 0x47, {0x13d,3122,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}},
365 {0x48, 0x52, {0x13f,2629,100, 0,0,0x00,0xbe,0x20,0x80,0x00,0x07,0x0}},
366 {0x53, 0x6c, {0x140, 950,100, 0,0,0x00,0xbe,0x20,0x80,0x00,0x07,0x0}}
367};
368static const opl4_region_t regions_31[] = { /* Slow Strings */
369 {0x15, 0x3b, {0x0b0,4810,100, 0,1,0x0a,0xbe,0x19,0xf0,0x00,0x07,0x0}},
370 {0x3c, 0x41, {0x035,4035,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}},
371 {0x42, 0x47, {0x033,3129,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}},
372 {0x48, 0x52, {0x034,2625,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}},
373 {0x53, 0x6c, {0x0af, 936,100, 0,1,0x00,0xbe,0x19,0xf0,0x00,0x07,0x0}}
374};
375static const opl4_region_t regions_32[] = { /* Synth Strings 1 */
376 {0x05, 0x71, {0x002,6045,100,-2,0,0x00,0xa6,0x20,0x93,0x22,0x06,0x0}},
377 {0x15, 0x6c, {0x0ae,3261,100, 2,0,0x00,0xc6,0x20,0x70,0x01,0x06,0x0}}
378};
379static const opl4_region_t regions_33[] = { /* Synth Strings 2 */
380 {0x15, 0x6c, {0x002,4513,100, 5,1,0x00,0xb4,0x19,0x70,0x00,0x06,0x0}},
381 {0x15, 0x6c, {0x002,4501,100,-5,1,0x00,0xb4,0x19,0x70,0x00,0x06,0x0}}
382};
383static const opl4_region_t regions_34[] = { /* Choir Aahs */
384 {0x15, 0x3a, {0x018,5010,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}},
385 {0x3b, 0x40, {0x019,4370,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}},
386 {0x41, 0x47, {0x01a,3478,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}},
387 {0x48, 0x6c, {0x01b,2197,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}}
388};
389static const opl4_region_t regions_35[] = { /* Voice Oohs */
390 {0x15, 0x6c, {0x029,3596,100, 0,0,0x00,0xe6,0x20,0xf7,0x20,0x08,0x0}}
391};
392static const opl4_region_t regions_36[] = { /* Synth Voice */
393 {0x15, 0x6c, {0x02a,3482,100, 0,1,0x00,0xc2,0x19,0x85,0x21,0x07,0x0}}
394};
395static const opl4_region_t regions_37[] = { /* Orchestra Hit */
396 {0x15, 0x6c, {0x049,4394,100, 0,0,0x00,0xfe,0x30,0x80,0x05,0x05,0x0}}
397};
398static const opl4_region_t regions_38[] = { /* Trumpet */
399 {0x15, 0x3c, {0x0f6,4706,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}},
400 {0x3d, 0x43, {0x0f8,3894,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}},
401 {0x44, 0x48, {0x0f7,3118,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}},
402 {0x49, 0x4e, {0x0fa,2322,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}},
403 {0x4f, 0x55, {0x0f9,1634,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}},
404 {0x56, 0x6c, {0x0fb, 786,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}}
405};
406static const opl4_region_t regions_39[] = { /* Trombone */
407 {0x15, 0x3a, {0x0f0,5053,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}},
408 {0x3b, 0x3f, {0x0f1,4290,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}},
409 {0x40, 0x6c, {0x0f2,3580,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}}
410};
411static const opl4_region_t regions_3a[] = { /* Tuba */
412 {0x15, 0x2d, {0x085,7096,100, 0,1,0x00,0xde,0x21,0xf5,0x10,0x09,0x0}},
413 {0x2e, 0x6c, {0x086,6014,100, 0,1,0x00,0xde,0x21,0xf5,0x10,0x09,0x0}}
414};
415static const opl4_region_t regions_3b[] = { /* Muted Trumpet */
416 {0x15, 0x45, {0x0b1,4135,100, 0,0,0x00,0xcc,0x28,0xf3,0x10,0x0a,0x1}},
417 {0x46, 0x6c, {0x0b2,2599,100, 0,0,0x00,0xcc,0x28,0x83,0x10,0x0a,0x1}}
418};
419static const opl4_region_t regions_3c[] = { /* French Horns */
420 {0x15, 0x49, {0x07c,3624,100, 0,2,0x00,0xd0,0x1a,0xf0,0x00,0x09,0x0}},
421 {0x4a, 0x6c, {0x07d,2664,100, 0,2,0x00,0xd0,0x1a,0xf0,0x00,0x09,0x0}}
422};
423static const opl4_region_t regions_3d[] = { /* Brass Section */
424 {0x15, 0x42, {0x0fc,4375,100, 0,0,0x00,0xd6,0x28,0xf0,0x00,0x0a,0x0}},
425 {0x43, 0x6c, {0x0fd,2854,100, 0,0,0x00,0xd6,0x28,0xf0,0x00,0x0a,0x0}}
426};
427static const opl4_region_t regions_3e[] = { /* Synth Brass 1 */
428 {0x01, 0x27, {0x0d3,9094,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
429 {0x28, 0x2d, {0x0da,8335,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
430 {0x2e, 0x33, {0x0d4,7558,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
431 {0x34, 0x39, {0x0db,6785,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
432 {0x3a, 0x3f, {0x0d5,6042,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
433 {0x40, 0x45, {0x0dc,5257,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
434 {0x46, 0x4b, {0x0d6,4493,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
435 {0x4c, 0x51, {0x0dd,3741,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
436 {0x52, 0x57, {0x0d7,3012,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
437 {0x58, 0x5d, {0x0de,2167,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
438 {0x5e, 0x63, {0x0d8,1421,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
439 {0x64, 0x7f, {0x0d9,-115,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}},
440 {0x01, 0x27, {0x118,9103,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
441 {0x28, 0x2d, {0x119,8340,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
442 {0x2e, 0x33, {0x11a,7565,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
443 {0x34, 0x39, {0x11b,6804,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
444 {0x3a, 0x3f, {0x11c,6042,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
445 {0x40, 0x45, {0x11d,5277,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
446 {0x46, 0x4b, {0x11e,4520,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
447 {0x4c, 0x51, {0x11f,3741,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
448 {0x52, 0x57, {0x120,3012,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
449 {0x58, 0x5d, {0x121,2166,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
450 {0x5e, 0x64, {0x122,1421,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}},
451 {0x65, 0x7f, {0x123,-115,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}}
452};
453static const opl4_region_t regions_3f[] = { /* Synth Brass 2 */
454 {0x01, 0x27, {0x118,9113,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
455 {0x28, 0x2d, {0x119,8350,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
456 {0x2e, 0x33, {0x11a,7575,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
457 {0x34, 0x39, {0x11b,6814,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
458 {0x3a, 0x3f, {0x11c,6052,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
459 {0x40, 0x45, {0x11d,5287,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
460 {0x46, 0x4b, {0x11e,4530,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
461 {0x4c, 0x51, {0x11f,3751,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
462 {0x52, 0x57, {0x120,3022,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
463 {0x58, 0x5d, {0x121,2176,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
464 {0x5e, 0x64, {0x122,1431,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
465 {0x65, 0x7f, {0x123,-105,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}},
466 {0x00, 0x7f, {0x124,4034,100,-3,2,0x00,0xea,0x22,0x85,0x23,0x08,0x0}}
467};
468static const opl4_region_t regions_40[] = { /* Soprano Sax */
469 {0x15, 0x3f, {0x0e3,4228,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}},
470 {0x40, 0x45, {0x0e4,3495,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}},
471 {0x46, 0x4b, {0x0e5,2660,100, 0,1,0x00,0xd6,0x21,0xf5,0x20,0x0a,0x0}},
472 {0x4c, 0x51, {0x0e6,2002,100, 0,1,0x00,0xd6,0x21,0xf5,0x20,0x0a,0x0}},
473 {0x52, 0x59, {0x0e7,1186,100, 0,1,0x00,0xd6,0x21,0xf5,0x20,0x0a,0x0}},
474 {0x59, 0x6c, {0x0e8,1730,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}}
475};
476static const opl4_region_t regions_41[] = { /* Alto Sax */
477 {0x15, 0x32, {0x092,6204,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
478 {0x33, 0x35, {0x096,5812,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
479 {0x36, 0x3a, {0x099,5318,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
480 {0x3b, 0x3b, {0x08f,5076,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
481 {0x3c, 0x3e, {0x093,4706,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
482 {0x3f, 0x41, {0x097,4321,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
483 {0x42, 0x44, {0x09a,3893,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
484 {0x45, 0x47, {0x090,3497,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
485 {0x48, 0x4a, {0x094,3119,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
486 {0x4b, 0x4d, {0x098,2726,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
487 {0x4e, 0x50, {0x09b,2393,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
488 {0x51, 0x53, {0x091,2088,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}},
489 {0x54, 0x6c, {0x095,1732,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}}
490};
491static const opl4_region_t regions_42[] = { /* Tenor Sax */
492 {0x24, 0x30, {0x0e9,6301,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
493 {0x31, 0x34, {0x0ea,5781,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
494 {0x35, 0x3a, {0x0eb,5053,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
495 {0x3b, 0x41, {0x0ed,4165,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
496 {0x42, 0x47, {0x0ec,3218,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
497 {0x48, 0x51, {0x0ee,2462,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}},
498 {0x52, 0x6c, {0x0ef,1421,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}}
499};
500static const opl4_region_t regions_43[] = { /* Baritone Sax */
501 {0x15, 0x2d, {0x0df,6714,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}},
502 {0x2e, 0x34, {0x0e1,5552,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}},
503 {0x35, 0x39, {0x0e2,5178,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}},
504 {0x3a, 0x6c, {0x0e0,4437,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}}
505};
506static const opl4_region_t regions_44[] = { /* Oboe */
507 {0x15, 0x3c, {0x042,4493,100, 0,1,0x00,0xe6,0x39,0xf4,0x10,0x0a,0x0}},
508 {0x3d, 0x43, {0x044,3702,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}},
509 {0x44, 0x49, {0x043,2956,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}},
510 {0x4a, 0x4f, {0x046,2166,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}},
511 {0x50, 0x55, {0x045,1420,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}},
512 {0x56, 0x6c, {0x047, 630,100, 0,1,0x00,0xe6,0x39,0xf4,0x10,0x0a,0x0}}
513};
514static const opl4_region_t regions_45[] = { /* English Horn */
515 {0x15, 0x38, {0x03c,5098,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}},
516 {0x39, 0x3e, {0x03b,4291,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}},
517 {0x3f, 0x6c, {0x03d,3540,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}}
518};
519static const opl4_region_t regions_46[] = { /* Bassoon */
520 {0x15, 0x22, {0x038,7833,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}},
521 {0x23, 0x2e, {0x03a,7070,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}},
522 {0x2f, 0x6c, {0x039,6302,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}}
523};
524static const opl4_region_t regions_47[] = { /* Clarinet */
525 {0x15, 0x3b, {0x09e,5900,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}},
526 {0x3c, 0x41, {0x0a0,5158,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}},
527 {0x42, 0x4a, {0x09f,4260,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}},
528 {0x4b, 0x6c, {0x0a1,2957,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}}
529};
530static const opl4_region_t regions_48[] = { /* Piccolo */
531 {0x15, 0x40, {0x071,4803,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}},
532 {0x41, 0x4d, {0x072,3314,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}},
533 {0x4e, 0x53, {0x073,1731,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}},
534 {0x54, 0x5f, {0x074,2085,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}},
535 {0x60, 0x6c, {0x075,1421,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}
536};
537static const opl4_region_t regions_49[] = { /* Flute */
538 {0x15, 0x40, {0x071,4803,100, 0,0,0x00,0xdc,0x38,0xf0,0x00,0x0a,0x2}},
539 {0x41, 0x4d, {0x072,3314,100, 0,0,0x00,0xdc,0x38,0xf0,0x00,0x0a,0x2}},
540 {0x4e, 0x6c, {0x073,1731,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}
541};
542static const opl4_region_t regions_4a[] = { /* Recorder */
543 {0x15, 0x6f, {0x0bd,4897,100, 0,0,0x00,0xec,0x30,0x70,0x00,0x09,0x1}}
544};
545static const opl4_region_t regions_4b[] = { /* Pan Flute */
546 {0x15, 0x6c, {0x077,2359,100, 0,0,0x00,0xde,0x38,0xf0,0x00,0x09,0x3}}
547};
548static const opl4_region_t regions_4c[] = { /* Bottle Blow */
549 {0x15, 0x6c, {0x077,2359,100, 0,0,0x00,0xc8,0x38,0xf0,0x00,0x09,0x1}},
550 {0x01, 0x7f, {0x125,7372,100, 0,0,0x1e,0x80,0x00,0xf0,0x00,0x09,0x0}}
551};
552static const opl4_region_t regions_4d[] = { /* Shakuhachi */
553 {0x00, 0x7f, {0x0ab,4548,100, 0,0,0x00,0xd6,0x30,0xf0,0x00,0x0a,0x3}},
554 {0x15, 0x6c, {0x076,3716,100, 0,0,0x00,0xa2,0x28,0x70,0x00,0x09,0x2}}
555};
556static const opl4_region_t regions_4e[] = { /* Whistle */
557 {0x00, 0x7f, {0x0aa,1731,100, 0,4,0x00,0xd2,0x2c,0x70,0x00,0x0a,0x0}}
558};
559static const opl4_region_t regions_4f[] = { /* Ocarina */
560 {0x00, 0x7f, {0x0aa,1731,100, 0,1,0x00,0xce,0x29,0x90,0x00,0x0a,0x1}}
561};
562static const opl4_region_t regions_50[] = { /* Square Lead */
563 {0x01, 0x2a, {0x0cc,9853,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
564 {0x2b, 0x36, {0x0cd,6785,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
565 {0x37, 0x42, {0x0ca,5248,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
566 {0x43, 0x4e, {0x0cf,3713,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
567 {0x4f, 0x5a, {0x0ce,2176,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
568 {0x5b, 0x7f, {0x0cb, 640,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}},
569 {0x01, 0x2a, {0x0cc,9844,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}},
570 {0x2b, 0x36, {0x0cd,6776,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}},
571 {0x37, 0x42, {0x0ca,5239,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}},
572 {0x43, 0x4e, {0x0cf,3704,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}},
573 {0x4f, 0x5a, {0x0ce,2167,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}},
574 {0x5b, 0x7f, {0x0cb, 631,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}}
575};
576static const opl4_region_t regions_51[] = { /* Sawtooth Lead */
577 {0x01, 0x27, {0x118,9108,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
578 {0x28, 0x2d, {0x119,8345,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
579 {0x2e, 0x33, {0x11a,7570,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
580 {0x34, 0x39, {0x11b,6809,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
581 {0x3a, 0x3f, {0x11c,6047,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
582 {0x40, 0x45, {0x11d,5282,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
583 {0x46, 0x4b, {0x11e,4525,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
584 {0x4c, 0x51, {0x11f,3746,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
585 {0x52, 0x57, {0x120,3017,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
586 {0x58, 0x5d, {0x121,2171,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
587 {0x5e, 0x66, {0x122,1426,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
588 {0x67, 0x7f, {0x123,-110,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
589 {0x01, 0x27, {0x118,9098,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
590 {0x28, 0x2d, {0x119,8335,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
591 {0x2e, 0x33, {0x11a,7560,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
592 {0x34, 0x39, {0x11b,6799,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
593 {0x3a, 0x3f, {0x11c,6037,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
594 {0x40, 0x45, {0x11d,5272,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
595 {0x46, 0x4b, {0x11e,4515,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
596 {0x4c, 0x51, {0x11f,3736,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
597 {0x52, 0x57, {0x120,3007,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
598 {0x58, 0x5d, {0x121,2161,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
599 {0x5e, 0x66, {0x122,1416,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}},
600 {0x67, 0x7f, {0x123,-120,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}}
601};
602static const opl4_region_t regions_52[] = { /* Calliope Lead */
603 {0x00, 0x7f, {0x0aa,1731,100, 0,0,0x00,0xc2,0x28,0x90,0x00,0x0a,0x2}},
604 {0x15, 0x6c, {0x076,3716,100, 0,0,0x00,0xb6,0x28,0xb0,0x00,0x09,0x2}}
605};
606static const opl4_region_t regions_53[] = { /* Chiffer Lead */
607 {0x00, 0x7f, {0x13a,3665,100, 0,2,0x00,0xcc,0x2a,0xf0,0x10,0x09,0x1}},
608 {0x01, 0x7f, {0x0fe,3660,100, 0,0,0x00,0xbe,0x28,0xf3,0x10,0x17,0x0}}
609};
610static const opl4_region_t regions_54[] = { /* Charang Lead */
611 {0x00, 0x40, {0x0a5,6594,100, 0,3,0x00,0xba,0x33,0xf2,0x11,0x09,0x0}},
612 {0x41, 0x7f, {0x0a6,5433,100, 0,3,0x00,0xba,0x33,0xf2,0x11,0x09,0x0}},
613 {0x01, 0x27, {0x118,9098,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
614 {0x28, 0x2d, {0x119,8335,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
615 {0x2e, 0x33, {0x11a,7560,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
616 {0x34, 0x39, {0x11b,6799,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
617 {0x3a, 0x3f, {0x11c,6037,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
618 {0x40, 0x45, {0x11d,5272,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
619 {0x46, 0x4b, {0x11e,4515,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
620 {0x4c, 0x51, {0x11f,3736,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
621 {0x52, 0x57, {0x120,3007,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
622 {0x58, 0x5d, {0x121,2161,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
623 {0x5e, 0x66, {0x122,1416,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}},
624 {0x67, 0x7f, {0x123,-120,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}}
625};
626static const opl4_region_t regions_55[] = { /* Voice Lead */
627 {0x00, 0x7f, {0x0aa,1739,100, 0,6,0x00,0x8c,0x2e,0x90,0x00,0x0a,0x0}},
628 {0x15, 0x6c, {0x02a,3474,100, 0,1,0x00,0xd8,0x29,0xf0,0x05,0x0a,0x0}}
629};
630static const opl4_region_t regions_56[] = { /* 5ths Lead */
631 {0x01, 0x27, {0x118,8468,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
632 {0x28, 0x2d, {0x119,7705,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
633 {0x2e, 0x33, {0x11a,6930,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
634 {0x34, 0x39, {0x11b,6169,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
635 {0x3a, 0x3f, {0x11c,5407,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
636 {0x40, 0x45, {0x11d,4642,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
637 {0x46, 0x4b, {0x11e,3885,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
638 {0x4c, 0x51, {0x11f,3106,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
639 {0x52, 0x57, {0x120,2377,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
640 {0x58, 0x5d, {0x121,1531,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
641 {0x5e, 0x64, {0x122, 786,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
642 {0x65, 0x7f, {0x123,-750,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}},
643 {0x05, 0x71, {0x002,4503,100, 0,1,0x00,0xb8,0x31,0xb3,0x20,0x0b,0x0}}
644};
645static const opl4_region_t regions_57[] = { /* Bass & Lead */
646 {0x00, 0x7f, {0x117,8109,100, 0,1,0x00,0xbc,0x29,0xf3,0x50,0x08,0x0}},
647 {0x01, 0x27, {0x118,9097,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
648 {0x28, 0x2d, {0x119,8334,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
649 {0x2e, 0x33, {0x11a,7559,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
650 {0x34, 0x39, {0x11b,6798,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
651 {0x3a, 0x3f, {0x11c,6036,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
652 {0x40, 0x45, {0x11d,5271,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
653 {0x46, 0x4b, {0x11e,4514,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
654 {0x4c, 0x51, {0x11f,3735,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
655 {0x52, 0x57, {0x120,3006,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
656 {0x58, 0x5d, {0x121,2160,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
657 {0x5e, 0x66, {0x122,1415,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}},
658 {0x67, 0x7f, {0x123,-121,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}}
659};
660static const opl4_region_t regions_58[] = { /* New Age Pad */
661 {0x15, 0x6c, {0x002,4501,100, 0,4,0x00,0xa4,0x24,0x80,0x01,0x05,0x0}},
662 {0x15, 0x6c, {0x0f3,4253,100, 0,3,0x00,0x8c,0x23,0xa2,0x14,0x06,0x1}}
663};
664static const opl4_region_t regions_59[] = { /* Warm Pad */
665 {0x15, 0x6c, {0x04e,5306,100, 2,2,0x00,0x92,0x2a,0x34,0x23,0x05,0x2}},
666 {0x15, 0x6c, {0x029,3575,100,-2,2,0x00,0xbe,0x22,0x31,0x23,0x06,0x0}}
667};
668static const opl4_region_t regions_5a[] = { /* Polysynth Pad */
669 {0x01, 0x27, {0x118,9111,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
670 {0x28, 0x2d, {0x119,8348,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
671 {0x2e, 0x33, {0x11a,7573,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
672 {0x34, 0x39, {0x11b,6812,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
673 {0x3a, 0x3f, {0x11c,6050,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
674 {0x40, 0x45, {0x11d,5285,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
675 {0x46, 0x4b, {0x11e,4528,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
676 {0x4c, 0x51, {0x11f,3749,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
677 {0x52, 0x57, {0x120,3020,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
678 {0x58, 0x5d, {0x121,2174,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
679 {0x5e, 0x66, {0x122,1429,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
680 {0x67, 0x7f, {0x123,-107,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}},
681 {0x00, 0x7f, {0x124,4024,100, 0,2,0x00,0xae,0x22,0xe5,0x20,0x08,0x0}}
682};
683static const opl4_region_t regions_5b[] = { /* Choir Pad */
684 {0x15, 0x3a, {0x018,5010,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}},
685 {0x3b, 0x40, {0x019,4370,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}},
686 {0x41, 0x47, {0x01a,3478,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}},
687 {0x48, 0x6c, {0x01b,2197,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}},
688 {0x15, 0x6c, {0x02a,3482,100, 0,4,0x00,0x98,0x24,0x65,0x21,0x06,0x0}}
689};
690static const opl4_region_t regions_5c[] = { /* Bowed Pad */
691 {0x15, 0x6c, {0x101,4790,100,-1,1,0x00,0xbe,0x19,0x44,0x14,0x16,0x0}},
692 {0x00, 0x7f, {0x0aa,1720,100, 1,1,0x00,0x94,0x19,0x40,0x00,0x06,0x0}}
693};
694static const opl4_region_t regions_5d[] = { /* Metallic Pad */
695 {0x15, 0x31, {0x00c,6943,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}},
696 {0x32, 0x38, {0x00d,5416,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}},
697 {0x39, 0x47, {0x00e,4385,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}},
698 {0x48, 0x6c, {0x00f,2849,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}},
699 {0x00, 0x7f, {0x03f,4224,100, 0,1,0x00,0x9c,0x31,0x65,0x16,0x07,0x0}}
700};
701static const opl4_region_t regions_5e[] = { /* Halo Pad */
702 {0x00, 0x7f, {0x124,4038,100, 0,2,0x00,0xa6,0x1a,0x85,0x23,0x08,0x0}},
703 {0x15, 0x6c, {0x02a,3471,100, 0,3,0x00,0xc0,0x1b,0xc0,0x05,0x06,0x0}}
704};
705static const opl4_region_t regions_5f[] = { /* Sweep Pad */
706 {0x01, 0x27, {0x0d3,9100,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
707 {0x28, 0x2d, {0x0da,8341,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
708 {0x2e, 0x33, {0x0d4,7564,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
709 {0x34, 0x39, {0x0db,6791,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
710 {0x3a, 0x3f, {0x0d5,6048,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
711 {0x40, 0x45, {0x0dc,5263,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
712 {0x46, 0x4b, {0x0d6,4499,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
713 {0x4c, 0x51, {0x0dd,3747,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
714 {0x52, 0x57, {0x0d7,3018,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
715 {0x58, 0x5d, {0x0de,2173,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
716 {0x5e, 0x63, {0x0d8,1427,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
717 {0x64, 0x7f, {0x0d9,-109,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}},
718 {0x01, 0x27, {0x0d3,9088,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
719 {0x28, 0x2d, {0x0da,8329,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
720 {0x2e, 0x33, {0x0d4,7552,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
721 {0x34, 0x39, {0x0db,6779,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
722 {0x3a, 0x3f, {0x0d5,6036,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
723 {0x40, 0x45, {0x0dc,5251,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
724 {0x46, 0x4b, {0x0d6,4487,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
725 {0x4c, 0x51, {0x0dd,3735,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
726 {0x52, 0x57, {0x0d7,3006,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
727 {0x58, 0x5d, {0x0de,2161,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
728 {0x5e, 0x63, {0x0d8,1415,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}},
729 {0x64, 0x7f, {0x0d9,-121,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}}
730};
731static const opl4_region_t regions_60[] = { /* Ice Rain */
732 {0x01, 0x7f, {0x04e,9345,100, 0,2,0x00,0xcc,0x22,0xa3,0x63,0x17,0x0}},
733 {0x00, 0x7f, {0x143,5586, 20, 0,2,0x00,0x6e,0x2a,0xf0,0x05,0x05,0x0}}
734};
735static const opl4_region_t regions_61[] = { /* Soundtrack */
736 {0x15, 0x6c, {0x002,4501,100, 0,2,0x00,0xb6,0x2a,0x60,0x01,0x05,0x0}},
737 {0x15, 0x6c, {0x0f3,1160,100, 0,5,0x00,0xa8,0x2d,0x52,0x14,0x06,0x2}}
738};
739static const opl4_region_t regions_62[] = { /* Crystal */
740 {0x15, 0x6c, {0x0f3,1826,100, 0,3,0x00,0xb8,0x33,0xf6,0x25,0x25,0x0}},
741 {0x15, 0x2c, {0x06d,7454,100, 0,3,0x00,0xac,0x3b,0x85,0x24,0x06,0x0}},
742 {0x2d, 0x36, {0x06e,5925,100, 0,3,0x00,0xac,0x3b,0x85,0x24,0x06,0x0}},
743 {0x37, 0x6c, {0x06f,4403,100, 0,3,0x09,0xac,0x3b,0x85,0x24,0x06,0x0}}
744};
745static const opl4_region_t regions_63[] = { /* Atmosphere */
746 {0x05, 0x71, {0x002,4509,100, 0,2,0x00,0xc8,0x32,0x73,0x22,0x06,0x1}},
747 {0x15, 0x2f, {0x0b3,6964,100, 0,2,0x05,0xc2,0x32,0xf5,0x34,0x07,0x2}},
748 {0x30, 0x36, {0x0b7,5567,100, 0,2,0x0c,0xc2,0x32,0xf5,0x34,0x07,0x2}},
749 {0x37, 0x3c, {0x0b5,4653,100, 0,2,0x00,0xc2,0x32,0xf6,0x34,0x07,0x2}},
750 {0x3d, 0x43, {0x0b4,3892,100, 0,2,0x00,0xc2,0x32,0xf6,0x35,0x07,0x2}},
751 {0x44, 0x60, {0x0b6,2723,100, 0,2,0x00,0xc2,0x32,0xf6,0x35,0x17,0x2}}
752};
753static const opl4_region_t regions_64[] = { /* Brightness */
754 {0x00, 0x7f, {0x137,5285,100, 0,2,0x00,0xbe,0x2a,0xa5,0x18,0x08,0x0}},
755 {0x15, 0x6c, {0x02a,3481,100, 0,1,0x00,0xc8,0x29,0x80,0x05,0x05,0x0}}
756};
757static const opl4_region_t regions_65[] = { /* Goblins */
758 {0x15, 0x6c, {0x002,4501,100,-1,2,0x00,0xca,0x2a,0x40,0x01,0x05,0x0}},
759 {0x15, 0x6c, {0x009,9679, 20, 1,4,0x00,0x3c,0x0c,0x22,0x11,0x06,0x0}}
760};
761static const opl4_region_t regions_66[] = { /* Echoes */
762 {0x15, 0x6c, {0x02a,3487,100, 0,3,0x00,0xae,0x2b,0xf5,0x21,0x06,0x0}},
763 {0x00, 0x7f, {0x124,4027,100, 0,3,0x00,0xae,0x2b,0x85,0x23,0x07,0x0}}
764};
765static const opl4_region_t regions_67[] = { /* Sci-Fi */
766 {0x15, 0x31, {0x00c,6940,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}},
767 {0x32, 0x38, {0x00d,5413,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}},
768 {0x39, 0x47, {0x00e,4382,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}},
769 {0x48, 0x6c, {0x00f,2846,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}},
770 {0x15, 0x6c, {0x002,4498,100, 0,2,0x00,0xd4,0x22,0x80,0x01,0x05,0x0}}
771};
772static const opl4_region_t regions_68[] = { /* Sitar */
773 {0x00, 0x7f, {0x10f,4408,100, 0,2,0x00,0xc4,0x32,0xf4,0x15,0x16,0x1}}
774};
775static const opl4_region_t regions_69[] = { /* Banjo */
776 {0x15, 0x34, {0x013,5685,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}},
777 {0x35, 0x38, {0x014,5009,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}},
778 {0x39, 0x3c, {0x012,4520,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}},
779 {0x3d, 0x44, {0x015,3622,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}},
780 {0x45, 0x4c, {0x017,2661,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}},
781 {0x4d, 0x6d, {0x016,1632,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}}
782};
783static const opl4_region_t regions_6a[] = { /* Shamisen */
784 {0x15, 0x6c, {0x10e,3273,100, 0,0,0x00,0xc0,0x28,0xf7,0x76,0x08,0x0}}
785};
786static const opl4_region_t regions_6b[] = { /* Koto */
787 {0x00, 0x7f, {0x0a9,4033,100, 0,0,0x00,0xc6,0x20,0xf0,0x06,0x07,0x0}}
788};
789static const opl4_region_t regions_6c[] = { /* Kalimba */
790 {0x00, 0x7f, {0x137,3749,100, 0,0,0x00,0xce,0x38,0xf5,0x18,0x08,0x0}}
791};
792static const opl4_region_t regions_6d[] = { /* Bagpipe */
793 {0x15, 0x39, {0x0a4,7683,100, 0,4,0x00,0xc0,0x1c,0xf0,0x00,0x09,0x0}},
794 {0x15, 0x39, {0x0a7,7680,100, 0,1,0x00,0xaa,0x19,0xf0,0x00,0x09,0x0}},
795 {0x3a, 0x6c, {0x0a8,3697,100, 0,1,0x00,0xaa,0x19,0xf0,0x00,0x09,0x0}}
796};
797static const opl4_region_t regions_6e[] = { /* Fiddle */
798 {0x15, 0x3a, {0x105,5158,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
799 {0x3b, 0x3f, {0x102,4754,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
800 {0x40, 0x41, {0x106,4132,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
801 {0x42, 0x44, {0x107,4033,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
802 {0x45, 0x47, {0x108,3580,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
803 {0x48, 0x4a, {0x10a,2957,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
804 {0x4b, 0x4c, {0x10b,2724,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
805 {0x4d, 0x4e, {0x10c,2530,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
806 {0x4f, 0x51, {0x10d,2166,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}},
807 {0x52, 0x6c, {0x109,1825,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}}
808};
809static const opl4_region_t regions_6f[] = { /* Shanai */
810 {0x15, 0x6c, {0x041,6946,100, 0,1,0x00,0xc4,0x31,0x95,0x20,0x09,0x0}}
811};
812static const opl4_region_t regions_70[] = { /* Tinkle Bell */
813 {0x15, 0x73, {0x0f3,1821,100, 0,3,0x00,0xc8,0x3b,0xd6,0x25,0x25,0x0}},
814 {0x00, 0x7f, {0x137,5669,100, 0,3,0x00,0x66,0x3b,0xf5,0x18,0x08,0x0}}
815};
816static const opl4_region_t regions_71[] = { /* Agogo */
817 {0x15, 0x74, {0x00b,2474,100, 0,0,0x00,0xd2,0x38,0xf0,0x00,0x09,0x0}}
818};
819static const opl4_region_t regions_72[] = { /* Steel Drums */
820 {0x01, 0x7f, {0x0fe,3670,100, 0,0,0x00,0xca,0x38,0xf3,0x06,0x17,0x1}},
821 {0x15, 0x6c, {0x100,9602,100, 0,0,0x00,0x54,0x38,0xb0,0x05,0x16,0x1}}
822};
823static const opl4_region_t regions_73[] = { /* Woodblock */
824 {0x15, 0x6c, {0x02c,2963, 50, 0,0,0x07,0xd4,0x00,0xf0,0x00,0x09,0x0}}
825};
826static const opl4_region_t regions_74[] = { /* Taiko Drum */
827 {0x13, 0x6c, {0x03e,1194, 50, 0,0,0x00,0xaa,0x38,0xf0,0x04,0x04,0x0}}
828};
829static const opl4_region_t regions_75[] = { /* Melodic Tom */
830 {0x15, 0x6c, {0x0c7,6418, 50, 0,0,0x00,0xe4,0x38,0xf0,0x05,0x01,0x0}}
831};
832static const opl4_region_t regions_76[] = { /* Synth Drum */
833 {0x15, 0x6c, {0x026,3898, 50, 0,0,0x00,0xd0,0x38,0xf0,0x04,0x04,0x0}}
834};
835static const opl4_region_t regions_77[] = { /* Reverse Cymbal */
836 {0x15, 0x6c, {0x031,4138, 50, 0,0,0x00,0xfe,0x38,0x3a,0xf0,0x09,0x0}}
837};
838static const opl4_region_t regions_78[] = { /* Guitar Fret Noise */
839 {0x15, 0x6c, {0x138,5266,100, 0,0,0x00,0xa0,0x38,0xf0,0x00,0x09,0x0}}
840};
841static const opl4_region_t regions_79[] = { /* Breath Noise */
842 {0x01, 0x7f, {0x125,4269,100, 0,0,0x1e,0xd0,0x38,0xf0,0x00,0x09,0x0}}
843};
844static const opl4_region_t regions_7a[] = { /* Seashore */
845 {0x15, 0x6c, {0x008,2965, 20,-2,0,0x00,0xfe,0x00,0x20,0x03,0x04,0x0}},
846 {0x01, 0x7f, {0x037,4394, 20, 2,0,0x14,0xfe,0x00,0x20,0x04,0x05,0x0}}
847};
848static const opl4_region_t regions_7b[] = { /* Bird Tweet */
849 {0x15, 0x6c, {0x009,8078, 5,-4,7,0x00,0xc2,0x0f,0x22,0x12,0x07,0x0}},
850 {0x15, 0x6c, {0x009,3583, 5, 4,5,0x00,0xae,0x15,0x72,0x12,0x07,0x0}}
851};
852static const opl4_region_t regions_7c[] = { /* Telephone Ring */
853 {0x15, 0x6c, {0x003,3602, 10, 0,0,0x00,0xce,0x00,0xf0,0x00,0x0f,0x0}}
854};
855static const opl4_region_t regions_7d[] = { /* Helicopter */
856 {0x0c, 0x7f, {0x001,2965, 10,-2,0,0x00,0xe0,0x08,0x30,0x01,0x07,0x0}},
857 {0x01, 0x7f, {0x037,4394, 10, 2,0,0x44,0x76,0x00,0x30,0x01,0x07,0x0}}
858};
859static const opl4_region_t regions_7e[] = { /* Applause */
860 {0x15, 0x6c, {0x036,8273, 20,-6,7,0x00,0xc4,0x0f,0x70,0x01,0x05,0x0}},
861 {0x15, 0x6c, {0x036,8115, 5, 6,7,0x00,0xc6,0x07,0x70,0x01,0x05,0x0}}
862};
863static const opl4_region_t regions_7f[] = { /* Gun Shot */
864 {0x15, 0x6c, {0x139,2858, 20, 0,0,0x00,0xbe,0x38,0xf0,0x03,0x00,0x0}}
865};
866static const opl4_region_t regions_drums[] = {
867 {0x18, 0x18, {0x0cb,6397,100, 3,0,0x00,0xf4,0x38,0xc9,0x1c,0x0c,0x0}},
868 {0x19, 0x19, {0x0c4,3714,100, 0,0,0x00,0xe0,0x00,0x97,0x19,0x09,0x0}},
869 {0x1a, 0x1a, {0x0c4,3519,100, 0,0,0x00,0xea,0x00,0x61,0x01,0x07,0x0}},
870 {0x1b, 0x1b, {0x0c4,3586,100, 0,0,0x00,0xea,0x00,0xf7,0x19,0x09,0x0}},
871 {0x1c, 0x1c, {0x0c4,3586,100, 0,0,0x00,0xea,0x00,0x81,0x01,0x07,0x0}},
872 {0x1e, 0x1e, {0x0c3,4783,100, 0,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
873 {0x1f, 0x1f, {0x0d1,4042,100, 0,0,0x00,0xd6,0x00,0xf0,0x05,0x05,0x0}},
874 {0x20, 0x20, {0x0d2,5943,100, 0,0,0x00,0xcc,0x00,0xf0,0x00,0x09,0x0}},
875 {0x21, 0x21, {0x011,3842,100, 0,0,0x00,0xea,0x00,0xf0,0x16,0x06,0x0}},
876 {0x23, 0x23, {0x011,4098,100, 0,0,0x00,0xea,0x00,0xf0,0x16,0x06,0x0}},
877 {0x24, 0x24, {0x011,4370,100, 0,0,0x00,0xea,0x00,0xf0,0x00,0x06,0x0}},
878 {0x25, 0x25, {0x0d2,4404,100, 0,0,0x00,0xd6,0x00,0xf0,0x00,0x06,0x0}},
879 {0x26, 0x26, {0x0d1,4298,100, 0,0,0x00,0xd6,0x00,0xf0,0x05,0x05,0x0}},
880 {0x27, 0x27, {0x00a,4403,100,-1,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}},
881 {0x28, 0x28, {0x0d1,4554,100, 0,0,0x00,0xdc,0x00,0xf0,0x07,0x07,0x0}},
882 {0x29, 0x29, {0x0c8,4242,100,-4,0,0x00,0xd6,0x00,0xf6,0x16,0x06,0x0}},
883 {0x2a, 0x2a, {0x079,6160,100, 2,0,0x00,0xe0,0x00,0xf5,0x19,0x09,0x0}},
884 {0x2b, 0x2b, {0x0c8,4626,100,-3,0,0x00,0xd6,0x00,0xf6,0x16,0x06,0x0}},
885 {0x2c, 0x2c, {0x07b,6039,100, 2,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}},
886 {0x2d, 0x2d, {0x0c8,5394,100,-2,0,0x00,0xd6,0x00,0xf6,0x16,0x06,0x0}},
887 {0x2e, 0x2e, {0x07a,5690,100, 2,0,0x00,0xd6,0x00,0xf0,0x00,0x05,0x0}},
888 {0x2f, 0x2f, {0x0c7,5185,100, 2,0,0x00,0xe0,0x00,0xf6,0x17,0x07,0x0}},
889 {0x30, 0x30, {0x0c7,5650,100, 3,0,0x00,0xe0,0x00,0xf6,0x17,0x07,0x0}},
890 {0x31, 0x31, {0x031,4395,100, 2,0,0x00,0xea,0x00,0xf0,0x05,0x05,0x0}},
891 {0x32, 0x32, {0x0c7,6162,100, 4,0,0x00,0xe0,0x00,0xf6,0x17,0x07,0x0}},
892 {0x33, 0x33, {0x02e,4391,100,-2,0,0x00,0xea,0x00,0xf0,0x05,0x05,0x0}},
893 {0x34, 0x34, {0x07a,3009,100,-2,0,0x00,0xea,0x00,0xf2,0x15,0x05,0x0}},
894 {0x35, 0x35, {0x021,4522,100,-3,0,0x00,0xd6,0x00,0xf0,0x05,0x05,0x0}},
895 {0x36, 0x36, {0x025,5163,100, 1,0,0x00,0xe0,0x00,0xf0,0x00,0x09,0x0}},
896 {0x37, 0x37, {0x031,5287,100,-1,0,0x00,0xea,0x00,0xf5,0x16,0x06,0x0}},
897 {0x38, 0x38, {0x01d,4395,100, 2,0,0x00,0xe0,0x00,0xf0,0x00,0x09,0x0}},
898 {0x39, 0x39, {0x031,4647,100,-2,0,0x00,0xea,0x00,0xf4,0x16,0x06,0x0}},
899 {0x3a, 0x3a, {0x09d,4426,100,-4,0,0x00,0xe0,0x00,0xf4,0x17,0x07,0x0}},
900 {0x3b, 0x3b, {0x02e,4659,100,-2,0,0x00,0xea,0x00,0xf0,0x06,0x06,0x0}},
901 {0x3c, 0x3c, {0x01c,4769,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
902 {0x3d, 0x3d, {0x01c,4611,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
903 {0x3e, 0x3e, {0x01e,4402,100,-3,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
904 {0x3f, 0x3f, {0x01f,4387,100,-3,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
905 {0x40, 0x40, {0x01f,3983,100,-2,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
906 {0x41, 0x41, {0x09c,4526,100, 2,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
907 {0x42, 0x42, {0x09c,4016,100, 2,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
908 {0x43, 0x43, {0x00b,4739,100,-4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
909 {0x44, 0x44, {0x00b,4179,100,-4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
910 {0x45, 0x45, {0x02f,4787,100,-4,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}},
911 {0x46, 0x46, {0x030,4665,100,-4,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}},
912 {0x47, 0x47, {0x144,4519,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x0b,0x0}},
913 {0x48, 0x48, {0x144,4111,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x0b,0x0}},
914 {0x49, 0x49, {0x024,6408,100, 3,0,0x00,0xe0,0x00,0xf0,0x00,0x09,0x0}},
915 {0x4a, 0x4a, {0x024,4144,100, 3,0,0x00,0xcc,0x00,0xf0,0x00,0x09,0x0}},
916 {0x4b, 0x4b, {0x020,4001,100, 2,0,0x00,0xe0,0x00,0xf0,0x00,0x09,0x0}},
917 {0x4c, 0x4c, {0x02c,4402,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
918 {0x4d, 0x4d, {0x02c,3612,100, 4,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
919 {0x4e, 0x4e, {0x022,4129,100,-2,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
920 {0x4f, 0x4f, {0x023,4147,100,-2,0,0x00,0xea,0x00,0xf0,0x00,0x09,0x0}},
921 {0x50, 0x50, {0x032,4412,100,-4,0,0x00,0xd6,0x00,0xf0,0x08,0x09,0x0}},
922 {0x51, 0x51, {0x032,4385,100,-4,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}},
923 {0x52, 0x52, {0x02f,5935,100,-1,0,0x00,0xd6,0x00,0xf0,0x00,0x09,0x0}}
924};
925
926#define REGION(num) { ARRAY_SIZE(regions ## num), regions ## num }
927const opl4_region_ptr_t snd_yrw801_regions[0x81] = {
928 REGION(_00), REGION(_01), REGION(_02), REGION(_03),
929 REGION(_04), REGION(_05), REGION(_06), REGION(_07),
930 REGION(_08), REGION(_09), REGION(_0a), REGION(_0b),
931 REGION(_0c), REGION(_0d), REGION(_0e), REGION(_0f),
932 REGION(_10), REGION(_11), REGION(_12), REGION(_13),
933 REGION(_14), REGION(_15), REGION(_16), REGION(_17),
934 REGION(_18), REGION(_19), REGION(_1a), REGION(_1b),
935 REGION(_1c), REGION(_1d), REGION(_1e), REGION(_1f),
936 REGION(_20), REGION(_21), REGION(_22), REGION(_23),
937 REGION(_24), REGION(_25), REGION(_26), REGION(_27),
938 REGION(_28), REGION(_29), REGION(_2a), REGION(_2b),
939 REGION(_2c), REGION(_2d), REGION(_2e), REGION(_2f),
940 REGION(_30), REGION(_31), REGION(_32), REGION(_33),
941 REGION(_34), REGION(_35), REGION(_36), REGION(_37),
942 REGION(_38), REGION(_39), REGION(_3a), REGION(_3b),
943 REGION(_3c), REGION(_3d), REGION(_3e), REGION(_3f),
944 REGION(_40), REGION(_41), REGION(_42), REGION(_43),
945 REGION(_44), REGION(_45), REGION(_46), REGION(_47),
946 REGION(_48), REGION(_49), REGION(_4a), REGION(_4b),
947 REGION(_4c), REGION(_4d), REGION(_4e), REGION(_4f),
948 REGION(_50), REGION(_51), REGION(_52), REGION(_53),
949 REGION(_54), REGION(_55), REGION(_56), REGION(_57),
950 REGION(_58), REGION(_59), REGION(_5a), REGION(_5b),
951 REGION(_5c), REGION(_5d), REGION(_5e), REGION(_5f),
952 REGION(_60), REGION(_61), REGION(_62), REGION(_63),
953 REGION(_64), REGION(_65), REGION(_66), REGION(_67),
954 REGION(_68), REGION(_69), REGION(_6a), REGION(_6b),
955 REGION(_6c), REGION(_6d), REGION(_6e), REGION(_6f),
956 REGION(_70), REGION(_71), REGION(_72), REGION(_73),
957 REGION(_74), REGION(_75), REGION(_76), REGION(_77),
958 REGION(_78), REGION(_79), REGION(_7a), REGION(_7b),
959 REGION(_7c), REGION(_7d), REGION(_7e), REGION(_7f),
960 REGION(_drums)
961};