Lines Matching full:voice
35 struct snd_trident_voice * voice,
38 struct snd_trident_voice * voice,
53 static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice)
57 dev_dbg(trident->card->dev, "Trident voice %i:\n", voice);
58 outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR));
274 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
276 Description: Start a voice, any channel 0 thru 63.
280 Parameters : voice - Voice number 0 thru n.
287 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
289 unsigned int mask = 1 << (voice & 0x1f);
290 unsigned int reg = (voice & 0x20) ? T4D_START_B : T4D_START_A;
298 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
300 Description: Stop a voice, any channel 0 thru 63.
304 Parameters : voice - Voice number 0 thru n.
311 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
313 unsigned int mask = 1 << (voice & 0x1f);
314 unsigned int reg = (voice & 0x20) ? T4D_STOP_B : T4D_STOP_A;
426 voice - synthesizer voice structure
432 struct snd_trident_voice * voice)
437 regs[1] = voice->LBA;
438 regs[4] = (voice->GVSel << 31) |
439 ((voice->Pan & 0x0000007f) << 24) |
440 ((voice->CTRL & 0x0000000f) << 12);
441 FmcRvolCvol = ((voice->FMC & 3) << 14) |
442 ((voice->RVol & 0x7f) << 7) |
443 (voice->CVol & 0x7f);
447 regs[4] |= voice->number > 31 ?
448 (voice->Vol & 0x000003ff) :
449 ((voice->Vol & 0x00003fc) << (16-2)) |
450 (voice->EC & 0x00000fff);
451 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
452 (voice->FMS & 0x0000000f);
453 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
454 regs[3] = (voice->Attribute << 16) | FmcRvolCvol;
457 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
458 (voice->EC & 0x00000fff);
459 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
460 (voice->FMS & 0x0000000f);
461 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
465 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
466 (voice->EC & 0x00000fff);
467 regs[0] = (voice->Delta << 24) | (voice->CSO & 0x00ffffff);
468 regs[2] = ((voice->Delta << 16) & 0xff000000) |
469 (voice->ESO & 0x00ffffff);
470 regs[3] = (voice->Alpha << 20) |
471 ((voice->FMS & 0x0000000f) << 16) | FmcRvolCvol;
478 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
486 dev_dbg(trident->card->dev, "written %i channel:\n", voice->number);
509 voice - synthesizer voice structure
515 struct snd_trident_voice * voice,
518 voice->CSO = CSO;
519 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
521 outw(voice->CSO, TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2);
523 outl((voice->Delta << 24) |
524 (voice->CSO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_CSO));
535 voice - synthesizer voice structure
541 struct snd_trident_voice * voice,
544 voice->ESO = ESO;
545 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
547 outw(voice->ESO, TRID_REG(trident, CH_DX_ESO_DELTA) + 2);
549 outl(((voice->Delta << 16) & 0xff000000) | (voice->ESO & 0x00ffffff),
557 Description: This routine will write the new voice volume
561 voice - synthesizer voice structure
562 Vol - new voice volume
567 struct snd_trident_voice * voice,
570 voice->Vol = Vol;
571 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
575 outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2));
578 /* dev_dbg(trident->card->dev, "voice->Vol = 0x%x\n", voice->Vol); */
579 outw((voice->CTRL << 12) | voice->Vol,
588 Description: This routine will write the new voice pan
592 voice - synthesizer voice structure
598 struct snd_trident_voice * voice,
601 voice->Pan = Pan;
602 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
603 outb(((voice->GVSel & 0x01) << 7) | (voice->Pan & 0x7f),
614 voice - synthesizer voice structure
620 struct snd_trident_voice * voice,
623 voice->RVol = RVol;
624 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
625 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
626 (voice->CVol & 0x007f),
638 voice - synthesizer voice structure
644 struct snd_trident_voice * voice,
647 voice->CVol = CVol;
648 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
649 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
650 (voice->CVol & 0x007f),
787 struct snd_trident_voice *voice = runtime->private_data;
791 if (voice->memblk)
792 snd_trident_free_pages(trident, voice->memblk);
793 voice->memblk = snd_trident_alloc_pages(trident, substream);
794 if (voice->memblk == NULL)
804 Description: Allocate extra voice as interrupt generator
818 struct snd_trident_voice *voice = runtime->private_data;
819 struct snd_trident_voice *evoice = voice->extra;
821 /* voice management */
828 voice->extra = evoice;
834 voice->extra = evoice = NULL;
879 struct snd_trident_voice *voice = runtime->private_data;
880 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
883 if (voice && voice->memblk) {
884 snd_trident_free_pages(trident, voice->memblk);
885 voice->memblk = NULL;
890 voice->extra = NULL;
910 struct snd_trident_voice *voice = runtime->private_data;
911 struct snd_trident_voice *evoice = voice->extra;
917 voice->Delta = snd_trident_convert_rate(runtime->rate);
918 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
921 if (voice->memblk)
922 voice->LBA = voice->memblk->offset;
924 voice->LBA = runtime->dma_addr;
926 voice->CSO = 0;
927 voice->ESO = runtime->buffer_size - 1; /* in samples */
928 voice->CTRL = snd_trident_control_mode(substream);
929 voice->FMC = 3;
930 voice->GVSel = 1;
931 voice->EC = 0;
932 voice->Alpha = 0;
933 voice->FMS = 0;
934 voice->Vol = mix->vol;
935 voice->RVol = mix->rvol;
936 voice->CVol = mix->cvol;
937 voice->Pan = mix->pan;
938 voice->Attribute = 0;
940 voice->Attribute = (1<<(30-16))|(2<<(26-16))|
943 voice->Attribute = 0;
946 snd_trident_write_voice_regs(trident, voice);
949 evoice->Delta = voice->Delta;
950 evoice->spurious_threshold = voice->spurious_threshold;
951 evoice->LBA = voice->LBA;
954 evoice->CTRL = voice->CTRL;
1013 struct snd_trident_voice *voice = runtime->private_data;
1025 voice->LBA = runtime->dma_addr;
1026 outl(voice->LBA, TRID_REG(trident, LEGACY_DMAR0));
1027 if (voice->memblk)
1028 voice->LBA = voice->memblk->offset;
1062 voice->Delta = snd_trident_convert_rate(runtime->rate);
1063 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1064 voice->isync = 1;
1065 voice->isync_mark = runtime->period_size;
1066 voice->isync_max = runtime->buffer_size;
1068 // Set voice parameters
1069 voice->CSO = 0;
1070 voice->ESO = voice->isync_ESO = (runtime->period_size * 2) + 6 - 1;
1071 voice->CTRL = snd_trident_control_mode(substream);
1072 voice->FMC = 3;
1073 voice->RVol = 0x7f;
1074 voice->CVol = 0x7f;
1075 voice->GVSel = 1;
1076 voice->Pan = 0x7f; /* mute */
1077 voice->Vol = 0x3ff; /* mute */
1078 voice->EC = 0;
1079 voice->Alpha = 0;
1080 voice->FMS = 0;
1081 voice->Attribute = 0;
1083 snd_trident_write_voice_regs(trident, voice);
1122 struct snd_trident_voice *voice = runtime->private_data;
1123 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
1127 voice->extra = NULL;
1147 struct snd_trident_voice *voice = runtime->private_data;
1148 struct snd_trident_voice *evoice = voice->extra;
1152 voice->LBA = runtime->dma_addr;
1153 voice->Delta = snd_trident_convert_adc_rate(runtime->rate);
1154 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1156 // Set voice parameters
1157 voice->CSO = 0;
1158 voice->ESO = runtime->buffer_size - 1; /* in samples */
1159 voice->CTRL = snd_trident_control_mode(substream);
1160 voice->FMC = 0;
1161 voice->RVol = 0;
1162 voice->CVol = 0;
1163 voice->GVSel = 1;
1164 voice->Pan = T4D_DEFAULT_PCM_PAN;
1165 voice->Vol = 0;
1166 voice->EC = 0;
1167 voice->Alpha = 0;
1168 voice->FMS = 0;
1170 voice->Attribute = (2 << (30-16)) |
1175 snd_trident_write_voice_regs(trident, voice);
1179 evoice->spurious_threshold = voice->spurious_threshold;
1180 evoice->LBA = voice->LBA;
1183 evoice->CTRL = voice->CTRL;
1218 struct snd_trident_voice *voice = runtime->private_data;
1219 struct snd_trident_voice *evoice = voice->extra;
1224 if (voice->memblk)
1225 voice->LBA = voice->memblk->offset;
1227 voice->LBA = runtime->dma_addr;
1230 voice->ESO = runtime->buffer_size - 1; /* in samples */
1233 voice->Delta = 0x1000;
1234 voice->spurious_threshold = snd_trident_spurious_threshold(48000, runtime->period_size);
1236 voice->CSO = 0;
1237 voice->CTRL = snd_trident_control_mode(substream);
1238 voice->FMC = 3;
1239 voice->RVol = 0x7f;
1240 voice->CVol = 0x7f;
1241 voice->GVSel = 1;
1242 voice->Pan = 0x7f; /* mute */
1243 voice->Vol = 0x3ff; /* mute */
1244 voice->EC = 0;
1245 voice->Alpha = 0;
1246 voice->FMS = 0;
1247 voice->Attribute = 0;
1250 outb(((voice->number & 0x3f) | 0x80), TRID_REG(trident, T4D_RCI + voice->foldback_chan));
1252 snd_trident_write_voice_regs(trident, voice);
1255 evoice->Delta = voice->Delta;
1256 evoice->spurious_threshold = voice->spurious_threshold;
1257 evoice->LBA = voice->LBA;
1260 evoice->CTRL = voice->CTRL;
1361 struct snd_trident_voice *voice = runtime->private_data;
1362 struct snd_trident_voice *evoice = voice->extra;
1372 voice->Delta = snd_trident_convert_rate(runtime->rate);
1373 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1377 if (voice->memblk)
1378 voice->LBA = voice->memblk->offset;
1380 voice->LBA = LBAO;
1382 voice->isync = 1;
1383 voice->isync3 = 1;
1384 voice->isync_mark = runtime->period_size;
1385 voice->isync_max = runtime->buffer_size;
1389 voice->ESO = voice->isync_ESO = (runtime->period_size * 2) + 6 - 1;
1392 voice->CTRL = snd_trident_control_mode(substream);
1394 voice->FMC = 3;
1395 voice->RVol = 0x7f;
1396 voice->CVol = 0x7f;
1397 voice->GVSel = 1;
1398 voice->Pan = 0x7f;
1399 voice->Vol = 0x3ff;
1400 voice->EC = 0;
1401 voice->CSO = 0;
1402 voice->Alpha = 0;
1403 voice->FMS = 0;
1404 voice->Attribute = 0;
1407 snd_trident_write_voice_regs(trident, voice);
1412 outw((voice->CSO & 0xffff), TRID_REG(trident, NX_SPCTRL_SPCSO));
1413 outb((voice->CSO >> 16), TRID_REG(trident, NX_SPCTRL_SPCSO + 2));
1422 voice->Delta = 0x800;
1423 voice->spurious_threshold = snd_trident_spurious_threshold(48000, runtime->period_size);
1426 if (voice->memblk)
1427 voice->LBA = voice->memblk->offset;
1429 voice->LBA = runtime->dma_addr;
1431 voice->CSO = 0;
1432 voice->ESO = runtime->buffer_size - 1; /* in samples */
1433 voice->CTRL = snd_trident_control_mode(substream);
1434 voice->FMC = 3;
1435 voice->GVSel = 1;
1436 voice->EC = 0;
1437 voice->Alpha = 0;
1438 voice->FMS = 0;
1439 voice->Vol = mix->vol;
1440 voice->RVol = mix->rvol;
1441 voice->CVol = mix->cvol;
1442 voice->Pan = mix->pan;
1443 voice->Attribute = (1<<(30-16))|(7<<(26-16))|
1446 snd_trident_write_voice_regs(trident, voice);
1449 evoice->Delta = voice->Delta;
1450 evoice->spurious_threshold = voice->spurious_threshold;
1451 evoice->LBA = voice->LBA;
1454 evoice->CTRL = voice->CTRL;
1503 struct snd_trident_voice *voice, *evoice;
1525 voice = s->runtime->private_data;
1526 evoice = voice->extra;
1527 what |= 1 << (voice->number & 0x1f);
1529 whati |= 1 << (voice->number & 0x1f);
1537 voice->running = 1;
1538 voice->stimer = val;
1540 voice->running = 0;
1543 if (voice->capture)
1545 if (voice->spdif)
1599 struct snd_trident_voice *voice = runtime->private_data;
1602 if (!voice->running)
1607 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
1638 struct snd_trident_voice *voice = runtime->private_data;
1641 if (!voice->running)
1668 struct snd_trident_voice *voice = runtime->private_data;
1671 if (!voice->running)
1800 struct snd_trident_voice *voice = runtime->private_data;
1803 if (voice) {
1804 trident = voice->trident;
1805 snd_trident_free_voice(trident, voice);
1813 struct snd_trident_voice *voice;
1815 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1816 if (voice == NULL)
1818 snd_trident_pcm_mixer_build(trident, voice, substream);
1819 voice->substream = substream;
1820 runtime->private_data = voice;
1841 struct snd_trident_voice *voice = runtime->private_data;
1843 snd_trident_pcm_mixer_free(trident, voice, substream);
1861 struct snd_trident_voice *voice;
1864 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1865 if (voice == NULL)
1867 voice->spdif = 1;
1868 voice->substream = substream;
1873 runtime->private_data = voice;
1940 struct snd_trident_voice *voice;
1943 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1944 if (voice == NULL)
1946 voice->capture = 1;
1947 voice->substream = substream;
1948 runtime->private_data = voice;
1984 struct snd_trident_voice *voice;
1987 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1988 if (voice == NULL)
1990 voice->foldback_chan = substream->number;
1991 voice->substream = substream;
1992 runtime->private_data = voice;
2011 struct snd_trident_voice *voice;
2013 voice = runtime->private_data;
2017 outb(0x00, TRID_REG(trident, T4D_RCI + voice->foldback_chan));
2648 if (mix->voice != NULL)
2649 snd_trident_write_vol_reg(trident, mix->voice, val);
2712 if (mix->voice != NULL)
2713 snd_trident_write_pan_reg(trident, mix->voice, val);
2767 if (mix->voice != NULL)
2768 snd_trident_write_rvol_reg(trident, mix->voice, val);
2825 if (mix->voice != NULL)
2826 snd_trident_write_cvol_reg(trident, mix->voice, val);
2871 struct snd_trident_voice *voice,
2876 if (snd_BUG_ON(!trident || !voice || !substream))
2879 tmix->voice = voice;
2888 static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_trident_voice *voice, struct snd_pcm_substream *substream)
2895 tmix->voice = NULL;
2990 tmix->voice = NULL;
3502 struct snd_trident_voice *voice;
3583 voice = &trident->synth.voices[i];
3584 voice->number = i;
3585 voice->trident = trident;
3655 struct snd_trident_voice *voice;
3676 voice = &trident->synth.voices[channel];
3677 if (!voice->pcm || voice->substream == NULL) {
3681 delta = (int)stimer - (int)voice->stimer;
3684 if ((unsigned int)delta < voice->spurious_threshold) {
3691 voice->stimer = stimer;
3692 if (voice->isync) {
3693 if (!voice->isync3) {
3698 tmp = voice->isync_max - tmp;
3702 if (tmp < voice->isync_mark) {
3704 tmp = voice->isync_ESO - 7;
3706 tmp = voice->isync_ESO + 2;
3707 /* update ESO for IRQ voice to preserve sync */
3708 snd_trident_stop_voice(trident, voice->number);
3709 snd_trident_write_eso_reg(trident, voice, tmp);
3710 snd_trident_start_voice(trident, voice->number);
3712 } else if (voice->isync2) {
3713 voice->isync2 = 0;
3714 /* write original ESO and update CSO for IRQ voice to preserve sync */
3715 snd_trident_stop_voice(trident, voice->number);
3716 snd_trident_write_cso_reg(trident, voice, voice->isync_mark);
3717 snd_trident_write_eso_reg(trident, voice, voice->ESO);
3718 snd_trident_start_voice(trident, voice->number);
3721 if (voice->extra) {
3722 /* update CSO for extra voice to preserve sync */
3723 snd_trident_stop_voice(trident, voice->extra->number);
3724 snd_trident_write_cso_reg(trident, voice->extra, 0);
3725 snd_trident_start_voice(trident, voice->extra->number);
3729 snd_pcm_period_elapsed(voice->substream);
3793 void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice)
3798 if (voice == NULL || !voice->use)
3800 snd_trident_clear_voices(trident, voice->number, voice->number);
3802 private_free = voice->private_free;
3803 voice->private_free = NULL;
3804 voice->private_data = NULL;
3805 if (voice->pcm)
3806 snd_trident_free_pcm_channel(trident, voice->number);
3807 if (voice->synth)
3808 snd_trident_free_synth_channel(trident, voice->number);
3809 voice->use = voice->pcm = voice->synth = voice->midi = 0;
3810 voice->capture = voice->spdif = 0;
3811 voice->sample_ops = NULL;
3812 voice->substream = NULL;
3813 voice->extra = NULL;
3816 private_free(voice);