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));
268 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
270 Description: Start a voice, any channel 0 thru 63.
274 Parameters : voice - Voice number 0 thru n.
281 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
283 unsigned int mask = 1 << (voice & 0x1f);
284 unsigned int reg = (voice & 0x20) ? T4D_START_B : T4D_START_A;
292 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
294 Description: Stop a voice, any channel 0 thru 63.
298 Parameters : voice - Voice number 0 thru n.
305 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
307 unsigned int mask = 1 << (voice & 0x1f);
308 unsigned int reg = (voice & 0x20) ? T4D_STOP_B : T4D_STOP_A;
420 voice - synthesizer voice structure
426 struct snd_trident_voice * voice)
431 regs[1] = voice->LBA;
432 regs[4] = (voice->GVSel << 31) |
433 ((voice->Pan & 0x0000007f) << 24) |
434 ((voice->CTRL & 0x0000000f) << 12);
435 FmcRvolCvol = ((voice->FMC & 3) << 14) |
436 ((voice->RVol & 0x7f) << 7) |
437 (voice->CVol & 0x7f);
441 regs[4] |= voice->number > 31 ?
442 (voice->Vol & 0x000003ff) :
443 ((voice->Vol & 0x00003fc) << (16-2)) |
444 (voice->EC & 0x00000fff);
445 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
446 (voice->FMS & 0x0000000f);
447 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
448 regs[3] = (voice->Attribute << 16) | FmcRvolCvol;
451 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
452 (voice->EC & 0x00000fff);
453 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
454 (voice->FMS & 0x0000000f);
455 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
459 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
460 (voice->EC & 0x00000fff);
461 regs[0] = (voice->Delta << 24) | (voice->CSO & 0x00ffffff);
462 regs[2] = ((voice->Delta << 16) & 0xff000000) |
463 (voice->ESO & 0x00ffffff);
464 regs[3] = (voice->Alpha << 20) |
465 ((voice->FMS & 0x0000000f) << 16) | FmcRvolCvol;
472 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
480 dev_dbg(trident->card->dev, "written %i channel:\n", voice->number);
503 voice - synthesizer voice structure
509 struct snd_trident_voice * voice,
512 voice->CSO = CSO;
513 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
515 outw(voice->CSO, TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2);
517 outl((voice->Delta << 24) |
518 (voice->CSO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_CSO));
529 voice - synthesizer voice structure
535 struct snd_trident_voice * voice,
538 voice->ESO = ESO;
539 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
541 outw(voice->ESO, TRID_REG(trident, CH_DX_ESO_DELTA) + 2);
543 outl(((voice->Delta << 16) & 0xff000000) | (voice->ESO & 0x00ffffff),
551 Description: This routine will write the new voice volume
555 voice - synthesizer voice structure
556 Vol - new voice volume
561 struct snd_trident_voice * voice,
564 voice->Vol = Vol;
565 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
569 outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2));
572 /* dev_dbg(trident->card->dev, "voice->Vol = 0x%x\n", voice->Vol); */
573 outw((voice->CTRL << 12) | voice->Vol,
582 Description: This routine will write the new voice pan
586 voice - synthesizer voice structure
592 struct snd_trident_voice * voice,
595 voice->Pan = Pan;
596 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
597 outb(((voice->GVSel & 0x01) << 7) | (voice->Pan & 0x7f),
608 voice - synthesizer voice structure
614 struct snd_trident_voice * voice,
617 voice->RVol = RVol;
618 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
619 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
620 (voice->CVol & 0x007f),
632 voice - synthesizer voice structure
638 struct snd_trident_voice * voice,
641 voice->CVol = CVol;
642 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
643 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
644 (voice->CVol & 0x007f),
781 struct snd_trident_voice *voice = runtime->private_data;
785 if (voice->memblk)
786 snd_trident_free_pages(trident, voice->memblk);
787 voice->memblk = snd_trident_alloc_pages(trident, substream);
788 if (voice->memblk == NULL)
798 Description: Allocate extra voice as interrupt generator
812 struct snd_trident_voice *voice = runtime->private_data;
813 struct snd_trident_voice *evoice = voice->extra;
815 /* voice management */
822 voice->extra = evoice;
828 voice->extra = evoice = NULL;
873 struct snd_trident_voice *voice = runtime->private_data;
874 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
877 if (voice && voice->memblk) {
878 snd_trident_free_pages(trident, voice->memblk);
879 voice->memblk = NULL;
884 voice->extra = NULL;
904 struct snd_trident_voice *voice = runtime->private_data;
905 struct snd_trident_voice *evoice = voice->extra;
911 voice->Delta = snd_trident_convert_rate(runtime->rate);
912 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
915 if (voice->memblk)
916 voice->LBA = voice->memblk->offset;
918 voice->LBA = runtime->dma_addr;
920 voice->CSO = 0;
921 voice->ESO = runtime->buffer_size - 1; /* in samples */
922 voice->CTRL = snd_trident_control_mode(substream);
923 voice->FMC = 3;
924 voice->GVSel = 1;
925 voice->EC = 0;
926 voice->Alpha = 0;
927 voice->FMS = 0;
928 voice->Vol = mix->vol;
929 voice->RVol = mix->rvol;
930 voice->CVol = mix->cvol;
931 voice->Pan = mix->pan;
932 voice->Attribute = 0;
934 voice->Attribute = (1<<(30-16))|(2<<(26-16))|
937 voice->Attribute = 0;
940 snd_trident_write_voice_regs(trident, voice);
943 evoice->Delta = voice->Delta;
944 evoice->spurious_threshold = voice->spurious_threshold;
945 evoice->LBA = voice->LBA;
948 evoice->CTRL = voice->CTRL;
1005 struct snd_trident_voice *voice = runtime->private_data;
1017 voice->LBA = runtime->dma_addr;
1018 outl(voice->LBA, TRID_REG(trident, LEGACY_DMAR0));
1019 if (voice->memblk)
1020 voice->LBA = voice->memblk->offset;
1054 voice->Delta = snd_trident_convert_rate(runtime->rate);
1055 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1056 voice->isync = 1;
1057 voice->isync_mark = runtime->period_size;
1058 voice->isync_max = runtime->buffer_size;
1060 // Set voice parameters
1061 voice->CSO = 0;
1062 voice->ESO = voice->isync_ESO = (runtime->period_size * 2) + 6 - 1;
1063 voice->CTRL = snd_trident_control_mode(substream);
1064 voice->FMC = 3;
1065 voice->RVol = 0x7f;
1066 voice->CVol = 0x7f;
1067 voice->GVSel = 1;
1068 voice->Pan = 0x7f; /* mute */
1069 voice->Vol = 0x3ff; /* mute */
1070 voice->EC = 0;
1071 voice->Alpha = 0;
1072 voice->FMS = 0;
1073 voice->Attribute = 0;
1075 snd_trident_write_voice_regs(trident, voice);
1113 struct snd_trident_voice *voice = runtime->private_data;
1114 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
1118 voice->extra = NULL;
1138 struct snd_trident_voice *voice = runtime->private_data;
1139 struct snd_trident_voice *evoice = voice->extra;
1143 voice->LBA = runtime->dma_addr;
1144 voice->Delta = snd_trident_convert_adc_rate(runtime->rate);
1145 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1147 // Set voice parameters
1148 voice->CSO = 0;
1149 voice->ESO = runtime->buffer_size - 1; /* in samples */
1150 voice->CTRL = snd_trident_control_mode(substream);
1151 voice->FMC = 0;
1152 voice->RVol = 0;
1153 voice->CVol = 0;
1154 voice->GVSel = 1;
1155 voice->Pan = T4D_DEFAULT_PCM_PAN;
1156 voice->Vol = 0;
1157 voice->EC = 0;
1158 voice->Alpha = 0;
1159 voice->FMS = 0;
1161 voice->Attribute = (2 << (30-16)) |
1166 snd_trident_write_voice_regs(trident, voice);
1170 evoice->spurious_threshold = voice->spurious_threshold;
1171 evoice->LBA = voice->LBA;
1174 evoice->CTRL = voice->CTRL;
1208 struct snd_trident_voice *voice = runtime->private_data;
1209 struct snd_trident_voice *evoice = voice->extra;
1214 if (voice->memblk)
1215 voice->LBA = voice->memblk->offset;
1217 voice->LBA = runtime->dma_addr;
1220 voice->ESO = runtime->buffer_size - 1; /* in samples */
1223 voice->Delta = 0x1000;
1224 voice->spurious_threshold = snd_trident_spurious_threshold(48000, runtime->period_size);
1226 voice->CSO = 0;
1227 voice->CTRL = snd_trident_control_mode(substream);
1228 voice->FMC = 3;
1229 voice->RVol = 0x7f;
1230 voice->CVol = 0x7f;
1231 voice->GVSel = 1;
1232 voice->Pan = 0x7f; /* mute */
1233 voice->Vol = 0x3ff; /* mute */
1234 voice->EC = 0;
1235 voice->Alpha = 0;
1236 voice->FMS = 0;
1237 voice->Attribute = 0;
1240 outb(((voice->number & 0x3f) | 0x80), TRID_REG(trident, T4D_RCI + voice->foldback_chan));
1242 snd_trident_write_voice_regs(trident, voice);
1245 evoice->Delta = voice->Delta;
1246 evoice->spurious_threshold = voice->spurious_threshold;
1247 evoice->LBA = voice->LBA;
1250 evoice->CTRL = voice->CTRL;
1348 struct snd_trident_voice *voice = runtime->private_data;
1349 struct snd_trident_voice *evoice = voice->extra;
1359 voice->Delta = snd_trident_convert_rate(runtime->rate);
1360 voice->spurious_threshold = snd_trident_spurious_threshold(runtime->rate, runtime->period_size);
1364 if (voice->memblk)
1365 voice->LBA = voice->memblk->offset;
1367 voice->LBA = LBAO;
1369 voice->isync = 1;
1370 voice->isync3 = 1;
1371 voice->isync_mark = runtime->period_size;
1372 voice->isync_max = runtime->buffer_size;
1376 voice->ESO = voice->isync_ESO = (runtime->period_size * 2) + 6 - 1;
1379 voice->CTRL = snd_trident_control_mode(substream);
1381 voice->FMC = 3;
1382 voice->RVol = 0x7f;
1383 voice->CVol = 0x7f;
1384 voice->GVSel = 1;
1385 voice->Pan = 0x7f;
1386 voice->Vol = 0x3ff;
1387 voice->EC = 0;
1388 voice->CSO = 0;
1389 voice->Alpha = 0;
1390 voice->FMS = 0;
1391 voice->Attribute = 0;
1394 snd_trident_write_voice_regs(trident, voice);
1399 outw((voice->CSO & 0xffff), TRID_REG(trident, NX_SPCTRL_SPCSO));
1400 outb((voice->CSO >> 16), TRID_REG(trident, NX_SPCTRL_SPCSO + 2));
1409 voice->Delta = 0x800;
1410 voice->spurious_threshold = snd_trident_spurious_threshold(48000, runtime->period_size);
1413 if (voice->memblk)
1414 voice->LBA = voice->memblk->offset;
1416 voice->LBA = runtime->dma_addr;
1418 voice->CSO = 0;
1419 voice->ESO = runtime->buffer_size - 1; /* in samples */
1420 voice->CTRL = snd_trident_control_mode(substream);
1421 voice->FMC = 3;
1422 voice->GVSel = 1;
1423 voice->EC = 0;
1424 voice->Alpha = 0;
1425 voice->FMS = 0;
1426 voice->Vol = mix->vol;
1427 voice->RVol = mix->rvol;
1428 voice->CVol = mix->cvol;
1429 voice->Pan = mix->pan;
1430 voice->Attribute = (1<<(30-16))|(7<<(26-16))|
1433 snd_trident_write_voice_regs(trident, voice);
1436 evoice->Delta = voice->Delta;
1437 evoice->spurious_threshold = voice->spurious_threshold;
1438 evoice->LBA = voice->LBA;
1441 evoice->CTRL = voice->CTRL;
1488 struct snd_trident_voice *voice, *evoice;
1510 voice = s->runtime->private_data;
1511 evoice = voice->extra;
1512 what |= 1 << (voice->number & 0x1f);
1514 whati |= 1 << (voice->number & 0x1f);
1522 voice->running = 1;
1523 voice->stimer = val;
1525 voice->running = 0;
1528 if (voice->capture)
1530 if (voice->spdif)
1583 struct snd_trident_voice *voice = runtime->private_data;
1586 if (!voice->running)
1591 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
1620 struct snd_trident_voice *voice = runtime->private_data;
1623 if (!voice->running)
1650 struct snd_trident_voice *voice = runtime->private_data;
1653 if (!voice->running)
1782 struct snd_trident_voice *voice = runtime->private_data;
1785 if (voice) {
1786 trident = voice->trident;
1787 snd_trident_free_voice(trident, voice);
1795 struct snd_trident_voice *voice;
1797 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1798 if (voice == NULL)
1800 snd_trident_pcm_mixer_build(trident, voice, substream);
1801 voice->substream = substream;
1802 runtime->private_data = voice;
1823 struct snd_trident_voice *voice = runtime->private_data;
1825 snd_trident_pcm_mixer_free(trident, voice, substream);
1843 struct snd_trident_voice *voice;
1846 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1847 if (voice == NULL)
1849 voice->spdif = 1;
1850 voice->substream = substream;
1855 runtime->private_data = voice;
1922 struct snd_trident_voice *voice;
1925 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1926 if (voice == NULL)
1928 voice->capture = 1;
1929 voice->substream = substream;
1930 runtime->private_data = voice;
1966 struct snd_trident_voice *voice;
1969 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1970 if (voice == NULL)
1972 voice->foldback_chan = substream->number;
1973 voice->substream = substream;
1974 runtime->private_data = voice;
1993 struct snd_trident_voice *voice;
1995 voice = runtime->private_data;
1999 outb(0x00, TRID_REG(trident, T4D_RCI + voice->foldback_chan));
2620 if (mix->voice != NULL)
2621 snd_trident_write_vol_reg(trident, mix->voice, val);
2683 if (mix->voice != NULL)
2684 snd_trident_write_pan_reg(trident, mix->voice, val);
2737 if (mix->voice != NULL)
2738 snd_trident_write_rvol_reg(trident, mix->voice, val);
2794 if (mix->voice != NULL)
2795 snd_trident_write_cvol_reg(trident, mix->voice, val);
2839 struct snd_trident_voice *voice,
2844 if (snd_BUG_ON(!trident || !voice || !substream))
2847 tmix->voice = voice;
2856 static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_trident_voice *voice, struct snd_pcm_substream *substream)
2863 tmix->voice = NULL;
2958 tmix->voice = NULL;
3470 struct snd_trident_voice *voice;
3551 voice = &trident->synth.voices[i];
3552 voice->number = i;
3553 voice->trident = trident;
3623 struct snd_trident_voice *voice;
3642 voice = &trident->synth.voices[channel];
3643 if (!voice->pcm || voice->substream == NULL) {
3647 delta = (int)stimer - (int)voice->stimer;
3650 if ((unsigned int)delta < voice->spurious_threshold) {
3657 voice->stimer = stimer;
3658 if (voice->isync) {
3659 if (!voice->isync3) {
3664 tmp = voice->isync_max - tmp;
3668 if (tmp < voice->isync_mark) {
3670 tmp = voice->isync_ESO - 7;
3672 tmp = voice->isync_ESO + 2;
3673 /* update ESO for IRQ voice to preserve sync */
3674 snd_trident_stop_voice(trident, voice->number);
3675 snd_trident_write_eso_reg(trident, voice, tmp);
3676 snd_trident_start_voice(trident, voice->number);
3678 } else if (voice->isync2) {
3679 voice->isync2 = 0;
3680 /* write original ESO and update CSO for IRQ voice to preserve sync */
3681 snd_trident_stop_voice(trident, voice->number);
3682 snd_trident_write_cso_reg(trident, voice, voice->isync_mark);
3683 snd_trident_write_eso_reg(trident, voice, voice->ESO);
3684 snd_trident_start_voice(trident, voice->number);
3687 if (voice->extra) {
3688 /* update CSO for extra voice to preserve sync */
3689 snd_trident_stop_voice(trident, voice->extra->number);
3690 snd_trident_write_cso_reg(trident, voice->extra, 0);
3691 snd_trident_start_voice(trident, voice->extra->number);
3695 snd_pcm_period_elapsed(voice->substream);
3750 void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice)
3754 if (voice == NULL || !voice->use)
3756 snd_trident_clear_voices(trident, voice->number, voice->number);
3758 private_free = voice->private_free;
3759 voice->private_free = NULL;
3760 voice->private_data = NULL;
3761 if (voice->pcm)
3762 snd_trident_free_pcm_channel(trident, voice->number);
3763 if (voice->synth)
3764 snd_trident_free_synth_channel(trident, voice->number);
3765 voice->use = voice->pcm = voice->synth = voice->midi = 0;
3766 voice->capture = voice->spdif = 0;
3767 voice->sample_ops = NULL;
3768 voice->substream = NULL;
3769 voice->extra = NULL;
3772 private_free(voice);