Lines Matching full:voice

310 				 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
313 struct opl4_voice *voice;
317 voice = &opl4->voices[i];
318 if (voice->chan == chan && voice->note == note) {
319 func(opl4, voice);
329 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
332 struct opl4_voice *voice;
336 voice = &opl4->voices[i];
337 if (voice->chan == chan) {
338 func(opl4, voice);
347 void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
350 struct opl4_voice *voice;
354 voice = &opl4->voices[i];
355 if (voice->chan)
356 func(opl4, voice);
360 static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice)
364 att = voice->sound->tone_attenuate;
366 att += snd_opl4_volume_table[voice->chan->gm_volume & 0x7f];
367 att += snd_opl4_volume_table[voice->chan->gm_expression & 0x7f];
368 att += snd_opl4_volume_table[voice->velocity];
369 att = 0x7f - (0x7f - att) * (voice->sound->volume_factor) / 0xfe - volume_boost;
374 snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
375 (att << 1) | voice->level_direct);
376 voice->level_direct = 0;
379 static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice)
381 int pan = voice->sound->panpot;
383 if (!voice->chan->drum_channel)
384 pan += (voice->chan->control[MIDI_CTL_MSB_PAN] - 0x40) >> 3;
389 voice->reg_misc = (voice->reg_misc & ~OPL4_PAN_POT_MASK)
391 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
395 struct opl4_voice *voice)
399 if (voice->chan->drum_channel)
401 depth = (7 - voice->sound->vibrato)
402 * (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
403 depth = (depth >> 7) + voice->sound->vibrato;
404 voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
405 voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
406 snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
407 voice->reg_lfo_vibrato);
411 struct opl4_voice *voice)
413 struct snd_midi_channel *chan = voice->chan;
416 note = chan->drum_channel ? 60 : voice->note;
421 pitch = ((note - 60) << 7) * voice->sound->key_scaling / 100 + (60 << 7);
422 pitch += voice->sound->pitch_offset;
434 snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number,
436 voice->reg_f_number = (voice->reg_f_number & OPL4_TONE_NUMBER_BIT8)
438 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number);
442 struct opl4_voice *voice)
444 snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
445 voice->sound->reg_attack_decay1);
446 snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
447 voice->sound->reg_level_decay2);
448 snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number,
449 voice->sound->reg_release_correction);
450 snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number,
451 voice->sound->reg_tremolo);
454 /* allocate one voice */
457 /* first, try to get the oldest key-off voice */
460 /* then get the oldest key-on voice */
477 struct opl4_voice *voice[2];
481 /* determine the number of voices and voice parameters */
496 voice[i] = snd_opl4_get_voice(opl4);
497 list_move_tail(&voice[i]->list, &opl4->on_voices);
498 voice[i]->chan = chan;
499 voice[i]->note = note;
500 voice[i]->velocity = vel & 0x7f;
501 voice[i]->sound = sound[i];
506 voice[i]->reg_f_number =
508 snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number,
509 voice[i]->reg_f_number);
510 snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number,
516 voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
517 snd_opl4_update_pan(opl4, voice[i]);
518 snd_opl4_update_pitch(opl4, voice[i]);
519 voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
520 snd_opl4_update_volume(opl4, voice[i]);
530 snd_opl4_update_tone_parameters(opl4, voice[i]);
531 voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
532 snd_opl4_update_vibrato_depth(opl4, voice[i]);
537 voice[i]->reg_misc =
538 (voice[i]->reg_misc & 0x1f) | OPL4_KEY_ON_BIT;
539 snd_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number,
540 voice[i]->reg_misc);
544 static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice)
546 list_move_tail(&voice->list, &opl4->off_voices);
548 voice->reg_misc &= ~OPL4_KEY_ON_BIT;
549 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
559 static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice)
561 list_move_tail(&voice->list, &opl4->off_voices);
563 voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT;
564 snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
603 * Each OPL4 voice has a bit called "Pseudo-Reverb", but