Skip to content

Commit b8914f7

Browse files
authored
Merge pull request #1065 from schreibfaul1/OPUS-Hybrid-Node
add Opus hybrid mode https://st01.sslstream.dlf.de/dlf/01/low/opus/stream.opus?aggregator=web is working now new audio_info event: "Opus Mode"
2 parents dc9e0ce + ccf20a7 commit b8914f7

File tree

6 files changed

+189
-103
lines changed

6 files changed

+189
-103
lines changed

src/Audio.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
audio.cpp
44
55
Created on: Oct 28.2018 */char audioI2SVers[] ="\
6-
Version 3.3.1a ";
7-
/* Updated on: Jun 12.2025
6+
Version 3.3.2 ";
7+
/* Updated on: Jun 14.2025
88
99
Author: Wolle (schreibfaul1)
1010
Audio library for ESP32, ESP32-S3 or ESP32-P4
@@ -321,6 +321,7 @@ void Audio::setDefaults() {
321321
m_M4A_objectType = 0;
322322
m_M4A_sampleRate = 0;
323323
m_sumBytesDecoded = 0;
324+
m_opus_mode = 0;
324325
m_vuLeft = m_vuRight = 0; // #835
325326
std::fill(std::begin(m_inputHistory), std::end(m_inputHistory), 0);
326327
if(m_f_reset_m3u8Codec){m_m3u8Codec = CODEC_AAC;} // reset to default
@@ -4814,7 +4815,16 @@ int Audio::sendBytes(uint8_t* data, size_t len) {
48144815
// log_i("---------------------------------------------------------------------------");
48154816
if(audio_oggimage) audio_oggimage(audiofile, vec);
48164817
}
4818+
4819+
if(m_opus_mode != OPUSgetMode()){
4820+
m_opus_mode = OPUSgetMode();
4821+
if(m_opus_mode == MODE_CELT_ONLY) log_info("Opus Mode: CELT_ONLY");
4822+
if(m_opus_mode == MODE_HYBRID) log_info("Opus Mode: HYBRID");
4823+
if(m_opus_mode == MODE_SILK_ONLY) log_info("Opus Mode: SILK_ONLY");
4824+
if(m_opus_mode == MODE_NONE) log_info("Opus Mode: NONE");
4825+
}
48174826
break;
4827+
48184828
case CODEC_VORBIS: if(m_decodeError == VORBIS_PARSE_OGG_DONE) return bytesDecoded; // nothing to play
48194829
m_validSamples = VORBISGetOutputSamps();
48204830
st = VORBISgetStreamTitle();

src/Audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ class Audio : private AudioBuffer{
726726
uint16_t m_vol = 21; // volume
727727
uint16_t m_vol_steps = 21; // default
728728
int16_t m_inputHistory[6] = {0}; // used in resampleTo48kStereo()
729+
uint16_t m_opus_mode = 0; // celt_only, silk_only or hybrid
729730
double m_limit_left = 0; // limiter 0 ... 1, left channel
730731
double m_limit_right = 0; // limiter 0 ... 1, right channel
731732
uint8_t m_timeoutCounter = 0; // timeout counter

0 commit comments

Comments
 (0)