diff options
Diffstat (limited to 'include/sound/opl3.h')
-rw-r--r-- | include/sound/opl3.h | 78 |
1 files changed, 63 insertions, 15 deletions
diff --git a/include/sound/opl3.h b/include/sound/opl3.h index 1d14b3f82393..a0c5febdc4ea 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h | |||
@@ -51,19 +51,16 @@ | |||
51 | * | 51 | * |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #include "driver.h" | 54 | #include <sound/core.h> |
55 | #include <linux/time.h> | 55 | #include <sound/hwdep.h> |
56 | #include <linux/mutex.h> | 56 | #include <sound/timer.h> |
57 | #include "core.h" | 57 | #include <sound/seq_midi_emul.h> |
58 | #include "hwdep.h" | ||
59 | #include "timer.h" | ||
60 | #include "seq_midi_emul.h" | ||
61 | #ifdef CONFIG_SND_SEQUENCER_OSS | 58 | #ifdef CONFIG_SND_SEQUENCER_OSS |
62 | #include "seq_oss.h" | 59 | #include <sound/seq_oss.h> |
63 | #include "seq_oss_legacy.h" | 60 | #include <sound/seq_oss_legacy.h> |
64 | #endif | 61 | #endif |
65 | #include "seq_device.h" | 62 | #include <sound/seq_device.h> |
66 | #include "ainstr_fm.h" | 63 | #include <sound/asound_fm.h> |
67 | 64 | ||
68 | /* | 65 | /* |
69 | * Register numbers for the global registers | 66 | * Register numbers for the global registers |
@@ -240,6 +237,47 @@ | |||
240 | struct snd_opl3; | 237 | struct snd_opl3; |
241 | 238 | ||
242 | /* | 239 | /* |
240 | * Instrument record, aka "Patch" | ||
241 | */ | ||
242 | |||
243 | /* FM operator */ | ||
244 | struct fm_operator { | ||
245 | unsigned char am_vib; | ||
246 | unsigned char ksl_level; | ||
247 | unsigned char attack_decay; | ||
248 | unsigned char sustain_release; | ||
249 | unsigned char wave_select; | ||
250 | } __attribute__((packed)); | ||
251 | |||
252 | /* Instrument data */ | ||
253 | struct fm_instrument { | ||
254 | struct fm_operator op[4]; | ||
255 | unsigned char feedback_connection[2]; | ||
256 | unsigned char echo_delay; | ||
257 | unsigned char echo_atten; | ||
258 | unsigned char chorus_spread; | ||
259 | unsigned char trnsps; | ||
260 | unsigned char fix_dur; | ||
261 | unsigned char modes; | ||
262 | unsigned char fix_key; | ||
263 | }; | ||
264 | |||
265 | /* type */ | ||
266 | #define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ | ||
267 | #define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ | ||
268 | |||
269 | /* Instrument record */ | ||
270 | struct fm_patch { | ||
271 | unsigned char prog; | ||
272 | unsigned char bank; | ||
273 | unsigned char type; | ||
274 | struct fm_instrument inst; | ||
275 | char name[24]; | ||
276 | struct fm_patch *next; | ||
277 | }; | ||
278 | |||
279 | |||
280 | /* | ||
243 | * A structure to keep track of each hardware voice | 281 | * A structure to keep track of each hardware voice |
244 | */ | 282 | */ |
245 | struct snd_opl3_voice { | 283 | struct snd_opl3_voice { |
@@ -277,9 +315,9 @@ struct snd_opl3 { | |||
277 | void *private_data; | 315 | void *private_data; |
278 | void (*private_free)(struct snd_opl3 *); | 316 | void (*private_free)(struct snd_opl3 *); |
279 | 317 | ||
318 | struct snd_hwdep *hwdep; | ||
280 | spinlock_t reg_lock; | 319 | spinlock_t reg_lock; |
281 | struct snd_card *card; /* The card that this belongs to */ | 320 | struct snd_card *card; /* The card that this belongs to */ |
282 | int used; /* usage flag - exclusive */ | ||
283 | unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ | 321 | unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ |
284 | unsigned char rhythm; /* percussion mode flag */ | 322 | unsigned char rhythm; /* percussion mode flag */ |
285 | unsigned char max_voices; /* max number of voices */ | 323 | unsigned char max_voices; /* max number of voices */ |
@@ -297,8 +335,8 @@ struct snd_opl3 { | |||
297 | struct snd_midi_channel_set * oss_chset; | 335 | struct snd_midi_channel_set * oss_chset; |
298 | #endif | 336 | #endif |
299 | 337 | ||
300 | struct snd_seq_kinstr_ops fm_ops; | 338 | #define OPL3_PATCH_HASH_SIZE 32 |
301 | struct snd_seq_kinstr_list *ilist; | 339 | struct fm_patch *patch_table[OPL3_PATCH_HASH_SIZE]; |
302 | 340 | ||
303 | struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ | 341 | struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ |
304 | int use_time; /* allocation counter */ | 342 | int use_time; /* allocation counter */ |
@@ -312,7 +350,6 @@ struct snd_opl3 { | |||
312 | int sys_timer_status; /* system timer run status */ | 350 | int sys_timer_status; /* system timer run status */ |
313 | spinlock_t sys_timer_lock; /* Lock for system timer access */ | 351 | spinlock_t sys_timer_lock; /* Lock for system timer access */ |
314 | #endif | 352 | #endif |
315 | struct mutex access_mutex; /* locking */ | ||
316 | }; | 353 | }; |
317 | 354 | ||
318 | /* opl3.c */ | 355 | /* opl3.c */ |
@@ -333,8 +370,19 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device, | |||
333 | int snd_opl3_open(struct snd_hwdep * hw, struct file *file); | 370 | int snd_opl3_open(struct snd_hwdep * hw, struct file *file); |
334 | int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, | 371 | int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, |
335 | unsigned int cmd, unsigned long arg); | 372 | unsigned int cmd, unsigned long arg); |
373 | long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count, | ||
374 | loff_t *offset); | ||
336 | int snd_opl3_release(struct snd_hwdep * hw, struct file *file); | 375 | int snd_opl3_release(struct snd_hwdep * hw, struct file *file); |
337 | 376 | ||
338 | void snd_opl3_reset(struct snd_opl3 * opl3); | 377 | void snd_opl3_reset(struct snd_opl3 * opl3); |
339 | 378 | ||
379 | int snd_opl3_load_patch(struct snd_opl3 *opl3, | ||
380 | int prog, int bank, int type, | ||
381 | const char *name, | ||
382 | const unsigned char *ext, | ||
383 | const unsigned char *data); | ||
384 | struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank, | ||
385 | int create_patch); | ||
386 | void snd_opl3_clear_patches(struct snd_opl3 *opl3); | ||
387 | |||
340 | #endif /* __SOUND_OPL3_H */ | 388 | #endif /* __SOUND_OPL3_H */ |