Lines Matching full:voice
313 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_note() argument
317 struct opl4_voice *voice; in snd_opl4_do_for_note() local
321 voice = &opl4->voices[i]; in snd_opl4_do_for_note()
322 if (voice->chan == chan && voice->note == note) { in snd_opl4_do_for_note()
323 func(opl4, voice); in snd_opl4_do_for_note()
334 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_channel() argument
338 struct opl4_voice *voice; in snd_opl4_do_for_channel() local
342 voice = &opl4->voices[i]; in snd_opl4_do_for_channel()
343 if (voice->chan == chan) { in snd_opl4_do_for_channel()
344 func(opl4, voice); in snd_opl4_do_for_channel()
354 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) in snd_opl4_do_for_all() argument
358 struct opl4_voice *voice; in snd_opl4_do_for_all() local
362 voice = &opl4->voices[i]; in snd_opl4_do_for_all()
363 if (voice->chan) in snd_opl4_do_for_all()
364 func(opl4, voice); 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
373 att = voice->sound->tone_attenuate; in snd_opl4_update_volume()
375 att += snd_opl4_volume_table[voice->chan->gm_volume & 0x7f]; in snd_opl4_update_volume()
376 att += snd_opl4_volume_table[voice->chan->gm_expression & 0x7f]; in snd_opl4_update_volume()
377 att += snd_opl4_volume_table[voice->velocity]; in snd_opl4_update_volume()
378 att = 0x7f - (0x7f - att) * (voice->sound->volume_factor) / 0xfe - volume_boost; in snd_opl4_update_volume()
383 snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number, in snd_opl4_update_volume()
384 (att << 1) | voice->level_direct); in snd_opl4_update_volume()
385 voice->level_direct = 0; 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
390 int pan = voice->sound->panpot; in snd_opl4_update_pan()
392 if (!voice->chan->drum_channel) in snd_opl4_update_pan()
393 pan += (voice->chan->control[MIDI_CTL_MSB_PAN] - 0x40) >> 3; in snd_opl4_update_pan()
398 voice->reg_misc = (voice->reg_misc & ~OPL4_PAN_POT_MASK) in snd_opl4_update_pan()
400 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_update_pan()
404 struct opl4_voice *voice) in snd_opl4_update_vibrato_depth() argument
408 if (voice->chan->drum_channel) in snd_opl4_update_vibrato_depth()
410 depth = (7 - voice->sound->vibrato) in snd_opl4_update_vibrato_depth()
411 * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f); in snd_opl4_update_vibrato_depth()
412 depth = (depth >> 7) + voice->sound->vibrato; in snd_opl4_update_vibrato_depth()
413 voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK; in snd_opl4_update_vibrato_depth()
414 voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK; in snd_opl4_update_vibrato_depth()
415 snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number, in snd_opl4_update_vibrato_depth()
416 voice->reg_lfo_vibrato); in snd_opl4_update_vibrato_depth()
420 struct opl4_voice *voice) in snd_opl4_update_pitch() argument
422 struct snd_midi_channel *chan = voice->chan; in snd_opl4_update_pitch()
425 note = chan->drum_channel ? 60 : voice->note; in snd_opl4_update_pitch()
430 pitch = ((note - 60) << 7) * voice->sound->key_scaling / 100 + (60 << 7); in snd_opl4_update_pitch()
431 pitch += voice->sound->pitch_offset; in snd_opl4_update_pitch()
443 snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number, in snd_opl4_update_pitch()
445 voice->reg_f_number = (voice->reg_f_number & OPL4_TONE_NUMBER_BIT8) 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()
451 struct opl4_voice *voice) in snd_opl4_update_tone_parameters() argument
453 snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number, in snd_opl4_update_tone_parameters()
454 voice->sound->reg_attack_decay1); in snd_opl4_update_tone_parameters()
455 snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number, in snd_opl4_update_tone_parameters()
456 voice->sound->reg_level_decay2); in snd_opl4_update_tone_parameters()
457 snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number, in snd_opl4_update_tone_parameters()
458 voice->sound->reg_release_correction); in snd_opl4_update_tone_parameters()
459 snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number, in snd_opl4_update_tone_parameters()
460 voice->sound->reg_tremolo); in snd_opl4_update_tone_parameters()
463 /* allocate one voice */
466 /* first, try to get the oldest key-off voice */ in snd_opl4_get_voice()
469 /* then get the oldest key-on voice */ in snd_opl4_get_voice()
486 struct opl4_voice *voice[2]; in snd_opl4_note_on() local
491 /* determine the number of voices and voice parameters */ 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()
508 voice[i]->chan = chan; in snd_opl4_note_on()
509 voice[i]->note = note; in snd_opl4_note_on()
510 voice[i]->velocity = vel & 0x7f; in snd_opl4_note_on()
511 voice[i]->sound = sound[i]; in snd_opl4_note_on()
516 voice[i]->reg_f_number = in snd_opl4_note_on()
518 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number, in snd_opl4_note_on()
519 voice[i]->reg_f_number); in snd_opl4_note_on()
520 snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number, in snd_opl4_note_on()
526 voice[i]->reg_misc = OPL4_LFO_RESET_BIT; 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()
529 voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT; in snd_opl4_note_on()
530 snd_opl4_update_volume(opl4, voice[i]); in snd_opl4_note_on()
540 snd_opl4_update_tone_parameters(opl4, voice[i]); in snd_opl4_note_on()
541 voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato; in snd_opl4_note_on()
542 snd_opl4_update_vibrato_depth(opl4, voice[i]); in snd_opl4_note_on()
547 voice[i]->reg_misc = in snd_opl4_note_on()
548 (voice[i]->reg_misc & 0x1f) | OPL4_KEY_ON_BIT; in snd_opl4_note_on()
549 snd_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number, in snd_opl4_note_on()
550 voice[i]->reg_misc); 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()
559 voice->reg_misc &= ~OPL4_KEY_ON_BIT; in snd_opl4_voice_off()
560 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_voice_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()
574 voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT; in snd_opl4_terminate_voice()
575 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); in snd_opl4_terminate_voice()
614 * Each OPL4 voice has a bit called "Pseudo-Reverb", but in snd_opl4_control()