Skip to content

Commit a5e9df6

Browse files
committed
Revert "Merge pull request #204 from troyhacks/Strip_Level_Color_Adjust"
This reverts commit db55872, reversing changes made to 972257a.
1 parent db55872 commit a5e9df6

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

usermods/audioreactive/audio_reactive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static float lastFftCalc[NUM_GEQ_CHANNELS] = {0.0f}; // backup
348348

349349
#if !defined(CONFIG_IDF_TARGET_ESP32C3)
350350
// audio source parameters and constant
351-
constexpr SRate_t SAMPLE_RATE = 96000; // Base sample rate in Hz - 22Khz is a standard rate. Physical sample time -> 23ms
351+
constexpr SRate_t SAMPLE_RATE = 22050; // Base sample rate in Hz - 22Khz is a standard rate. Physical sample time -> 23ms
352352
//constexpr SRate_t SAMPLE_RATE = 16000; // 16kHz - use if FFTtask takes more than 20ms. Physical sample time -> 32ms
353353
//constexpr SRate_t SAMPLE_RATE = 20480; // Base sample rate in Hz - 20Khz is experimental. Physical sample time -> 25ms
354354
//constexpr SRate_t SAMPLE_RATE = 10240; // Base sample rate in Hz - previous default. Physical sample time -> 50ms

usermods/audioreactive/audio_source.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class AudioSource {
186186
bool _i2sMaster; // when false, ESP32 will be in I2S SLAVE mode (for devices that only operate in MASTER mode). Only works in newer IDF >= 4.4.x
187187
float _sampleScale; // pre-scaling factor for I2S samples
188188
I2S_datatype newSampleBuffer[I2S_SAMPLES_MAX+4] = { 0 }; // global buffer for i2s_read
189-
I2S_datatype newSampleBuffer4x[(I2S_SAMPLES_MAX*4)+4] = { 0 }; // global buffer for i2s_read
190189
};
191190

192191
/* Basic I2S microphone source
@@ -195,12 +194,12 @@ class AudioSource {
195194
*/
196195
class I2SSource : public AudioSource {
197196
public:
198-
I2SSource(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f, bool i2sMaster=false) :
197+
I2SSource(SRate_t sampleRate, int blockSize, float sampleScale = 1.0f, bool i2sMaster=true) :
199198
AudioSource(sampleRate, blockSize, sampleScale, i2sMaster) {
200199
_config = {
201200
.mode = i2sMaster ? i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX) : i2s_mode_t(I2S_MODE_SLAVE | I2S_MODE_RX),
202-
.sample_rate = _sampleRate, // slave mode: may help to set this to 96000, as the other side (master) controls sample rates
203-
.bits_per_sample = I2S_SAMPLE_RESOLUTION,
201+
.sample_rate = _sampleRate,
202+
.bits_per_sample = I2S_SAMPLE_RESOLUTION, // slave mode: may help to set this to 96000, as the other side (master) controls sample rates
204203
.channel_format = I2S_MIC_CHANNEL,
205204
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
206205
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
@@ -395,8 +394,6 @@ class I2SSource : public AudioSource {
395394

396395
memset(buffer, 0, sizeof(float) * num_samples); // clear output buffer
397396
I2S_datatype *newSamples = newSampleBuffer; // use global input buffer
398-
I2S_datatype *newSamples_buff = newSampleBuffer4x; // use oversampling global input buffer
399-
400397
if (num_samples > I2S_SAMPLES_MAX) num_samples = I2S_SAMPLES_MAX; // protect the buffer from overflow
401398

402399
err = i2s_read(AR_I2S_PORT, (void *)newSamples, num_samples * sizeof(I2S_datatype), &bytes_read, portMAX_DELAY);
@@ -411,15 +408,6 @@ class I2SSource : public AudioSource {
411408
return;
412409
}
413410

414-
if (_sampleRate == 96000) {
415-
int current = 0;
416-
for (int i = 0; i < 2048; i += 4) {
417-
newSamples[current] = newSamples_buff[i];
418-
current++;
419-
}
420-
num_samples /= 4; // back to 512 samples
421-
}
422-
423411
// Store samples in sample buffer and update DC offset
424412
for (int i = 0; i < num_samples; i++) {
425413

wled00/bus_manager.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ uint8_t IRAM_ATTR ColorOrderMap::getPixelColorOrder(uint16_t pix, uint8_t defaul
102102
uint8_t swapW = defaultColorOrder >> 4;
103103
for (uint8_t i = 0; i < _count; i++) {
104104
if (pix >= _mappings[i].start && pix < (_mappings[i].start + _mappings[i].len)) {
105-
return _mappings[i].colorOrder | (swapW << 4); // WLED-MM/TroyHacks: Disabling this disables color order mapping.
105+
return _mappings[i].colorOrder | (swapW << 4);
106106
}
107107
}
108108
return defaultColorOrder;
@@ -202,10 +202,6 @@ void IRAM_ATTR BusDigital::setPixelColor(uint16_t pix, uint32_t c) {
202202
case 2: c = RGBW32(R(cOld), G(cOld), W(c) , 0); break;
203203
}
204204
}
205-
if (_colorOrder != co) {
206-
c = RGBW32(dim8_lin(R(c)), dim8_lin(G(c)), dim8_lin(B(c)), 0); // WLED-MM/TroyHacks - remap pixels not in the default color order
207-
co = _colorOrder; // keep the original color order, as this is a hack. :)
208-
}
209205
PolyBus::setPixelColor(_busPtr, _iType, pix, c, co);
210206
}
211207

0 commit comments

Comments
 (0)