switch Audio
Switches the audio input device based on user preference.
This function updates the user's default audio input device and the previous audio input device. It also calls the switchUserAudio function to perform the actual audio device switching. If the audioPreference is the same as the default audio ID, no switching is performed.
Parameters:
options (
SwitchAudioOptions): Contains theaudioPreferenceandparametersrequired for switching audio.
Example:
val switchAudioOptions = SwitchAudioOptions(
audioPreference = "newAudioDeviceID",
parameters = object : SwitchAudioParameters {
override val defAudioID: String = "defaultAudioDeviceID"
override val userDefaultAudioInputDevice: String = "currentAudioDeviceID"
override val prevAudioInputDevice: String = "previousAudioDeviceID"
override val updateUserDefaultAudioInputDevice: (String) -> Unit = { deviceId -> setUserDefaultAudio(deviceId) }
override val updatePrevAudioInputDevice: (String) -> Unit = { deviceId -> setPrevAudioDevice(deviceId) }
override val switchUserAudio: SwitchUserAudioType = switchUserAudioFunction
// Other properties...
}
)
switchAudio(switchAudioOptions)Content copied to clipboard