Merge remote-tracking branch 'origin/master-cmake' into master-cmake

This commit is contained in:
Sebastien
2021-04-21 13:27:36 -04:00
4 changed files with 21 additions and 10 deletions

View File

@@ -123,6 +123,7 @@ The NVS parameter "i2c_config" set the i2c's gpio used for generic purpose (e.g.
``` ```
sda=<gpio>,scl=<gpio>[,port=0|1][,speed=<speed>] sda=<gpio>,scl=<gpio>[,port=0|1][,speed=<speed>]
``` ```
<strong>Please note that you can not use the same GPIO or port as the DAC</strong>
### SPI ### SPI
The NVS parameter "spi_config" set the spi's gpio used for generic purpose (e.g. display). Leave it blank to disable SPI usage. The DC parameter is needed for displays. Syntax is The NVS parameter "spi_config" set the spi's gpio used for generic purpose (e.g. display). Leave it blank to disable SPI usage. The DC parameter is needed for displays. Syntax is
``` ```
@@ -144,6 +145,8 @@ The parameter "dac_controlset" allows definition of simple commands to be sent o
This is standard JSON notation, so if you are not familiar with it, Google is your best friend. Be aware that the '...' means you can have as many entries as you want, it's not part of the syntax. Every section is optional, but it does not make sense to set i2c in the 'dac_config' parameter and not setting anything here. The parameter 'mode' allows to *or* the register with the value or to *and* it. Don't set 'mode' if you simply want to write. **Note that all values must be decimal**. You can use a validator like [this](https://jsonlint.com) to verify your syntax This is standard JSON notation, so if you are not familiar with it, Google is your best friend. Be aware that the '...' means you can have as many entries as you want, it's not part of the syntax. Every section is optional, but it does not make sense to set i2c in the 'dac_config' parameter and not setting anything here. The parameter 'mode' allows to *or* the register with the value or to *and* it. Don't set 'mode' if you simply want to write. **Note that all values must be decimal**. You can use a validator like [this](https://jsonlint.com) to verify your syntax
NB: For well-known configuration, this is ignored NB: For well-known configuration, this is ignored
<strong>Please note that you can not use the same GPIO or port as the I2C</strong>
### SPDIF ### SPDIF
The NVS parameter "spdif_config" sets the i2s's gpio needed for SPDIF. The NVS parameter "spdif_config" sets the i2s's gpio needed for SPDIF.

View File

@@ -39,7 +39,7 @@ static bool init(char *config, int i2c_port_num, i2s_config_t *i2s_config) {
char *p; char *p;
i2c_addr = adac_init(config, i2c_port_num); i2c_addr = adac_init(config, i2c_port_num);
if (!i2c_addr) return false; if (!i2c_addr) return true;
ESP_LOGI(TAG, "DAC on I2C @%d", i2c_addr); ESP_LOGI(TAG, "DAC on I2C @%d", i2c_addr);

View File

@@ -152,20 +152,28 @@ static int read_mp4_header(unsigned long *samplerate_p, unsigned char *channels_
return -1; return -1;
} }
int desc_len = mp4_desc_length(&ptr); int desc_len = mp4_desc_length(&ptr);
info.profile = *ptr >> 3; int AOT = *ptr >> 3;
info.profile = AAC_PROFILE_LC;
info.sampRateCore = (*ptr++ & 0x07) << 1; info.sampRateCore = (*ptr++ & 0x07) << 1;
info.sampRateCore |= (*ptr >> 7) & 0x01; info.sampRateCore |= (*ptr >> 7) & 0x01;
info.sampRateCore = rates[info.sampRateCore]; info.sampRateCore = rates[info.sampRateCore];
info.nChans = (*ptr++ & 0x7f) >> 3; info.nChans = (*ptr & 0x7f) >> 3;
*channels_p = info.nChans; *channels_p = info.nChans;
if (desc_len > 2 && ((ptr[0] << 3) | (ptr[1] >> 5)) == 0x2b7 && (ptr[1] & 0x1f) == 0x05 && (ptr[2] & 0x80)) { // Note that 24 bits frequencies are not handled
*samplerate_p = rates[(ptr[2] & 0x78) >> 3]; if (AOT == 5 || AOT == 29) {
LOG_WARN("AAC SBR mode activated => high CPU consumption expected, please use LMS proxy to mitigate"); *samplerate_p = rates[((ptr[0] & 0x03) << 1) | (ptr[1] >> 7)];
} else { LOG_WARN("AAC stream with SBR => high CPU required (use LMS proxied mode)");
} else if (desc_len > 2 && ((ptr[1] << 3) | (ptr[2] >> 5)) == 0x2b7 && (ptr[2] & 0x1f) == 0x05 && (ptr[3] & 0x80)) {
*samplerate_p = rates[(ptr[3] & 0x78) >> 3];
LOG_WARN("AAC stream with extended SBR => high CPU required (use LMS proxied mode)");
} else if (AOT == 2) {
*samplerate_p = info.sampRateCore; *samplerate_p = info.sampRateCore;
} else {
*samplerate_p = 44100;
LOG_ERROR("AAC audio object type %d not handled", AOT);
} }
HAAC(a, SetRawBlockParams, a->hAac, 0, &info); HAAC(a, SetRawBlockParams, a->hAac, 0, &info);
LOG_DEBUG("playable aac track: %u (p:%x, r:%d, c:%d)", trak, info.profile, info.sampRateCore, info.nChans); LOG_DEBUG("playable aac track: %u (p:%x, r:%d, c:%d, desc_len:%d)", trak, AOT, info.sampRateCore, info.nChans, desc_len);
play = trak; play = trak;
} }

View File

@@ -87,7 +87,7 @@ menu "Squeezelite-ESP32"
default "TWATCH" if TWATCH2020 default "TWATCH" if TWATCH2020
default "I2S-4MFlash" if !A1S && !SQUEEZEAMP && !DAC32 && !TWATCH2020 default "I2S-4MFlash" if !A1S && !SQUEEZEAMP && !DAC32 && !TWATCH2020
# AGGREGATES - begin # AGGREGATES - begin
# these parameters are "aggregates" that take precedence. The must have a default value # these parameters are "aggregates" that take precedence. They must have a default value
config DAC_CONFIG config DAC_CONFIG
string string
default "model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0" if SQUEEZEAMP default "model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0" if SQUEEZEAMP