diff options
Diffstat (limited to 'sound/drivers/opl4/opl4_synth.c')
-rw-r--r-- | sound/drivers/opl4/opl4_synth.c | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/sound/drivers/opl4/opl4_synth.c b/sound/drivers/opl4/opl4_synth.c index b146a1c995d9..74f6e53eae0d 100644 --- a/sound/drivers/opl4/opl4_synth.c +++ b/sound/drivers/opl4/opl4_synth.c | |||
@@ -270,7 +270,7 @@ static unsigned char snd_opl4_volume_table[128] = { | |||
270 | /* | 270 | /* |
271 | * Initializes all voices. | 271 | * Initializes all voices. |
272 | */ | 272 | */ |
273 | void snd_opl4_synth_reset(opl4_t *opl4) | 273 | void snd_opl4_synth_reset(struct snd_opl4 *opl4) |
274 | { | 274 | { |
275 | unsigned long flags; | 275 | unsigned long flags; |
276 | int i; | 276 | int i; |
@@ -294,7 +294,7 @@ void snd_opl4_synth_reset(opl4_t *opl4) | |||
294 | /* | 294 | /* |
295 | * Shuts down all voices. | 295 | * Shuts down all voices. |
296 | */ | 296 | */ |
297 | void snd_opl4_synth_shutdown(opl4_t *opl4) | 297 | void snd_opl4_synth_shutdown(struct snd_opl4 *opl4) |
298 | { | 298 | { |
299 | unsigned long flags; | 299 | unsigned long flags; |
300 | int i; | 300 | int i; |
@@ -309,12 +309,12 @@ void snd_opl4_synth_shutdown(opl4_t *opl4) | |||
309 | /* | 309 | /* |
310 | * Executes the callback for all voices playing the specified note. | 310 | * Executes the callback for all voices playing the specified note. |
311 | */ | 311 | */ |
312 | static void snd_opl4_do_for_note(opl4_t *opl4, int note, snd_midi_channel_t *chan, | 312 | static void snd_opl4_do_for_note(struct snd_opl4 *opl4, int note, struct snd_midi_channel *chan, |
313 | void (*func)(opl4_t *opl4, opl4_voice_t *voice)) | 313 | void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) |
314 | { | 314 | { |
315 | int i; | 315 | int i; |
316 | unsigned long flags; | 316 | unsigned long flags; |
317 | opl4_voice_t *voice; | 317 | struct opl4_voice *voice; |
318 | 318 | ||
319 | spin_lock_irqsave(&opl4->reg_lock, flags); | 319 | spin_lock_irqsave(&opl4->reg_lock, flags); |
320 | for (i = 0; i < OPL4_MAX_VOICES; i++) { | 320 | for (i = 0; i < OPL4_MAX_VOICES; i++) { |
@@ -329,12 +329,13 @@ static void snd_opl4_do_for_note(opl4_t *opl4, int note, snd_midi_channel_t *cha | |||
329 | /* | 329 | /* |
330 | * Executes the callback for all voices of to the specified channel. | 330 | * Executes the callback for all voices of to the specified channel. |
331 | */ | 331 | */ |
332 | static void snd_opl4_do_for_channel(opl4_t *opl4, snd_midi_channel_t *chan, | 332 | static void snd_opl4_do_for_channel(struct snd_opl4 *opl4, |
333 | void (*func)(opl4_t *opl4, opl4_voice_t *voice)) | 333 | struct snd_midi_channel *chan, |
334 | void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) | ||
334 | { | 335 | { |
335 | int i; | 336 | int i; |
336 | unsigned long flags; | 337 | unsigned long flags; |
337 | opl4_voice_t *voice; | 338 | struct opl4_voice *voice; |
338 | 339 | ||
339 | spin_lock_irqsave(&opl4->reg_lock, flags); | 340 | spin_lock_irqsave(&opl4->reg_lock, flags); |
340 | for (i = 0; i < OPL4_MAX_VOICES; i++) { | 341 | for (i = 0; i < OPL4_MAX_VOICES; i++) { |
@@ -349,12 +350,12 @@ static void snd_opl4_do_for_channel(opl4_t *opl4, snd_midi_channel_t *chan, | |||
349 | /* | 350 | /* |
350 | * Executes the callback for all active voices. | 351 | * Executes the callback for all active voices. |
351 | */ | 352 | */ |
352 | static void snd_opl4_do_for_all(opl4_t *opl4, | 353 | static void snd_opl4_do_for_all(struct snd_opl4 *opl4, |
353 | void (*func)(opl4_t *opl4, opl4_voice_t *voice)) | 354 | void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) |
354 | { | 355 | { |
355 | int i; | 356 | int i; |
356 | unsigned long flags; | 357 | unsigned long flags; |
357 | opl4_voice_t *voice; | 358 | struct opl4_voice *voice; |
358 | 359 | ||
359 | spin_lock_irqsave(&opl4->reg_lock, flags); | 360 | spin_lock_irqsave(&opl4->reg_lock, flags); |
360 | for (i = 0; i < OPL4_MAX_VOICES; i++) { | 361 | for (i = 0; i < OPL4_MAX_VOICES; i++) { |
@@ -365,7 +366,7 @@ static void snd_opl4_do_for_all(opl4_t *opl4, | |||
365 | spin_unlock_irqrestore(&opl4->reg_lock, flags); | 366 | spin_unlock_irqrestore(&opl4->reg_lock, flags); |
366 | } | 367 | } |
367 | 368 | ||
368 | static void snd_opl4_update_volume(opl4_t *opl4, opl4_voice_t *voice) | 369 | static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice) |
369 | { | 370 | { |
370 | int att; | 371 | int att; |
371 | 372 | ||
@@ -384,7 +385,7 @@ static void snd_opl4_update_volume(opl4_t *opl4, opl4_voice_t *voice) | |||
384 | voice->level_direct = 0; | 385 | voice->level_direct = 0; |
385 | } | 386 | } |
386 | 387 | ||
387 | static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice) | 388 | static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice) |
388 | { | 389 | { |
389 | int pan = voice->sound->panpot; | 390 | int pan = voice->sound->panpot; |
390 | 391 | ||
@@ -399,7 +400,8 @@ static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice) | |||
399 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); | 400 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); |
400 | } | 401 | } |
401 | 402 | ||
402 | static void snd_opl4_update_vibrato_depth(opl4_t *opl4, opl4_voice_t *voice) | 403 | static void snd_opl4_update_vibrato_depth(struct snd_opl4 *opl4, |
404 | struct opl4_voice *voice) | ||
403 | { | 405 | { |
404 | int depth; | 406 | int depth; |
405 | 407 | ||
@@ -414,9 +416,10 @@ static void snd_opl4_update_vibrato_depth(opl4_t *opl4, opl4_voice_t *voice) | |||
414 | voice->reg_lfo_vibrato); | 416 | voice->reg_lfo_vibrato); |
415 | } | 417 | } |
416 | 418 | ||
417 | static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice) | 419 | static void snd_opl4_update_pitch(struct snd_opl4 *opl4, |
420 | struct opl4_voice *voice) | ||
418 | { | 421 | { |
419 | snd_midi_channel_t *chan = voice->chan; | 422 | struct snd_midi_channel *chan = voice->chan; |
420 | int note, pitch, octave; | 423 | int note, pitch, octave; |
421 | 424 | ||
422 | note = chan->drum_channel ? 60 : voice->note; | 425 | note = chan->drum_channel ? 60 : voice->note; |
@@ -444,7 +447,8 @@ static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice) | |||
444 | snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number); | 447 | snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number); |
445 | } | 448 | } |
446 | 449 | ||
447 | static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice) | 450 | static void snd_opl4_update_tone_parameters(struct snd_opl4 *opl4, |
451 | struct opl4_voice *voice) | ||
448 | { | 452 | { |
449 | snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number, | 453 | snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number, |
450 | voice->sound->reg_attack_decay1); | 454 | voice->sound->reg_attack_decay1); |
@@ -457,17 +461,17 @@ static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice) | |||
457 | } | 461 | } |
458 | 462 | ||
459 | /* allocate one voice */ | 463 | /* allocate one voice */ |
460 | static opl4_voice_t *snd_opl4_get_voice(opl4_t *opl4) | 464 | static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4) |
461 | { | 465 | { |
462 | /* first, try to get the oldest key-off voice */ | 466 | /* first, try to get the oldest key-off voice */ |
463 | if (!list_empty(&opl4->off_voices)) | 467 | if (!list_empty(&opl4->off_voices)) |
464 | return list_entry(opl4->off_voices.next, opl4_voice_t, list); | 468 | return list_entry(opl4->off_voices.next, struct opl4_voice, list); |
465 | /* then get the oldest key-on voice */ | 469 | /* then get the oldest key-on voice */ |
466 | snd_assert(!list_empty(&opl4->on_voices), ); | 470 | snd_assert(!list_empty(&opl4->on_voices), ); |
467 | return list_entry(opl4->on_voices.next, opl4_voice_t, list); | 471 | return list_entry(opl4->on_voices.next, struct opl4_voice, list); |
468 | } | 472 | } |
469 | 473 | ||
470 | static void snd_opl4_wait_for_wave_headers(opl4_t *opl4) | 474 | static void snd_opl4_wait_for_wave_headers(struct snd_opl4 *opl4) |
471 | { | 475 | { |
472 | int timeout = 200; | 476 | int timeout = 200; |
473 | 477 | ||
@@ -475,12 +479,12 @@ static void snd_opl4_wait_for_wave_headers(opl4_t *opl4) | |||
475 | udelay(10); | 479 | udelay(10); |
476 | } | 480 | } |
477 | 481 | ||
478 | void snd_opl4_note_on(void *private_data, int note, int vel, snd_midi_channel_t *chan) | 482 | void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_channel *chan) |
479 | { | 483 | { |
480 | opl4_t *opl4 = private_data; | 484 | struct snd_opl4 *opl4 = private_data; |
481 | const opl4_region_ptr_t *regions; | 485 | const struct opl4_region_ptr *regions; |
482 | opl4_voice_t *voice[2]; | 486 | struct opl4_voice *voice[2]; |
483 | const opl4_sound_t *sound[2]; | 487 | const struct opl4_sound *sound[2]; |
484 | int voices = 0, i; | 488 | int voices = 0, i; |
485 | unsigned long flags; | 489 | unsigned long flags; |
486 | 490 | ||
@@ -549,7 +553,7 @@ void snd_opl4_note_on(void *private_data, int note, int vel, snd_midi_channel_t | |||
549 | spin_unlock_irqrestore(&opl4->reg_lock, flags); | 553 | spin_unlock_irqrestore(&opl4->reg_lock, flags); |
550 | } | 554 | } |
551 | 555 | ||
552 | static void snd_opl4_voice_off(opl4_t *opl4, opl4_voice_t *voice) | 556 | static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice) |
553 | { | 557 | { |
554 | list_del(&voice->list); | 558 | list_del(&voice->list); |
555 | list_add_tail(&voice->list, &opl4->off_voices); | 559 | list_add_tail(&voice->list, &opl4->off_voices); |
@@ -558,14 +562,14 @@ static void snd_opl4_voice_off(opl4_t *opl4, opl4_voice_t *voice) | |||
558 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); | 562 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); |
559 | } | 563 | } |
560 | 564 | ||
561 | void snd_opl4_note_off(void *private_data, int note, int vel, snd_midi_channel_t *chan) | 565 | void snd_opl4_note_off(void *private_data, int note, int vel, struct snd_midi_channel *chan) |
562 | { | 566 | { |
563 | opl4_t *opl4 = private_data; | 567 | struct snd_opl4 *opl4 = private_data; |
564 | 568 | ||
565 | snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off); | 569 | snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off); |
566 | } | 570 | } |
567 | 571 | ||
568 | static void snd_opl4_terminate_voice(opl4_t *opl4, opl4_voice_t *voice) | 572 | static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice) |
569 | { | 573 | { |
570 | list_del(&voice->list); | 574 | list_del(&voice->list); |
571 | list_add_tail(&voice->list, &opl4->off_voices); | 575 | list_add_tail(&voice->list, &opl4->off_voices); |
@@ -574,16 +578,16 @@ static void snd_opl4_terminate_voice(opl4_t *opl4, opl4_voice_t *voice) | |||
574 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); | 578 | snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); |
575 | } | 579 | } |
576 | 580 | ||
577 | void snd_opl4_terminate_note(void *private_data, int note, snd_midi_channel_t *chan) | 581 | void snd_opl4_terminate_note(void *private_data, int note, struct snd_midi_channel *chan) |
578 | { | 582 | { |
579 | opl4_t *opl4 = private_data; | 583 | struct snd_opl4 *opl4 = private_data; |
580 | 584 | ||
581 | snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice); | 585 | snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice); |
582 | } | 586 | } |
583 | 587 | ||
584 | void snd_opl4_control(void *private_data, int type, snd_midi_channel_t *chan) | 588 | void snd_opl4_control(void *private_data, int type, struct snd_midi_channel *chan) |
585 | { | 589 | { |
586 | opl4_t *opl4 = private_data; | 590 | struct snd_opl4 *opl4 = private_data; |
587 | 591 | ||
588 | switch (type) { | 592 | switch (type) { |
589 | case MIDI_CTL_MSB_MODWHEEL: | 593 | case MIDI_CTL_MSB_MODWHEEL: |
@@ -621,9 +625,9 @@ void snd_opl4_control(void *private_data, int type, snd_midi_channel_t *chan) | |||
621 | } | 625 | } |
622 | 626 | ||
623 | void snd_opl4_sysex(void *private_data, unsigned char *buf, int len, | 627 | void snd_opl4_sysex(void *private_data, unsigned char *buf, int len, |
624 | int parsed, snd_midi_channel_set_t *chset) | 628 | int parsed, struct snd_midi_channel_set *chset) |
625 | { | 629 | { |
626 | opl4_t *opl4 = private_data; | 630 | struct snd_opl4 *opl4 = private_data; |
627 | 631 | ||
628 | if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME) | 632 | if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME) |
629 | snd_opl4_do_for_all(opl4, snd_opl4_update_volume); | 633 | snd_opl4_do_for_all(opl4, snd_opl4_update_volume); |