private void BuildAudioDeviceList()
 {
     audioDevices.Clear();
     audioDeviceOptions.Clear();
     RuntimeManager.LowlevelSystem.getNumDrivers(out int numdrivers);
     for (int i = 0; i < numdrivers; i++)
     {
         KFMOD.AudioDevice item = default(KFMOD.AudioDevice);
         RuntimeManager.LowlevelSystem.getDriverInfo(i, out string name, 64, out item.guid, out item.systemRate, out item.speakerMode, out item.speakerModeChannels);
         item.name    = name;
         item.fmod_id = i;
         audioDevices.Add(item);
         audioDeviceOptions.Add(new Dropdown.OptionData(item.name));
     }
 }
    private void OnAudioDeviceChanged(int idx)
    {
        RuntimeManager.LowlevelSystem.setDriver(idx);
        int num = 0;

        while (true)
        {
            if (num >= audioDevices.Count)
            {
                return;
            }
            KFMOD.AudioDevice audioDevice = audioDevices[num];
            if (idx == audioDevice.fmod_id)
            {
                break;
            }
            num++;
        }
        KFMOD.currentDevice = audioDevices[num];
        KPlayerPrefs.SetString("AudioDeviceGuid", KFMOD.currentDevice.guid.ToString());
    }