From 67dc0a565e4361062c27435c75f82c4488b88e1d Mon Sep 17 00:00:00 2001 From: fridtjof Date: Wed, 1 Jan 2025 18:15:27 +0100 Subject: [PATCH] bgm_xyscope: accept 32 bit samples from alsa --- src/modules/bgm_xyscope.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/bgm_xyscope.c b/src/modules/bgm_xyscope.c index 994304b..8b00d85 100644 --- a/src/modules/bgm_xyscope.c +++ b/src/modules/bgm_xyscope.c @@ -252,6 +252,10 @@ int init(int modulen, char* argstr) { printf("Got BS16C2\n"); sf_sampsize = SIZE_16; sf_2c = 1; + } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_S32, SND_PCM_ACCESS_RW_INTERLEAVED, 2, SAMPLE_RATE, 1, 1000))) { + printf("Got BS32C2\n"); + sf_sampsize = SIZE_32; + sf_2c = 1; } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_U8, SND_PCM_ACCESS_RW_INTERLEAVED, 2, SAMPLE_RATE, 1, 1000))) { printf("Got BU8C2\n"); sf_2c = 1; @@ -261,6 +265,11 @@ int init(int modulen, char* argstr) { sf_sampsize = SIZE_16; sf_2c = 1; sf_us = 1; + } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_U32, SND_PCM_ACCESS_RW_INTERLEAVED, 2, SAMPLE_RATE, 1, 1000))) { + printf("Got BU32C2\n"); + sf_sampsize = SIZE_32; + sf_2c = 1; + sf_us = 1; } } else { if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_S8, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) { @@ -268,6 +277,9 @@ int init(int modulen, char* argstr) { } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_S16, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) { printf("Got BS16C1\n"); sf_sampsize = SIZE_16; + } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_S32, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) { + printf("Got BS32C1\n"); + sf_sampsize = SIZE_32; } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_U8, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) { printf("Got BU8C1\n"); sf_us = 1; @@ -275,6 +287,10 @@ int init(int modulen, char* argstr) { printf("Got BU16C1\n"); sf_sampsize = SIZE_16; sf_us = 1; + } else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_U32, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) { + printf("Got BU32C1\n"); + sf_sampsize = SIZE_32; + sf_us = 1; } else { printf("Couldn't convince ALSA to give sane settings: %i\n", code); snd_pcm_close(scope_pcm);