• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/sound/synth/emux/

Lines Matching defs:vp

47 static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
48 static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
49 static void setup_voice(struct snd_emux_voice *vp);
50 static int calc_pan(struct snd_emux_voice *vp);
51 static int calc_volume(struct snd_emux_voice *vp);
52 static int calc_pitch(struct snd_emux_voice *vp);
63 struct snd_emux_voice *vp;
98 vp = emu->ops.get_voice(emu, port);
99 if (vp == NULL || vp->ch < 0)
101 if (STATE_IS_PLAYING(vp->state))
102 emu->ops.terminate(vp);
104 vp->time = emu->use_time++;
105 vp->chan = chan;
106 vp->port = port;
107 vp->key = key;
108 vp->note = note;
109 vp->velocity = vel;
110 vp->zone = table[i];
111 if (vp->zone->sample)
112 vp->block = vp->zone->sample->block;
114 vp->block = NULL;
116 setup_voice(vp);
118 vp->state = SNDRV_EMUX_ST_STANDBY;
120 vp->state = SNDRV_EMUX_ST_OFF;
121 if (emu->ops.prepare(vp) >= 0)
122 vp->state = SNDRV_EMUX_ST_STANDBY;
128 vp = &emu->voices[i];
129 if (vp->state == SNDRV_EMUX_ST_STANDBY &&
130 vp->chan == chan) {
131 emu->ops.trigger(vp);
132 vp->state = SNDRV_EMUX_ST_ON;
133 vp->ontime = jiffies; /* remember the trigger timing */
158 struct snd_emux_voice *vp;
172 vp = &emu->voices[ch];
173 if (STATE_IS_PLAYING(vp->state) &&
174 vp->chan == chan && vp->key == note) {
175 vp->state = SNDRV_EMUX_ST_RELEASED;
176 if (vp->ontime == jiffies) {
182 vp->state = SNDRV_EMUX_ST_PENDING;
190 emu->ops.release(vp);
204 struct snd_emux_voice *vp;
210 vp = &emu->voices[ch];
211 if (vp->state == SNDRV_EMUX_ST_PENDING) {
212 if (vp->ontime == jiffies)
215 emu->ops.release(vp);
216 vp->state = SNDRV_EMUX_ST_RELEASED;
237 struct snd_emux_voice *vp;
251 vp = &emu->voices[ch];
252 if (vp->state == SNDRV_EMUX_ST_ON &&
253 vp->chan == chan && vp->key == note) {
254 vp->velocity = vel;
255 update_voice(emu, vp, SNDRV_EMUX_UPDATE_VOLUME);
269 struct snd_emux_voice *vp;
282 vp = &emu->voices[i];
283 if (vp->chan == chan)
284 update_voice(emu, vp, update);
296 struct snd_emux_voice *vp;
309 vp = &emu->voices[i];
310 if (vp->port == port)
311 update_voice(emu, vp, update);
377 struct snd_emux_voice *vp;
382 vp = &emu->voices[i];
383 if (STATE_IS_PLAYING(vp->state) && vp->chan == chan &&
384 vp->key == note)
385 terminate_voice(emu, vp, free);
419 struct snd_emux_voice *vp;
424 vp = &emu->voices[i];
425 if (STATE_IS_PLAYING(vp->state))
426 terminate_voice(emu, vp, 0);
427 if (vp->state == SNDRV_EMUX_ST_OFF) {
429 emu->ops.free_voice(vp);
433 vp->time = 0;
450 struct snd_emux_voice *vp;
461 vp = &emu->voices[i];
462 if (STATE_IS_PLAYING(vp->state) &&
463 vp->port == port)
464 terminate_voice(emu, vp, 0);
465 if (vp->state == SNDRV_EMUX_ST_OFF) {
467 emu->ops.free_voice(vp);
483 struct snd_emux_voice *vp;
489 vp = &emu->voices[i];
490 if (STATE_IS_PLAYING(vp->state) && vp->port == port &&
491 vp->reg.exclusiveClass == exclass) {
492 terminate_voice(emu, vp, 0);
503 terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free)
505 emu->ops.terminate(vp);
506 vp->time = emu->use_time++;
507 vp->chan = NULL;
508 vp->port = NULL;
509 vp->zone = NULL;
510 vp->block = NULL;
511 vp->state = SNDRV_EMUX_ST_OFF;
513 emu->ops.free_voice(vp);
521 update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
523 if (!STATE_IS_PLAYING(vp->state))
526 if (vp->chan == NULL || vp->port == NULL)
529 calc_volume(vp);
531 calc_pitch(vp);
533 if (! calc_pan(vp) && (update == SNDRV_EMUX_UPDATE_PAN))
536 emu->ops.update(vp, update);
549 setup_voice(struct snd_emux_voice *vp)
555 vp->reg = vp->zone->v;
558 snd_emux_setup_effect(vp);
562 vp->apan = -1;
563 vp->avol = -1;
564 vp->apitch = -1;
566 calc_volume(vp);
567 calc_pitch(vp);
568 calc_pan(vp);
570 parm = &vp->reg.parm;
575 pitch = (HI_BYTE(parm->pefe) << 4) + vp->apitch;
579 vp->ftarget = parm->cutoff + LO_BYTE(parm->pefe);
580 LIMITVALUE(vp->ftarget, 0, 255);
581 vp->ftarget <<= 8;
583 vp->ftarget = parm->cutoff;
584 vp->ftarget <<= 8;
585 pitch = vp->apitch;
590 vp->ptarget = 1 << (pitch >> 12);
591 if (pitch & 0x800) vp->ptarget += (vp->ptarget*0x102e)/0x2710;
592 if (pitch & 0x400) vp->ptarget += (vp->ptarget*0x764)/0x2710;
593 if (pitch & 0x200) vp->ptarget += (vp->ptarget*0x389)/0x2710;
594 vp->ptarget += (vp->ptarget >> 1);
595 if (vp->ptarget > 0xffff) vp->ptarget = 0xffff;
597 vp->ptarget = 0xffff;
605 vp->vtarget = 0;
636 calc_pan(struct snd_emux_voice *vp)
638 struct snd_midi_channel *chan = vp->chan;
642 if (vp->reg.fixpan > 0) /* 0-127 */
643 pan = 255 - (int)vp->reg.fixpan * 2;
646 if (vp->reg.pan >= 0) /* 0-127 */
647 pan += vp->reg.pan - 64;
652 if (vp->emu->linear_panning) {
654 if (pan != vp->apan) {
655 vp->apan = pan;
657 vp->aaux = 0xff;
659 vp->aaux = (-pan) & 0xff;
665 if (vp->apan != (int)pan_volumes[pan]) {
666 vp->apan = pan_volumes[pan];
667 vp->aaux = pan_volumes[255 - pan];
737 calc_volume(struct snd_emux_voice *vp)
741 struct snd_midi_channel *chan = vp->chan;
742 struct snd_emux_port *port = vp->port;
745 LIMITMAX(vp->velocity, 127);
750 vol = (vp->velocity * main_vol * expression_vol) / (127*127);
751 vol = vol * vp->reg.amplitude / 127;
759 main_vol = chan->control[MIDI_CTL_MSB_MAIN_VOLUME] * vp->reg.amplitude / 127;
762 vol = voltab1[main_vol] + voltab2[vp->velocity];
764 vol += vp->reg.attenuation;
781 if (vp->avol == vol)
784 vp->avol = vol;
786 && LO_BYTE(vp->reg.parm.volatkhld) < 0x7d) {
788 if (vp->velocity < 70)
791 atten = vp->velocity;
792 vp->acutoff = (atten * vp->reg.parm.cutoff + 0xa0) >> 7;
794 vp->acutoff = vp->reg.parm.cutoff;
808 calc_pitch(struct snd_emux_voice *vp)
810 struct snd_midi_channel *chan = vp->chan;
814 if (vp->reg.fixkey >= 0) {
815 offset = (vp->reg.fixkey - vp->reg.root) * 4096 / 12;
817 offset = (vp->note - vp->reg.root) * 4096 / 12;
819 offset = (offset * vp->reg.scaleTuning) / 100;
820 offset += vp->reg.tune * 4096 / 1200;
844 offset += 0xe000 + vp->reg.rate_offset;
845 offset += vp->emu->pitch_shift;
847 if (offset == vp->apitch)
849 vp->apitch = offset;
913 struct snd_emux_voice *vp;
919 vp = &emu->voices[i];
920 vp->ch = -1; /* not used */
921 vp->state = SNDRV_EMUX_ST_OFF;
922 vp->chan = NULL;
923 vp->port = NULL;
924 vp->time = 0;
925 vp->emu = emu;
926 vp->hw = emu->hw;