Fixed bug in configuring audio modules in audio settings
This commit is contained in:
@@ -210,34 +210,41 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
var gain = micGain.text.toString().trim()
|
var gain = "1.0"
|
||||||
if (!gain.contains("."))
|
if (!BaresipService.agc) {
|
||||||
gain = "$gain.0"
|
gain = micGain.text.toString().trim()
|
||||||
if (gain != oldMicGain) {
|
if (!gain.contains("."))
|
||||||
if (!checkMicGain(gain)) {
|
gain = "$gain.0"
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
if (gain != oldMicGain) {
|
||||||
"${getString(R.string.invalid_microphone_gain)}: $gain.")
|
if (!checkMicGain(gain)) {
|
||||||
micGain.setText(oldMicGain)
|
Utils.alertView(
|
||||||
return false
|
this, getString(R.string.notice),
|
||||||
}
|
"${getString(R.string.invalid_microphone_gain)}: $gain."
|
||||||
if (gain == "1.0") {
|
)
|
||||||
Api.module_unload("augain")
|
micGain.setText(oldMicGain)
|
||||||
Config.removeVariableValue("module", "augain.so")
|
return false
|
||||||
Config.replaceVariable("augain", "1.0")
|
|
||||||
} 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))
|
|
||||||
micGain.setText(oldMicGain)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
Config.addVariable("module", "augain.so")
|
|
||||||
}
|
}
|
||||||
Config.replaceVariable("augain", gain)
|
if (gain == "1.0") {
|
||||||
Api.cmd_exec("augain $gain")
|
Api.module_unload("augain")
|
||||||
|
Config.removeVariableValue("module", "augain.so")
|
||||||
|
Config.replaceVariable("augain", "1.0")
|
||||||
|
} 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)
|
||||||
|
)
|
||||||
|
micGain.setText(oldMicGain)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Config.addVariable("module", "augain.so")
|
||||||
|
}
|
||||||
|
Config.replaceVariable("augain", gain)
|
||||||
|
Api.cmd_exec("augain $gain")
|
||||||
|
}
|
||||||
|
save = true
|
||||||
}
|
}
|
||||||
save = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speakerPhone.isChecked != BaresipService.speakerPhone) {
|
if (speakerPhone.isChecked != BaresipService.speakerPhone) {
|
||||||
@@ -294,24 +301,28 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aec.isChecked != oldAec) {
|
if (!BaresipService.aec) {
|
||||||
if (aec.isChecked) {
|
if (aec.isChecked != oldAec) {
|
||||||
Config.addVariable("module", "webrtc_aecm.so")
|
if (aec.isChecked) {
|
||||||
if (gain != "1.0") {
|
Config.addVariable("module", "webrtc_aecm.so")
|
||||||
restart = true
|
if (gain != "1.0") {
|
||||||
} else {
|
restart = true
|
||||||
if (Api.module_load("webrtc_aecm.so") != 0) {
|
} else {
|
||||||
Utils.alertView(this, getString(R.string.error),
|
if (Api.module_load("webrtc_aecm.so") != 0) {
|
||||||
getString(R.string.failed_to_load_module))
|
Utils.alertView(
|
||||||
aec.isChecked = false
|
this, getString(R.string.error),
|
||||||
return false
|
getString(R.string.failed_to_load_module)
|
||||||
|
)
|
||||||
|
aec.isChecked = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Api.module_unload("webrtc_aecm.so")
|
||||||
|
Config.removeVariableValue("module", "webrtc_aecm.so")
|
||||||
}
|
}
|
||||||
} else {
|
save = true
|
||||||
Api.module_unload("webrtc_aecm.so")
|
|
||||||
Config.removeVariableValue("module", "webrtc_aecm.so")
|
|
||||||
}
|
}
|
||||||
save = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val audioDelay = audioDelay.text.toString().trim()
|
val audioDelay = audioDelay.text.toString().trim()
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ object Config {
|
|||||||
if (!File(configPath).exists()) {
|
if (!File(configPath).exists()) {
|
||||||
for (module in AudioActivity.audioModules)
|
for (module in AudioActivity.audioModules)
|
||||||
config = "${config}module ${module}.so\n"
|
config = "${config}module ${module}.so\n"
|
||||||
config = "${config}module webrtc_aecm.so\n"
|
if (!BaresipService.aec)
|
||||||
|
config = "${config}module webrtc_aecm.so\n"
|
||||||
previousConfig = config
|
previousConfig = config
|
||||||
} else {
|
} else {
|
||||||
previousConfig = String(Utils.getFileContents(configPath)!!, StandardCharsets.ISO_8859_1)
|
previousConfig = String(Utils.getFileContents(configPath)!!, StandardCharsets.ISO_8859_1)
|
||||||
|
|||||||
Reference in New Issue
Block a user