From 22c2044f17fd7b9c55ad65fb459cdb95e8d3fa1c Mon Sep 17 00:00:00 2001 From: Philippe G Date: Sun, 28 Mar 2021 13:54:45 -0700 Subject: [PATCH] Limit rate to 96kHz in 32 bits mode + CMakeLists correction @sle118, le tme know if the CMakeLists works for you as well. I pushed this one as I was pushing other stuff anyway --- components/squeezelite/CMakeLists.txt | 15 ++++++++++----- components/squeezelite/output_embedded.c | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/components/squeezelite/CMakeLists.txt b/components/squeezelite/CMakeLists.txt index caa0732f..61bbc84b 100644 --- a/components/squeezelite/CMakeLists.txt +++ b/components/squeezelite/CMakeLists.txt @@ -30,10 +30,15 @@ set_source_files_properties(flac.c ) add_definitions(-DLINKALL -DLOOPBACK -DNO_FAAD -DEMBEDDED -DTREMOR_ONLY -DCUSTOM_VERSION=${BUILD_NUMBER}) -if(DEFINED DEPTH AND ${DEPTH} EQUAL "32") -add_definitions(-DBYTES_PER_FRAME=8) -else() -add_definitions(-DRESAMPLE16 -DBYTES_PER_FRAME=4) -endif() + +if(NOT DEFINED DEPTH) + set(DEPTH "16") +endif() + +if (${DEPTH} EQUAL "32") + add_definitions(-DBYTES_PER_FRAME=8) +else() + add_definitions(-DRESAMPLE16 -DBYTES_PER_FRAME=4) +endif() add_compile_options (-O3 ) diff --git a/components/squeezelite/output_embedded.c b/components/squeezelite/output_embedded.c index 1d36822e..3dfa584d 100644 --- a/components/squeezelite/output_embedded.c +++ b/components/squeezelite/output_embedded.c @@ -114,7 +114,11 @@ void set_volume(unsigned left, unsigned right) { bool test_open(const char *device, unsigned rates[], bool userdef_rates) { memset(rates, 0, MAX_SUPPORTED_SAMPLERATES * sizeof(unsigned)); if (!strcasecmp(device, "I2S")) { - unsigned _rates[] = { 192000, 176400, 96000, 88200, 48000, + unsigned _rates[] = { +#if BYTES_PER_FRAME == 4 + 192000, 176400, +#endif + 96000, 88200, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0 }; memcpy(rates, _rates, sizeof(_rates));