aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/opl3.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-10-30 06:49:22 -0400
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:13 -0500
commit224a033252bba46c5c8b5df625f5e781ca138f48 (patch)
tree11bb0ad9a3bab736091c73bb46b79d42ee0ff34d /include/sound/opl3.h
parentceac4bf34e14d9040d16b35fd97a92d6e951ccf4 (diff)
[ALSA] opl3 - Use hwdep for patch loading
Use the hwdep device for loading OPL2/3 patch data instead of the messy sequencer instrument layer. Due to this change, the sbiload program should be updated, too. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/opl3.h')
-rw-r--r--include/sound/opl3.h58
1 files changed, 55 insertions, 3 deletions
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 1d14b3f82393..7ee865d6236f 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -63,7 +63,7 @@
63#include "seq_oss_legacy.h" 63#include "seq_oss_legacy.h"
64#endif 64#endif
65#include "seq_device.h" 65#include "seq_device.h"
66#include "ainstr_fm.h" 66#include "asound_fm.h"
67 67
68/* 68/*
69 * Register numbers for the global registers 69 * Register numbers for the global registers
@@ -240,6 +240,47 @@
240struct snd_opl3; 240struct snd_opl3;
241 241
242/* 242/*
243 * Instrument record, aka "Patch"
244 */
245
246/* FM operator */
247struct fm_operator {
248 unsigned char am_vib;
249 unsigned char ksl_level;
250 unsigned char attack_decay;
251 unsigned char sustain_release;
252 unsigned char wave_select;
253} __attribute__((packed));
254
255/* Instrument data */
256struct fm_instrument {
257 struct fm_operator op[4];
258 unsigned char feedback_connection[2];
259 unsigned char echo_delay;
260 unsigned char echo_atten;
261 unsigned char chorus_spread;
262 unsigned char trnsps;
263 unsigned char fix_dur;
264 unsigned char modes;
265 unsigned char fix_key;
266};
267
268/* type */
269#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
270#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
271
272/* Instrument record */
273struct fm_patch {
274 unsigned char prog;
275 unsigned char bank;
276 unsigned char type;
277 struct fm_instrument inst;
278 char name[24];
279 struct fm_patch *next;
280};
281
282
283/*
243 * A structure to keep track of each hardware voice 284 * A structure to keep track of each hardware voice
244 */ 285 */
245struct snd_opl3_voice { 286struct snd_opl3_voice {
@@ -297,8 +338,8 @@ struct snd_opl3 {
297 struct snd_midi_channel_set * oss_chset; 338 struct snd_midi_channel_set * oss_chset;
298#endif 339#endif
299 340
300 struct snd_seq_kinstr_ops fm_ops; 341#define OPL3_PATCH_HASH_SIZE 32
301 struct snd_seq_kinstr_list *ilist; 342 struct fm_patch *patch_table[OPL3_PATCH_HASH_SIZE];
302 343
303 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ 344 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
304 int use_time; /* allocation counter */ 345 int use_time; /* allocation counter */
@@ -333,8 +374,19 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
333int snd_opl3_open(struct snd_hwdep * hw, struct file *file); 374int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
334int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, 375int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
335 unsigned int cmd, unsigned long arg); 376 unsigned int cmd, unsigned long arg);
377long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
378 loff_t *offset);
336int snd_opl3_release(struct snd_hwdep * hw, struct file *file); 379int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
337 380
338void snd_opl3_reset(struct snd_opl3 * opl3); 381void snd_opl3_reset(struct snd_opl3 * opl3);
339 382
383int snd_opl3_load_patch(struct snd_opl3 *opl3,
384 int prog, int bank, int type,
385 const char *name,
386 const unsigned char *ext,
387 const unsigned char *data);
388struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
389 int create_patch);
390void snd_opl3_clear_patches(struct snd_opl3 *opl3);
391
340#endif /* __SOUND_OPL3_H */ 392#endif /* __SOUND_OPL3_H */