Lines Matching refs:opl4

273 void snd_opl4_synth_reset(struct snd_opl4 *opl4)  in snd_opl4_synth_reset()  argument
278 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_synth_reset()
280 snd_opl4_write(opl4, OPL4_REG_MISC + i, OPL4_DAMP_BIT); in snd_opl4_synth_reset()
281 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_synth_reset()
283 INIT_LIST_HEAD(&opl4->off_voices); in snd_opl4_synth_reset()
284 INIT_LIST_HEAD(&opl4->on_voices); in snd_opl4_synth_reset()
285 memset(opl4->voices, 0, sizeof(opl4->voices)); in snd_opl4_synth_reset()
287 opl4->voices[i].number = i; in snd_opl4_synth_reset()
288 list_add_tail(&opl4->voices[i].list, &opl4->off_voices); in snd_opl4_synth_reset()
291 snd_midi_channel_set_clear(opl4->chset); in snd_opl4_synth_reset()
297 void snd_opl4_synth_shutdown(struct snd_opl4 *opl4) in snd_opl4_synth_shutdown() argument
302 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_synth_shutdown()
304 snd_opl4_write(opl4, OPL4_REG_MISC + i, in snd_opl4_synth_shutdown()
305 opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT); in snd_opl4_synth_shutdown()
306 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_synth_shutdown()
312 static void snd_opl4_do_for_note(struct snd_opl4 *opl4, int note, struct snd_midi_channel *chan, in snd_opl4_do_for_note() argument
313 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_note() argument
319 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_do_for_note()
321 voice = &opl4->voices[i]; in snd_opl4_do_for_note()
323 func(opl4, voice); in snd_opl4_do_for_note()
326 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_do_for_note()
332 static void snd_opl4_do_for_channel(struct snd_opl4 *opl4, in snd_opl4_do_for_channel() argument
334 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_channel() argument
340 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_do_for_channel()
342 voice = &opl4->voices[i]; in snd_opl4_do_for_channel()
344 func(opl4, voice); in snd_opl4_do_for_channel()
347 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_do_for_channel()
353 static void snd_opl4_do_for_all(struct snd_opl4 *opl4, in snd_opl4_do_for_all() argument
354 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_all() argument
360 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_do_for_all()
362 voice = &opl4->voices[i]; in snd_opl4_do_for_all()
364 func(opl4, voice); in snd_opl4_do_for_all()
366 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_do_for_all()
369 static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice) in snd_opl4_update_volume() argument
374 att += snd_opl4_volume_table[opl4->chset->gs_master_volume & 0x7f]; in snd_opl4_update_volume()
383 snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number, in snd_opl4_update_volume()
388 static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice) in snd_opl4_update_pan() argument
400 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_update_pan()
403 static void snd_opl4_update_vibrato_depth(struct snd_opl4 *opl4, in snd_opl4_update_vibrato_depth() argument
415 snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number, in snd_opl4_update_vibrato_depth()
419 static void snd_opl4_update_pitch(struct snd_opl4 *opl4, in snd_opl4_update_pitch() argument
443 snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number, in snd_opl4_update_pitch()
447 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number); in snd_opl4_update_pitch()
450 static void snd_opl4_update_tone_parameters(struct snd_opl4 *opl4, in snd_opl4_update_tone_parameters() argument
453 snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number, in snd_opl4_update_tone_parameters()
455 snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number, in snd_opl4_update_tone_parameters()
457 snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number, in snd_opl4_update_tone_parameters()
459 snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number, in snd_opl4_update_tone_parameters()
464 static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4) in snd_opl4_get_voice() argument
467 if (!list_empty(&opl4->off_voices)) in snd_opl4_get_voice()
468 return list_entry(opl4->off_voices.next, struct opl4_voice, list); in snd_opl4_get_voice()
470 snd_BUG_ON(list_empty(&opl4->on_voices)); in snd_opl4_get_voice()
471 return list_entry(opl4->on_voices.next, struct opl4_voice, list); in snd_opl4_get_voice()
474 static void snd_opl4_wait_for_wave_headers(struct snd_opl4 *opl4) in snd_opl4_wait_for_wave_headers() argument
478 while ((inb(opl4->fm_port) & OPL4_STATUS_LOAD) && --timeout > 0) in snd_opl4_wait_for_wave_headers()
484 struct snd_opl4 *opl4 = private_data; in snd_opl4_note_on() local
504 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_note_on()
506 voice[i] = snd_opl4_get_voice(opl4); in snd_opl4_note_on()
507 list_move_tail(&voice[i]->list, &opl4->on_voices); in snd_opl4_note_on()
518 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number, in snd_opl4_note_on()
520 snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number, in snd_opl4_note_on()
527 snd_opl4_update_pan(opl4, voice[i]); in snd_opl4_note_on()
528 snd_opl4_update_pitch(opl4, voice[i]); in snd_opl4_note_on()
530 snd_opl4_update_volume(opl4, voice[i]); in snd_opl4_note_on()
532 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_note_on()
535 snd_opl4_wait_for_wave_headers(opl4); in snd_opl4_note_on()
538 spin_lock_irqsave(&opl4->reg_lock, flags); in snd_opl4_note_on()
540 snd_opl4_update_tone_parameters(opl4, voice[i]); in snd_opl4_note_on()
542 snd_opl4_update_vibrato_depth(opl4, voice[i]); in snd_opl4_note_on()
549 snd_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number, in snd_opl4_note_on()
552 spin_unlock_irqrestore(&opl4->reg_lock, flags); in snd_opl4_note_on()
555 static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice) in snd_opl4_voice_off() argument
557 list_move_tail(&voice->list, &opl4->off_voices); in snd_opl4_voice_off()
560 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_voice_off()
565 struct snd_opl4 *opl4 = private_data; in snd_opl4_note_off() local
567 snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off); in snd_opl4_note_off()
570 static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice) in snd_opl4_terminate_voice() argument
572 list_move_tail(&voice->list, &opl4->off_voices); in snd_opl4_terminate_voice()
575 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_terminate_voice()
580 struct snd_opl4 *opl4 = private_data; in snd_opl4_terminate_note() local
582 snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice); in snd_opl4_terminate_note()
587 struct snd_opl4 *opl4 = private_data; in snd_opl4_control() local
592 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth); in snd_opl4_control()
595 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume); in snd_opl4_control()
598 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pan); in snd_opl4_control()
601 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume); in snd_opl4_control()
607 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth); in snd_opl4_control()
619 snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pitch); in snd_opl4_control()
627 struct snd_opl4 *opl4 = private_data; in snd_opl4_sysex() local
630 snd_opl4_do_for_all(opl4, snd_opl4_update_volume); in snd_opl4_sysex()