|
3 | 3 | audio.cpp |
4 | 4 |
|
5 | 5 | Created on: Oct 28.2018 */char audioI2SVers[] ="\ |
6 | | - Version 3.3.2a "; |
7 | | -/* Updated on: Jun 14.2025 |
| 6 | + Version 3.3.2b "; |
| 7 | +/* Updated on: Jun 19.2025 |
8 | 8 |
|
9 | 9 | Author: Wolle (schreibfaul1) |
10 | 10 | Audio library for ESP32, ESP32-S3 or ESP32-P4 |
@@ -2456,55 +2456,6 @@ size_t Audio::resampleTo48kStereo(const int16_t* input, size_t inputSamples) { |
2456 | 2456 | return outputIndex; |
2457 | 2457 | } |
2458 | 2458 |
|
2459 | | -// size_t Audio::resampleTo48kStereo(const int16_t* input, size_t samplesPerFrame) { |
2460 | | - |
2461 | | -// float cursor = m_resampleCursor; |
2462 | | -// float ratio = static_cast<float>(m_sampleRate) / 48000.0f; |
2463 | | - |
2464 | | -// size_t outputIndex = 0; |
2465 | | -// int16_t left1, right1, left2, right2; |
2466 | | - |
2467 | | -// for (int i = 0; i < samplesPerFrame; ++i) { |
2468 | | -// float outFramePos = i / m_resampleRatio; |
2469 | | -// size_t idx = static_cast<size_t>(outFramePos); |
2470 | | -// float frac = outFramePos - idx; |
2471 | | - |
2472 | | -// if(i == 0){ |
2473 | | -// left1 = m_inputHistory[0]; |
2474 | | -// right1 = m_inputHistory[1]; |
2475 | | -// } |
2476 | | -// else{ |
2477 | | -// left1 = input[(i - 1) * 2]; |
2478 | | -// right1 = input[(i - 1) * 2 + 1]; |
2479 | | -// } |
2480 | | -// left2 = input[i * 2]; |
2481 | | -// right2 = input[i * 2 + 1]; |
2482 | | - |
2483 | | -// if(i == samplesPerFrame - 1){ |
2484 | | - |
2485 | | -// } |
2486 | | - |
2487 | | -// while (cursor < 1.0f) { |
2488 | | - |
2489 | | -// m_samplesBuff48K.get()[outputIndex * 2] = static_cast<int16_t>(left1 * (1.0f - frac) + left2 * frac); |
2490 | | -// m_samplesBuff48K.get()[outputIndex * 2 + 1] = static_cast<int16_t>(right1 * (1.0f - frac) + right2 * frac); |
2491 | | - |
2492 | | - |
2493 | | -// ++outputIndex; |
2494 | | -// cursor += ratio; |
2495 | | -// } |
2496 | | -// cursor -= 1.0f; |
2497 | | -// } |
2498 | | -// m_resampleCursor = cursor; |
2499 | | -// m_inputHistory[0] = input[(samplesPerFrame - 1) * 2]; |
2500 | | -// m_inputHistory[1] = input[(samplesPerFrame - 1) * 2 + 1]; |
2501 | | - |
2502 | | -// // log_w("samplesPerFrame %i, outputIndex %i, cursor %f", samplesPerFrame, outputIndex, cursor); |
2503 | | -// return outputIndex; |
2504 | | -// } |
2505 | | - |
2506 | | - |
2507 | | - |
2508 | 2459 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2509 | 2460 | void IRAM_ATTR Audio::playChunk() { |
2510 | 2461 | if(m_validSamples == 0) return; // nothing to do |
|
0 commit comments