Skip to content

Commit d78cd1c

Browse files
committed
2 parents da5fb4b + bf850ab commit d78cd1c

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/AudioTools/AudioLibs/SPDIFOutput.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ struct SPDIFConfig : public AudioInfo {
117117
};
118118

119119
/**
120-
* @brief Output as 16 bit stereo SPDIF on the I2S data output pin
120+
* @brief Output as 16 bit stereo SPDIF on the I2S data output pin. For the
121+
* time beeing only the ESP32 is officially supported.
121122
* @ingroup io
122123
* @author Phil Schatzmann
123124
* @copyright GPLv3

src/AudioTools/Concurrency/Mutex.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
2-
#include <atomic>
32

43
#include "AudioConfig.h"
54

65
#ifdef USE_STD_CONCURRENCY
6+
#include <atomic>
77
#include <mutex>
88
#endif
99

@@ -21,6 +21,8 @@ class MutexBase {
2121
virtual void unlock() {}
2222
};
2323

24+
#if defined(USE_STD_CONCURRENCY)
25+
2426
class SpinLock : public MutexBase {
2527
void lock() {
2628
for (;;) {
@@ -51,7 +53,6 @@ class SpinLock : public MutexBase {
5153
volatile std::atomic<bool> lock_ = {0};
5254
};
5355

54-
#if defined(USE_STD_CONCURRENCY)
5556

5657
/**
5758
* @brief Mutex implemntation based on std::mutex

src/AudioTools/CoreAudio/AudioI2S/I2SESP32V1.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,10 @@ class I2SDriverESP32V1 {
162162
i2s_chan_handle_t &rx_chan, int txPin, int rxPin) {
163163
TRACED();
164164
LOGI("tx: %d, rx: %d", txPin, rxPin);
165-
i2s_std_config_t std_cfg = {
166-
.clk_cfg = getClockConfig(cfg),
167-
.slot_cfg = getSlotConfig(cfg),
168-
.gpio_cfg =
169-
{
165+
i2s_std_config_t std_cfg;
166+
std_cfg.clk_cfg = getClockConfig(cfg);
167+
std_cfg.slot_cfg = getSlotConfig(cfg);
168+
std_cfg.gpio_cfg = {
170169
.mclk = (gpio_num_t)cfg.pin_mck,
171170
.bclk = (gpio_num_t)cfg.pin_bck,
172171
.ws = (gpio_num_t)cfg.pin_ws,
@@ -178,8 +177,8 @@ class I2SDriverESP32V1 {
178177
.bclk_inv = false,
179178
.ws_inv = false,
180179
},
181-
},
182180
};
181+
183182

184183
if (cfg.rx_tx_mode == RXTX_MODE || cfg.rx_tx_mode == TX_MODE) {
185184
if (i2s_channel_init_std_mode(tx_chan, &std_cfg) != ESP_OK) {
@@ -264,8 +263,12 @@ class I2SDriverESP32V1 {
264263

265264
i2s_std_clk_config_t getClockConfig(I2SConfigESP32V1 &cfg) {
266265
TRACED();
267-
i2s_std_clk_config_t clk_cfg =
268-
I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
266+
i2s_std_clk_config_t clk_cfg;// = I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
267+
memset(&clk_cfg, 0, sizeof(i2s_std_clk_config_t));
268+
clk_cfg.sample_rate_hz = cfg.sample_rate;
269+
clk_cfg.clk_src = getClockSource(cfg);
270+
// clk_cfg.ext_clk_freq_hz = 0;
271+
269272
if (cfg.mclk_multiple > 0) {
270273
clk_cfg.mclk_multiple = (i2s_mclk_multiple_t)cfg.mclk_multiple;
271274
LOGI("mclk_multiple=%d", clk_cfg.mclk_multiple);
@@ -275,13 +278,11 @@ class I2SDriverESP32V1 {
275278
clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_384;
276279
LOGI("mclk_multiple=384");
277280
} else {
281+
clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_256;
278282
LOGI("mclk_multiple=%d", clk_cfg.mclk_multiple);
279283
}
280284
}
281285

282-
// determine clock source
283-
clk_cfg.clk_src = getClockSource(cfg);
284-
285286
return clk_cfg;
286287
}
287288

0 commit comments

Comments
 (0)