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