chatgui: add radio activation by signal level with hysteresis

This commit is contained in:
evgeny committed 2026-10-08 17:53:16 +02:00
1 parent 2845270016
commit 44af542f61
23 files changed
+721 -259

No files matched your search

@@ -70,9 +70,9 @@ class ConfigProvider(private val context: Context) {
private val soundEnabledKey = booleanPreferencesKey("sound_enabled")
private val mutedChannelsKey = stringSetPreferencesKey("muted_channels")
private val callAudioRouteKey = stringPreferencesKey("call_audio_route")
private val radioVadEnabledKey = intPreferencesKey("radio_vad_enabled")
private val radioVadEnabledKey = intPreferencesKey("radio_auto_enabled")
private val radioVadThresholdKey = intPreferencesKey("radio_vad_threshold")
private val radioVadHangoverMsKey = intPreferencesKey("radio_vad_hangover_ms")
private val radioVadHangoverMsKey = intPreferencesKey("radio_auto_hangover_ms")
private val radioVadCompressorMaxGainDbKey = intPreferencesKey("radio_vad_compressor_max_gain_db")
private val radioVolumePttKey = booleanPreferencesKey("radio_volume_ptt")
private val radioOverlayKey = booleanPreferencesKey("radio_overlay")
@@ -609,9 +609,9 @@ class ConfigProvider(private val context: Context) {
appendLine("storage_autoload_maxsize_mb=$chatAutoloadMaxMb")
appendLine("storage_maxsize_gb=$chatMaxGb")
appendLine("opus_codec_preset=$chatOpusPreset")
appendLine("radio_vad_enabled=${getInt("radio.vad_enabled")}")
appendLine("radio_auto_enabled=${getInt("radio.vad_enabled")}")
appendLine("radio_vad_threshold=${getInt("radio.vad_threshold")}")
appendLine("radio_vad_hangover_ms=${getInt("radio.vad_hangover_ms")}")
appendLine("radio_auto_hangover_ms=${getInt("radio.vad_hangover_ms")}")
appendLine("radio_vad_compressor_max_gain_db=${getInt("radio.vad_compressor_max_gain_db")}")
appendLine("radio_opus_mode=$radioOpusMode")
appendLine("radio_opus_bitrate=$radioOpusBitrate")
@@ -611,7 +611,7 @@ private fun RadioSettingsTab() {
{ vadHangover = it.toInt() }, onValueChangeFinished = {
scope.launch {
provider.setValue("radio.vad_hangover_ms", vadHangover.toString())
NativeLib.setChatSetting("radio_vad_hangover_ms", vadHangover.toString())
NativeLib.setChatSetting("radio_auto_hangover_ms", vadHangover.toString())
RadioAudioEngine.instance().reconfigure()
}
})
@@ -945,7 +945,7 @@ class ChatViewModel : ViewModel() {
viewModelScope.launch {
val ctx = ChatApplication.instance
ctx.configProvider.setValue("radio.vad_enabled", if (enabled) "1" else "0")
NativeLib.setChatSetting("radio_vad_enabled", if (enabled) "1" else "0")
NativeLib.setChatSetting("radio_auto_enabled", if (enabled) "1" else "0")
LogManager.addLog("INFO", "RadioAudio", "Panel VAD enabled=$enabled channel=$radioChannelId")
if (enabled) RadioOverlayService.requestPermissions() else RadioOverlayService.sync(ctx)
radioAudio.reconfigure(restartVad = enabled)