29 lines
1006 B
TypeScript
29 lines
1006 B
TypeScript
import {AudioRecorderBacked, DeviceList, InputDevice, setRecorderBackend} from "tc-shared/audio/Recorder";
|
|
import {AbstractInput, LevelMeter} from "tc-shared/voice/RecorderBase";
|
|
import {inputDeviceList} from "../audio/InputDeviceList";
|
|
import {NativeInput, NativeLevelMeter} from "../audio/AudioRecorder";
|
|
|
|
setRecorderBackend(new class implements AudioRecorderBacked {
|
|
createInput(): AbstractInput {
|
|
return new NativeInput();
|
|
}
|
|
|
|
async createLevelMeter(device: InputDevice): Promise<LevelMeter> {
|
|
const meter = new NativeLevelMeter(device);
|
|
await meter.initialize();
|
|
return meter;
|
|
}
|
|
|
|
getDeviceList(): DeviceList {
|
|
return inputDeviceList;
|
|
}
|
|
|
|
isRnNoiseSupported(): boolean {
|
|
return true;
|
|
}
|
|
|
|
toggleRnNoise(target: boolean) {
|
|
NativeLevelMeter.instances.forEach(input => input.nativeConsumer.toggle_rnnoise(target));
|
|
NativeInput.instances.forEach(input => input.nativeConsumer.toggle_rnnoise(target));
|
|
}
|
|
}); |