aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/asound_fm.h19
-rw-r--r--include/sound/opl3.h58
2 files changed, 74 insertions, 3 deletions
diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
index 8fbcab7cc73b..c2a4b967d5be 100644
--- a/include/sound/asound_fm.h
+++ b/include/sound/asound_fm.h
@@ -104,6 +104,8 @@ struct snd_dm_fm_params {
104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
105/* for OPL3 only */ 105/* for OPL3 only */
106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
107/* SBI patch management */
108#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
107 109
108#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 110#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
109#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 111#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
@@ -112,4 +114,21 @@ struct snd_dm_fm_params {
112#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 114#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
113#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 115#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
114 116
117/*
118 * Patch Record - fixed size for write
119 */
120
121#define FM_KEY_SBI "SBI\032"
122#define FM_KEY_2OP "2OP\032"
123#define FM_KEY_4OP "4OP\032"
124
125struct sbi_patch {
126 unsigned char prog;
127 unsigned char bank;
128 char key[4];
129 char name[25];
130 char extension[7];
131 unsigned char data[32];
132};
133
115#endif /* __SOUND_ASOUND_FM_H */ 134#endif /* __SOUND_ASOUND_FM_H */
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 */