radio: Silero VAD + auto-PTT; chatgui/android: app icon and background
This commit is contained in:
1 parent
74ca98b38f
commit
1176411b79
51 files changed
+155505
-138
No files matched your search
@@ -163,6 +163,7 @@ object NativeLib {
|
||||
fun radioAudioFeed(groupId: Long, samples: ShortArray): Boolean = nativeRadioAudioFeed(groupId, samples)
|
||||
fun radioAudioPull(groupId: Long, out: ShortArray): Int = nativeRadioAudioPull(groupId, out)
|
||||
fun radioAudioStop() { nativeRadioAudioStop() }
|
||||
fun radioVadMode(): Boolean = nativeRadioVadMode()
|
||||
fun radioTalkBegin(groupId: Long) { nativeRadioTalkBegin(groupId) }
|
||||
fun radioTalkEnd(groupId: Long) { nativeRadioTalkEnd(groupId) }
|
||||
|
||||
@@ -270,6 +271,7 @@ object NativeLib {
|
||||
private external fun nativeRadioAudioFeed(groupId: Long, samples: ShortArray): Boolean
|
||||
private external fun nativeRadioAudioPull(groupId: Long, out: ShortArray): Int
|
||||
private external fun nativeRadioAudioStop()
|
||||
private external fun nativeRadioVadMode(): Boolean
|
||||
private external fun nativeRadioTalkBegin(groupId: Long)
|
||||
private external fun nativeRadioTalkEnd(groupId: Long)
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ class RadioAudioEngine {
|
||||
@Volatile private var groupId = 0L
|
||||
@Volatile private var talking = false
|
||||
@Volatile private var micDead = false
|
||||
@Volatile private var vadMode = false /* VAD авто-PTT: фидим PCM постоянно */
|
||||
@Volatile private var captureChannels = 1 /* 1=моно, 2=стерео — по настройке захвата */
|
||||
|
||||
/** Маршрутизация аудио-выхода рации (динамик ↔ гарнитура), как в звонке. */
|
||||
@@ -164,6 +165,10 @@ class RadioAudioEngine {
|
||||
return
|
||||
}
|
||||
|
||||
/* VAD авто-PTT: сервисный слой решил, что режим включён — фидим PCM постоянно. */
|
||||
vadMode = NativeLib.radioVadMode()
|
||||
if (vadMode) LogManager.addLog("INFO", "RadioAudio", "VAD auto-PTT enabled group=$group")
|
||||
|
||||
// ── AudioTrack (воспроизведение, всегда стерео) ──
|
||||
val trackMin = AudioTrack.getMinBufferSize(
|
||||
SAMPLE_RATE, AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT)
|
||||
@@ -351,7 +356,7 @@ class RadioAudioEngine {
|
||||
}
|
||||
read += n
|
||||
}
|
||||
if (talking && !NativeLib.radioAudioFeed(groupId, buf)) {
|
||||
if ((talking || vadMode) && !NativeLib.radioAudioFeed(groupId, buf)) {
|
||||
LogManager.addLog("WARN", "RadioAudio", "radioAudioFeed returned false")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user