2021-09-29 18:30:42 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { makeEnumParser } from '../util/enum';
|
2021-11-04 21:50:34 +00:00
|
|
|
import { isEnabled } from '../RemoteConfig';
|
|
|
|
import { isAlpha, isBeta } from '../util/version';
|
|
|
|
import * as OS from '../OS';
|
2021-09-29 18:30:42 +00:00
|
|
|
|
|
|
|
export enum AudioDeviceModule {
|
|
|
|
Default = 'Default',
|
|
|
|
WindowsAdm2 = 'WindowsAdm2',
|
|
|
|
}
|
|
|
|
|
|
|
|
export const parseAudioDeviceModule = makeEnumParser(
|
|
|
|
AudioDeviceModule,
|
|
|
|
AudioDeviceModule.Default
|
|
|
|
);
|
2021-11-04 21:50:34 +00:00
|
|
|
|
|
|
|
export function getAudioDeviceModule(): AudioDeviceModule {
|
|
|
|
if (!OS.isWindows()) {
|
|
|
|
return AudioDeviceModule.Default;
|
|
|
|
}
|
|
|
|
|
|
|
|
const appVersion = window.getVersion();
|
|
|
|
if (
|
|
|
|
isEnabled('desktop.calling.useWindowsAdm2') ||
|
|
|
|
isBeta(appVersion) ||
|
|
|
|
isAlpha(appVersion)
|
|
|
|
) {
|
|
|
|
return AudioDeviceModule.WindowsAdm2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return AudioDeviceModule.Default;
|
|
|
|
}
|