Fixed audio device settings
This commit is contained in:
parent
4ec271a85a
commit
3f2fb12b38
1 changed files with 15 additions and 6 deletions
|
@ -28,6 +28,7 @@ import org.linphone.core.AudioDevice
|
||||||
import org.linphone.core.Core
|
import org.linphone.core.Core
|
||||||
import org.linphone.core.CoreListenerStub
|
import org.linphone.core.CoreListenerStub
|
||||||
import org.linphone.core.EcCalibratorStatus
|
import org.linphone.core.EcCalibratorStatus
|
||||||
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.PermissionHelper
|
import org.linphone.utils.PermissionHelper
|
||||||
|
|
||||||
|
@ -207,33 +208,41 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
|
||||||
private fun initInputAudioDevicesList() {
|
private fun initInputAudioDevicesList() {
|
||||||
val labels = arrayListOf<String>()
|
val labels = arrayListOf<String>()
|
||||||
val values = arrayListOf<AudioDevice>()
|
val values = arrayListOf<AudioDevice>()
|
||||||
|
var index = 0
|
||||||
|
val default = core.defaultInputAudioDevice
|
||||||
|
|
||||||
for (audioDevice in core.extendedAudioDevices) {
|
for (audioDevice in core.extendedAudioDevices) {
|
||||||
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityRecord)) {
|
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityRecord)) {
|
||||||
labels.add(audioDevice.id)
|
labels.add(audioDevice.id)
|
||||||
values.add(audioDevice)
|
values.add(audioDevice)
|
||||||
|
if (audioDevice.id == default.id) {
|
||||||
|
inputAudioDeviceIndex.value = index
|
||||||
|
}
|
||||||
|
index += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inputAudioDeviceLabels.value = labels
|
inputAudioDeviceLabels.value = labels
|
||||||
inputAudioDeviceValues.value = values
|
inputAudioDeviceValues.value = values
|
||||||
|
|
||||||
val default = core.defaultInputAudioDevice
|
|
||||||
inputAudioDeviceIndex.value = values.indexOf(default)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initOutputAudioDevicesList() {
|
private fun initOutputAudioDevicesList() {
|
||||||
val labels = arrayListOf<String>()
|
val labels = arrayListOf<String>()
|
||||||
val values = arrayListOf<AudioDevice>()
|
val values = arrayListOf<AudioDevice>()
|
||||||
|
var index = 0
|
||||||
|
val default = core.defaultOutputAudioDevice
|
||||||
|
|
||||||
for (audioDevice in core.extendedAudioDevices) {
|
for (audioDevice in core.extendedAudioDevices) {
|
||||||
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
||||||
labels.add(audioDevice.id)
|
labels.add(audioDevice.id)
|
||||||
values.add(audioDevice)
|
values.add(audioDevice)
|
||||||
|
if (audioDevice.id == default.id) {
|
||||||
|
outputAudioDeviceIndex.value = index
|
||||||
|
}
|
||||||
|
index += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outputAudioDeviceLabels.value = labels
|
outputAudioDeviceLabels.value = labels
|
||||||
outputAudioDeviceValues.value = values
|
outputAudioDeviceValues.value = values
|
||||||
|
|
||||||
val default = core.defaultOutputAudioDevice
|
|
||||||
outputAudioDeviceIndex.value = values.indexOf(default)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initCodecBitrateList() {
|
private fun initCodecBitrateList() {
|
||||||
|
|
Loading…
Reference in a new issue