From 1612e8ea50854d72fce1119cdccc300ef4d3ebe6 Mon Sep 17 00:00:00 2001
From: Daniel Kulp
*Can be set as high as 120dBμV, but voltage accuracy above 115dBμV is not guaranteed.
Preemphasis: "50us", "75μs (USA, default)"=>"75us"), "fpp-vastfmt", ""); ?>
Antenna Tuning Capacitor (0=Auto, 1-191): * 0.25pF
+Enable Audio Limitter:
+Enable Audio Compression:
+Audio Compression Threshold (-64 - 0 db):
+Audio Gain (0 - 16):
diff --git a/src/FPPVastFM.cpp b/src/FPPVastFM.cpp index c361cc4..77068ca 100755 --- a/src/FPPVastFM.cpp +++ b/src/FPPVastFM.cpp @@ -67,6 +67,11 @@ class FPPVastFMPlugin : public FPPPlugin { si4713 = new VASTFMT(); } if (si4713->isOk()) { + si4713->enableAudioCompression(settings["AudioCompression"] == "True"); + si4713->enableAudioLimitter(settings["AudioLimitter"] == "True"); + si4713->setAudioGain(std::stoi(settings["AudioGain"])); + si4713->setAudioCompressionThreshold(std::stoi(settings["AudioCompressionThreshold"])); + si4713->Init(); std::string rev = si4713->getRev(); @@ -268,6 +273,10 @@ class FPPVastFMPlugin : public FPPPlugin { #else setIfNotFound("ResetPin", "4"); #endif + setIfNotFound("AudioCompression", "True"); + setIfNotFound("AudioLimitter", "True"); + setIfNotFound("AudioGain", "5"); + setIfNotFound("AudioCompressionThreshold", "-15"); } void setIfNotFound(const std::string &s, const std::string &v, bool emptyAllowed = false) { if (settings.find(s) == settings.end()) { diff --git a/src/Si4713.cpp b/src/Si4713.cpp index 841ea46..df53c02 100755 --- a/src/Si4713.cpp +++ b/src/Si4713.cpp @@ -94,12 +94,16 @@ void Si4713::Init() { std::string rev = getRev(); //setProperty(SI4713_PROP_REFCLK_FREQ, 32768); // crystal is 32.768 setProperty(SI4713_PROP_TX_PREEMPHASIS, isEUPremphasis ? 1 : 0); // 75uS pre-emph (default for US) - setProperty(SI4713_PROP_TX_ACOMP_ENABLE, 0x03); // turn on limiter and AGC - setProperty(SI4713_PROP_TX_ACOMP_THRESHOLD, 0x10000-15); // -15 dBFS + uint16_t t = audioCompression ? 0x1 : 0; + if (audioLimitter) { + t |= 0x2; + } + setProperty(SI4713_PROP_TX_ACOMP_ENABLE, t); // turn on limiter and AGC + setProperty(SI4713_PROP_TX_ACOMP_THRESHOLD, 0x10000 + audioCompressionThreshold); setProperty(SI4713_PROP_TX_ATTACK_TIME, 0); // 0.5 ms setProperty(SI4713_PROP_TX_RELEASE_TIME, 4); // 1000 ms - setProperty(SI4713_PROP_TX_ACOMP_GAIN, 5); // dB + setProperty(SI4713_PROP_TX_ACOMP_GAIN, audioGain); // dB } @@ -307,7 +311,7 @@ void Si4713::sendTimestamp() { offset = abs(offset) & 0x1F; } - uint8_t sb = TX_RDS_BUFF_IN_LDBUFF | TX_RDS_BUFF_IN_FIFO; + uint8_t sb = TX_RDS_BUFF_IN_LDBUFF;// | TX_RDS_BUFF_IN_FIFO; std::vector