add support for sample rates different to 48kHz (#15)
- instead of storing chunk duration in ms store the frame count and do calculations based on that - add updated snapserver.conf for reference (#17) - some code clean up - move Kconfig entries to correct place - remove unnecessary Kconfig entries - add necessary dependencies in Kconfig files Signed-off-by: Karl Osterseher <karli_o@gmx.at>
This commit is contained in:
@@ -25,37 +25,4 @@ menu "Snapcast Configuration"
|
||||
default "ESP32-Caster"
|
||||
help
|
||||
Name of the client to register the snapserver.
|
||||
|
||||
config SNAPCLIENT_USE_SOFT_VOL
|
||||
bool "Use software volume"
|
||||
default false
|
||||
depends on USE_DSP_PROCESSOR
|
||||
help
|
||||
Use software volume mixer instead of hardware mixer.
|
||||
|
||||
choice SNAPCLIENT_DSP_FLOW
|
||||
prompt "DSP flow"
|
||||
default SNAPCLIENT_DSP_FLOW_STEREO
|
||||
help
|
||||
Select the DSP flow to use.
|
||||
|
||||
config SNAPCLIENT_DSP_FLOW_STEREO
|
||||
bool "Stereo flow"
|
||||
|
||||
config SNAPCLIENT_DSP_FLOW_BASSBOOST
|
||||
bool "Bassboost flow"
|
||||
|
||||
config SNAPCLIENT_DSP_FLOW_BIAMP
|
||||
bool "Bi-Amp flow"
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
menu "SNTP Configuration"
|
||||
|
||||
config SNPACLIENT_SNTP_ENABLE
|
||||
bool "Enable SNTP"
|
||||
default true
|
||||
help
|
||||
Enable the setup of RTC time using the SNTP protocol.
|
||||
endmenu
|
||||
|
||||
32
main/main.c
32
main/main.c
@@ -114,7 +114,8 @@ SemaphoreHandle_t timeSyncSemaphoreHandle = NULL;
|
||||
|
||||
#if CONFIG_USE_DSP_PROCESSOR
|
||||
#if CONFIG_SNAPCLIENT_DSP_FLOW_STEREO
|
||||
dspFlows_t dspFlow = dspfStereo; // dspfBiamp; // dspfStereo; // dspfBassBoost;
|
||||
// dspFlows_t dspFlow = dspfStereo; // dspfBiamp; // dspfStereo; //
|
||||
// dspfBassBoost;
|
||||
#endif
|
||||
#if CONFIG_SNAPCLIENT_DSP_FLOW_BASSBOOST
|
||||
dspFlows_t dspFlow = dspfBassBoost;
|
||||
@@ -499,9 +500,8 @@ void flac_task(void *pvParameters) {
|
||||
pcmData->timestamp = currentTimestamp;
|
||||
|
||||
size_t decodedSize = pcmData->totalSize; // pFlacData->bytes;
|
||||
scSet->chkDur_ms = (1000UL * decodedSize) /
|
||||
(uint32_t)(scSet->ch * (scSet->bits / 8)) /
|
||||
scSet->sr;
|
||||
scSet->chkInFrames =
|
||||
decodedSize / ((size_t)scSet->ch * (size_t)(scSet->bits / 8));
|
||||
if (player_send_snapcast_setting(scSet) != pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
"Failed to "
|
||||
@@ -515,7 +515,7 @@ void flac_task(void *pvParameters) {
|
||||
}
|
||||
|
||||
#if CONFIG_USE_DSP_PROCESSOR
|
||||
dsp_setup_flow(500, scSet->sr, scSet->chkDur_ms);
|
||||
dsp_setup_flow(500, scSet->sr, scSet->chkInFrames);
|
||||
dsp_processor(pcmData->fragment->payload, pcmData->fragment->size,
|
||||
dspFlow);
|
||||
#endif
|
||||
@@ -781,7 +781,7 @@ static void http_get_task(void *pvParameters) {
|
||||
scSet.bits = 0;
|
||||
scSet.ch = 0;
|
||||
scSet.sr = 0;
|
||||
scSet.chkDur_ms = 0;
|
||||
scSet.chkInFrames = 0;
|
||||
scSet.volume = 0;
|
||||
scSet.muted = true;
|
||||
|
||||
@@ -1400,10 +1400,9 @@ static void http_get_task(void *pvParameters) {
|
||||
// %d",
|
||||
// decodedSize);
|
||||
|
||||
scSet.chkDur_ms =
|
||||
(1000UL * decodedSize) /
|
||||
(uint32_t)(scSet.ch * (scSet.bits / 8)) /
|
||||
scSet.sr;
|
||||
scSet.chkInFrames =
|
||||
decodedSize / ((size_t)scSet.ch *
|
||||
(size_t)(scSet.bits / 8));
|
||||
if (player_send_snapcast_setting(&scSet) !=
|
||||
pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
@@ -1437,7 +1436,8 @@ static void http_get_task(void *pvParameters) {
|
||||
}
|
||||
dsp_set_vol(dynamic_vol);
|
||||
}
|
||||
dsp_setup_flow(500, scSet.sr, scSet.chkDur_ms);
|
||||
dsp_setup_flow(500, scSet.sr,
|
||||
scSet.chkInFrames);
|
||||
dsp_processor(pcmData->fragment->payload,
|
||||
pcmData->fragment->size, dspFlow);
|
||||
#endif
|
||||
@@ -1459,10 +1459,10 @@ static void http_get_task(void *pvParameters) {
|
||||
|
||||
pcmData->timestamp = wire_chnk.timestamp;
|
||||
|
||||
scSet.chkDur_ms =
|
||||
(1000UL * decodedSize) /
|
||||
(uint32_t)(scSet.ch * (scSet.bits / 8)) /
|
||||
scSet.sr;
|
||||
scSet.chkInFrames =
|
||||
decodedSize /
|
||||
((size_t)scSet.ch * (size_t)(scSet.bits / 8));
|
||||
|
||||
if (player_send_snapcast_setting(&scSet) !=
|
||||
pdPASS) {
|
||||
ESP_LOGE(TAG,
|
||||
@@ -1492,7 +1492,7 @@ static void http_get_task(void *pvParameters) {
|
||||
}
|
||||
dsp_set_vol(dynamic_vol);
|
||||
}
|
||||
dsp_setup_flow(500, scSet.sr, scSet.chkDur_ms);
|
||||
dsp_setup_flow(500, scSet.sr, scSet.chkInFrames);
|
||||
dsp_processor(pcmData->fragment->payload,
|
||||
pcmData->fragment->size, dspFlow);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user