signal-desktop/ts/calling/audioDeviceModule.ts

35 lines
821 B
TypeScript
Raw Normal View History

// 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';
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;
}