Skip to content

Commit

Permalink
bgm_xyscope: accept 32 bit samples from alsa
Browse files Browse the repository at this point in the history
  • Loading branch information
fridtjof committed Jan 1, 2025
1 parent 02d38ce commit 75eb5e3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/modules/bgm_xyscope.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,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;
Expand All @@ -260,20 +264,32 @@ 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))) {
printf("Got BS8C1\n");
} 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;
} else if (!(code = snd_pcm_set_params(scope_pcm, SND_PCM_FORMAT_U16, SND_PCM_ACCESS_RW_INTERLEAVED, 1, SAMPLE_RATE, 1, 1000))) {
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);
Expand Down

0 comments on commit 75eb5e3

Please sign in to comment.