Lines Matching full:ch

5  * Copyright (c) 2023-2024 Florian Walpen <dev@submerge.ch>
232 hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst,
239 scp = ch->parent;
243 if (ch->dir == PCMDIR_PLAY)
254 hdspechan_setgain(struct sc_chinfo *ch)
261 sc = ch->parent->sc;
264 ports = ch->ports;
274 volume = ch->lvol * HDSPE_MAX_GAIN / 100;
276 hdspe_hw_mixer(ch, slot, slot, volume);
278 volume = ch->rvol * HDSPE_MAX_GAIN / 100;
321 struct sc_chinfo *ch;
332 ch = &scp->chan[i];
333 if ((dev == SOUND_MIXER_VOLUME && ch->dir == PCMDIR_PLAY) ||
334 (dev == SOUND_MIXER_RECLEV && ch->dir == PCMDIR_REC)) {
335 ch->lvol = left;
336 ch->rvol = right;
337 if (ch->run)
338 hdspechan_setgain(ch);
353 hdspechan_enable(struct sc_chinfo *ch, int value)
361 scp = ch->parent;
364 if (ch->dir == PCMDIR_PLAY)
369 ch->run = value;
372 ports = ch->ports;
393 struct sc_chinfo *ch;
405 ch = &scp->chan[j];
406 if (ch->run)
539 buffer_copy(struct sc_chinfo *ch)
549 scp = ch->parent;
552 n = AFMT_CHANNEL(ch->format); /* n channels */
556 if (n == hdspe_channel_count(ch->ports, 2))
558 else if (n == hdspe_channel_count(ch->ports, 4))
564 if (ch->dir == PCMDIR_PLAY) {
566 pos = sndbuf_getreadyptr(ch->buffer) / n;
567 length = sndbuf_getready(ch->buffer) / n;
572 offset = (ch->position + HDSPE_CHANBUF_SIZE) - pos;
580 pos = sndbuf_getfreeptr(ch->buffer) / n;
594 ports = ch->ports;
601 if (ch->dir == PCMDIR_PLAY)
602 buffer_mux_port(sc->pbuf, ch->data, row, ch->ports, pos,
605 buffer_demux_port(sc->rbuf, ch->data, row, ch->ports,
615 ch->position = ((pos + length) * 4) % HDSPE_CHANBUF_SIZE;
619 clean(struct sc_chinfo *ch)
627 scp = ch->parent;
631 if (ch->dir == PCMDIR_PLAY)
635 ports = ch->ports;
649 ch->position = 0;
659 struct sc_chinfo *ch;
662 ch = data;
663 scp = ch->parent;
671 if (ch->data != NULL) {
672 free(ch->data, M_HDSPE);
673 ch->data = NULL;
675 if (ch->caps != NULL) {
676 free(ch->caps, M_HDSPE);
677 ch->caps = NULL;
689 struct sc_chinfo *ch;
699 ch = &scp->chan[num];
702 ch->ports = hdspe_channel_play_ports(scp->hc);
704 ch->ports = hdspe_channel_rec_ports(scp->hc);
706 ch->run = 0;
707 ch->lvol = 0;
708 ch->rvol = 0;
711 ch->cap_fmts[0] =
712 SND_FORMAT(AFMT_S32_LE, hdspe_channel_count(ch->ports, 2), 0);
713 ch->cap_fmts[1] =
714 SND_FORMAT(AFMT_S32_LE, hdspe_channel_count(ch->ports, 4), 0);
715 ch->cap_fmts[2] =
716 SND_FORMAT(AFMT_S32_LE, hdspe_channel_count(ch->ports, 8), 0);
717 ch->cap_fmts[3] = 0;
718 ch->caps = malloc(sizeof(struct pcmchan_caps), M_HDSPE, M_NOWAIT);
719 *(ch->caps) = (struct pcmchan_caps) {32000, 192000, ch->cap_fmts, 0};
722 ch->size = HDSPE_CHANBUF_SIZE * hdspe_channel_count(ch->ports, 8);
723 ch->data = malloc(ch->size, M_HDSPE, M_NOWAIT);
724 ch->position = 0;
726 ch->buffer = b;
727 ch->channel = c;
728 ch->parent = scp;
730 ch->dir = dir;
734 if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) {
736 hdspechan_free(obj, ch);
740 return (ch);
747 struct sc_chinfo *ch;
750 ch = data;
751 scp = ch->parent;
760 hdspechan_enable(ch, 1);
761 hdspechan_setgain(ch);
770 clean(ch);
771 hdspechan_enable(ch, 0);
777 if(ch->run)
778 buffer_copy(ch);
791 struct sc_chinfo *ch;
795 ch = data;
796 scp = ch->parent;
804 pos *= AFMT_CHANNEL(ch->format); /* Hardbuf with multiple channels. */
812 struct sc_chinfo *ch;
814 ch = data;
817 struct sc_pcminfo *scp = ch->parent;
821 ch->format = format;
831 struct sc_chinfo *ch;
837 ch = data;
838 scp = ch->parent;
905 struct sc_chinfo *ch;
910 ch = data;
911 scp = ch->parent;
960 sndbuf_resize(ch->buffer,
961 (HDSPE_CHANBUF_SIZE * AFMT_CHANNEL(ch->format)) / (sc->period * 4),
965 return (sndbuf_getblksz(ch->buffer));
978 struct sc_chinfo *ch;
980 ch = data;
983 struct sc_pcminfo *scl = ch->parent;
987 if (ch->caps != NULL)
988 return (ch->caps);
1020 struct sc_chinfo *ch;
1027 ch = &scp->chan[i];
1029 chn_intr(ch->channel);