• Home
  • Raw
  • Download

Lines Matching refs:vp

48 static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
49 static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
50 static void setup_voice(struct snd_emux_voice *vp);
51 static int calc_pan(struct snd_emux_voice *vp);
52 static int calc_volume(struct snd_emux_voice *vp);
53 static int calc_pitch(struct snd_emux_voice *vp);
64 struct snd_emux_voice *vp; in snd_emux_note_on() local
103 vp = emu->ops.get_voice(emu, port); in snd_emux_note_on()
104 if (vp == NULL || vp->ch < 0) in snd_emux_note_on()
106 if (STATE_IS_PLAYING(vp->state)) in snd_emux_note_on()
107 emu->ops.terminate(vp); in snd_emux_note_on()
109 vp->time = emu->use_time++; in snd_emux_note_on()
110 vp->chan = chan; in snd_emux_note_on()
111 vp->port = port; in snd_emux_note_on()
112 vp->key = key; in snd_emux_note_on()
113 vp->note = note; in snd_emux_note_on()
114 vp->velocity = vel; in snd_emux_note_on()
115 vp->zone = table[i]; in snd_emux_note_on()
116 if (vp->zone->sample) in snd_emux_note_on()
117 vp->block = vp->zone->sample->block; in snd_emux_note_on()
119 vp->block = NULL; in snd_emux_note_on()
121 setup_voice(vp); in snd_emux_note_on()
123 vp->state = SNDRV_EMUX_ST_STANDBY; in snd_emux_note_on()
125 vp->state = SNDRV_EMUX_ST_OFF; in snd_emux_note_on()
126 if (emu->ops.prepare(vp) >= 0) in snd_emux_note_on()
127 vp->state = SNDRV_EMUX_ST_STANDBY; in snd_emux_note_on()
133 vp = &emu->voices[i]; in snd_emux_note_on()
134 if (vp->state == SNDRV_EMUX_ST_STANDBY && in snd_emux_note_on()
135 vp->chan == chan) { in snd_emux_note_on()
136 emu->ops.trigger(vp); in snd_emux_note_on()
137 vp->state = SNDRV_EMUX_ST_ON; in snd_emux_note_on()
138 vp->ontime = jiffies; /* remember the trigger timing */ in snd_emux_note_on()
163 struct snd_emux_voice *vp; in snd_emux_note_off() local
177 vp = &emu->voices[ch]; in snd_emux_note_off()
178 if (STATE_IS_PLAYING(vp->state) && in snd_emux_note_off()
179 vp->chan == chan && vp->key == note) { in snd_emux_note_off()
180 vp->state = SNDRV_EMUX_ST_RELEASED; in snd_emux_note_off()
181 if (vp->ontime == jiffies) { in snd_emux_note_off()
187 vp->state = SNDRV_EMUX_ST_PENDING; in snd_emux_note_off()
194 emu->ops.release(vp); in snd_emux_note_off()
208 struct snd_emux_voice *vp; in snd_emux_timer_callback() local
214 vp = &emu->voices[ch]; in snd_emux_timer_callback()
215 if (vp->state == SNDRV_EMUX_ST_PENDING) { in snd_emux_timer_callback()
216 if (vp->ontime == jiffies) in snd_emux_timer_callback()
219 emu->ops.release(vp); in snd_emux_timer_callback()
220 vp->state = SNDRV_EMUX_ST_RELEASED; in snd_emux_timer_callback()
240 struct snd_emux_voice *vp; in snd_emux_key_press() local
254 vp = &emu->voices[ch]; in snd_emux_key_press()
255 if (vp->state == SNDRV_EMUX_ST_ON && in snd_emux_key_press()
256 vp->chan == chan && vp->key == note) { in snd_emux_key_press()
257 vp->velocity = vel; in snd_emux_key_press()
258 update_voice(emu, vp, SNDRV_EMUX_UPDATE_VOLUME); in snd_emux_key_press()
272 struct snd_emux_voice *vp; in snd_emux_update_channel() local
285 vp = &emu->voices[i]; in snd_emux_update_channel()
286 if (vp->chan == chan) in snd_emux_update_channel()
287 update_voice(emu, vp, update); in snd_emux_update_channel()
299 struct snd_emux_voice *vp; in snd_emux_update_port() local
312 vp = &emu->voices[i]; in snd_emux_update_port()
313 if (vp->port == port) in snd_emux_update_port()
314 update_voice(emu, vp, update); in snd_emux_update_port()
381 struct snd_emux_voice *vp; in terminate_note1() local
386 vp = &emu->voices[i]; in terminate_note1()
387 if (STATE_IS_PLAYING(vp->state) && vp->chan == chan && in terminate_note1()
388 vp->key == note) in terminate_note1()
389 terminate_voice(emu, vp, free); in terminate_note1()
423 struct snd_emux_voice *vp; in snd_emux_terminate_all() local
428 vp = &emu->voices[i]; in snd_emux_terminate_all()
429 if (STATE_IS_PLAYING(vp->state)) in snd_emux_terminate_all()
430 terminate_voice(emu, vp, 0); in snd_emux_terminate_all()
431 if (vp->state == SNDRV_EMUX_ST_OFF) { in snd_emux_terminate_all()
433 emu->ops.free_voice(vp); in snd_emux_terminate_all()
437 vp->time = 0; in snd_emux_terminate_all()
454 struct snd_emux_voice *vp; in snd_emux_sounds_off_all() local
465 vp = &emu->voices[i]; in snd_emux_sounds_off_all()
466 if (STATE_IS_PLAYING(vp->state) && in snd_emux_sounds_off_all()
467 vp->port == port) in snd_emux_sounds_off_all()
468 terminate_voice(emu, vp, 0); in snd_emux_sounds_off_all()
469 if (vp->state == SNDRV_EMUX_ST_OFF) { in snd_emux_sounds_off_all()
471 emu->ops.free_voice(vp); in snd_emux_sounds_off_all()
487 struct snd_emux_voice *vp; in exclusive_note_off() local
493 vp = &emu->voices[i]; in exclusive_note_off()
494 if (STATE_IS_PLAYING(vp->state) && vp->port == port && in exclusive_note_off()
495 vp->reg.exclusiveClass == exclass) { in exclusive_note_off()
496 terminate_voice(emu, vp, 0); in exclusive_note_off()
507 terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free) in terminate_voice() argument
509 emu->ops.terminate(vp); in terminate_voice()
510 vp->time = emu->use_time++; in terminate_voice()
511 vp->chan = NULL; in terminate_voice()
512 vp->port = NULL; in terminate_voice()
513 vp->zone = NULL; in terminate_voice()
514 vp->block = NULL; in terminate_voice()
515 vp->state = SNDRV_EMUX_ST_OFF; in terminate_voice()
517 emu->ops.free_voice(vp); in terminate_voice()
525 update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update) in update_voice() argument
527 if (!STATE_IS_PLAYING(vp->state)) in update_voice()
530 if (vp->chan == NULL || vp->port == NULL) in update_voice()
533 calc_volume(vp); in update_voice()
535 calc_pitch(vp); in update_voice()
537 if (! calc_pan(vp) && (update == SNDRV_EMUX_UPDATE_PAN)) in update_voice()
540 emu->ops.update(vp, update); in update_voice()
560 setup_voice(struct snd_emux_voice *vp) in setup_voice() argument
566 vp->reg = vp->zone->v; in setup_voice()
569 snd_emux_setup_effect(vp); in setup_voice()
573 vp->apan = -1; in setup_voice()
574 vp->avol = -1; in setup_voice()
575 vp->apitch = -1; in setup_voice()
577 calc_volume(vp); in setup_voice()
578 calc_pitch(vp); in setup_voice()
579 calc_pan(vp); in setup_voice()
581 parm = &vp->reg.parm; in setup_voice()
586 pitch = (HI_BYTE(parm->pefe) << 4) + vp->apitch; in setup_voice()
590 vp->ftarget = parm->cutoff + LO_BYTE(parm->pefe); in setup_voice()
591 LIMITVALUE(vp->ftarget, 0, 255); in setup_voice()
592 vp->ftarget <<= 8; in setup_voice()
594 vp->ftarget = parm->cutoff; in setup_voice()
595 vp->ftarget <<= 8; in setup_voice()
596 pitch = vp->apitch; in setup_voice()
601 vp->ptarget = 1 << (pitch >> 12); in setup_voice()
602 if (pitch & 0x800) vp->ptarget += (vp->ptarget*0x102e)/0x2710; in setup_voice()
603 if (pitch & 0x400) vp->ptarget += (vp->ptarget*0x764)/0x2710; in setup_voice()
604 if (pitch & 0x200) vp->ptarget += (vp->ptarget*0x389)/0x2710; in setup_voice()
605 vp->ptarget += (vp->ptarget >> 1); in setup_voice()
606 if (vp->ptarget > 0xffff) vp->ptarget = 0xffff; in setup_voice()
608 vp->ptarget = 0xffff; in setup_voice()
616 vp->vtarget = 0; in setup_voice()
620 vp->vtarget = voltarget[vp->avol % 0x10] >> (vp->avol >> 4); in setup_voice()
653 calc_pan(struct snd_emux_voice *vp) in calc_pan() argument
655 struct snd_midi_channel *chan = vp->chan; in calc_pan()
659 if (vp->reg.fixpan > 0) /* 0-127 */ in calc_pan()
660 pan = 255 - (int)vp->reg.fixpan * 2; in calc_pan()
663 if (vp->reg.pan >= 0) /* 0-127 */ in calc_pan()
664 pan += vp->reg.pan - 64; in calc_pan()
669 if (vp->emu->linear_panning) { in calc_pan()
671 if (pan != vp->apan) { in calc_pan()
672 vp->apan = pan; in calc_pan()
674 vp->aaux = 0xff; in calc_pan()
676 vp->aaux = (-pan) & 0xff; in calc_pan()
682 if (vp->apan != (int)pan_volumes[pan]) { in calc_pan()
683 vp->apan = pan_volumes[pan]; in calc_pan()
684 vp->aaux = pan_volumes[255 - pan]; in calc_pan()
754 calc_volume(struct snd_emux_voice *vp) in calc_volume() argument
758 struct snd_midi_channel *chan = vp->chan; in calc_volume()
759 struct snd_emux_port *port = vp->port; in calc_volume()
762 LIMITMAX(vp->velocity, 127); in calc_volume()
767 vol = (vp->velocity * main_vol * expression_vol) / (127*127); in calc_volume()
768 vol = vol * vp->reg.amplitude / 127; in calc_volume()
776 main_vol = chan->control[MIDI_CTL_MSB_MAIN_VOLUME] * vp->reg.amplitude / 127; in calc_volume()
779 vol = voltab1[main_vol] + voltab2[vp->velocity]; in calc_volume()
781 vol += vp->reg.attenuation; in calc_volume()
798 if (vp->avol == vol) in calc_volume()
801 vp->avol = vol; in calc_volume()
803 && LO_BYTE(vp->reg.parm.volatkhld) < 0x7d) { in calc_volume()
805 if (vp->velocity < 70) in calc_volume()
808 atten = vp->velocity; in calc_volume()
809 vp->acutoff = (atten * vp->reg.parm.cutoff + 0xa0) >> 7; in calc_volume()
811 vp->acutoff = vp->reg.parm.cutoff; in calc_volume()
825 calc_pitch(struct snd_emux_voice *vp) in calc_pitch() argument
827 struct snd_midi_channel *chan = vp->chan; in calc_pitch()
831 if (vp->reg.fixkey >= 0) { in calc_pitch()
832 offset = (vp->reg.fixkey - vp->reg.root) * 4096 / 12; in calc_pitch()
834 offset = (vp->note - vp->reg.root) * 4096 / 12; in calc_pitch()
836 offset = (offset * vp->reg.scaleTuning) / 100; in calc_pitch()
837 offset += vp->reg.tune * 4096 / 1200; in calc_pitch()
861 offset += 0xe000 + vp->reg.rate_offset; in calc_pitch()
862 offset += vp->emu->pitch_shift; in calc_pitch()
864 if (offset == vp->apitch) in calc_pitch()
866 vp->apitch = offset; in calc_pitch()
930 struct snd_emux_voice *vp; in snd_emux_init_voices() local
936 vp = &emu->voices[i]; in snd_emux_init_voices()
937 vp->ch = -1; /* not used */ in snd_emux_init_voices()
938 vp->state = SNDRV_EMUX_ST_OFF; in snd_emux_init_voices()
939 vp->chan = NULL; in snd_emux_init_voices()
940 vp->port = NULL; in snd_emux_init_voices()
941 vp->time = 0; in snd_emux_init_voices()
942 vp->emu = emu; in snd_emux_init_voices()
943 vp->hw = emu->hw; in snd_emux_init_voices()