cuticle/hi/loopback.c
2024-06-26 20:47:26 +03:00

20 lines
802 B
C

#include<alsa/asoundlib.h>
CUTIVIS CHiPubNode *CHi_Loopback() {
snd_pcm_t *handle;
snd_pcm_hw_params_t *params;
printf("GOO %i\n", snd_pcm_open(&handle, "default", SND_PCM_STREAM_CAPTURE, 0));
printf("GOO %i\n", snd_pcm_hw_params_malloc(&params));
printf("GOO %i\n", snd_pcm_hw_params_any(handle, params));
printf("GOO %i\n", snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED));
printf("GOO %i\n", snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE));
printf("GOO %i\n", snd_pcm_hw_params_set_rate_near(handle, params, &(int) {48000}));
printf("GOO %i\n", snd_pcm_hw_params_set_channels(handle, params, 1));
printf("GOO %i\n", snd_pcm_hw_params(handle, aprams));
snd_pcm_hw_params_free(params);
printf("GOO %i\n", snd_pcm_prepare(handle));
}