Fixed bug in configuring audio modules in audio settings

This commit is contained in:
Juha Heinanen
2025-01-01 07:33:32 +02:00
parent 62443ef0ec
commit 805e63c831
2 changed files with 54 additions and 42 deletions
@@ -210,13 +210,17 @@ class AudioActivity : AppCompatActivity() {
save = true
}
var gain = micGain.text.toString().trim()
var gain = "1.0"
if (!BaresipService.agc) {
gain = micGain.text.toString().trim()
if (!gain.contains("."))
gain = "$gain.0"
if (gain != oldMicGain) {
if (!checkMicGain(gain)) {
Utils.alertView(this, getString(R.string.notice),
"${getString(R.string.invalid_microphone_gain)}: $gain.")
Utils.alertView(
this, getString(R.string.notice),
"${getString(R.string.invalid_microphone_gain)}: $gain."
)
micGain.setText(oldMicGain)
return false
}
@@ -227,8 +231,10 @@ class AudioActivity : AppCompatActivity() {
} else {
if (oldMicGain == "1.0") {
if (Api.module_load("augain") != 0) {
Utils.alertView(this, getString(R.string.error),
getString(R.string.failed_to_load_module))
Utils.alertView(
this, getString(R.string.error),
getString(R.string.failed_to_load_module)
)
micGain.setText(oldMicGain)
return false
}
@@ -239,6 +245,7 @@ class AudioActivity : AppCompatActivity() {
}
save = true
}
}
if (speakerPhone.isChecked != BaresipService.speakerPhone) {
BaresipService.speakerPhone = speakerPhone.isChecked
@@ -294,6 +301,7 @@ class AudioActivity : AppCompatActivity() {
save = true
}
if (!BaresipService.aec) {
if (aec.isChecked != oldAec) {
if (aec.isChecked) {
Config.addVariable("module", "webrtc_aecm.so")
@@ -301,8 +309,10 @@ class AudioActivity : AppCompatActivity() {
restart = true
} else {
if (Api.module_load("webrtc_aecm.so") != 0) {
Utils.alertView(this, getString(R.string.error),
getString(R.string.failed_to_load_module))
Utils.alertView(
this, getString(R.string.error),
getString(R.string.failed_to_load_module)
)
aec.isChecked = false
return false
}
@@ -313,6 +323,7 @@ class AudioActivity : AppCompatActivity() {
}
save = true
}
}
val audioDelay = audioDelay.text.toString().trim()
if (audioDelay != BaresipService.audioDelay.toString()) {
@@ -20,6 +20,7 @@ object Config {
if (!File(configPath).exists()) {
for (module in AudioActivity.audioModules)
config = "${config}module ${module}.so\n"
if (!BaresipService.aec)
config = "${config}module webrtc_aecm.so\n"
previousConfig = config
} else {