From b15412056e834e200f799f2d7edc2436b04cdb97 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 30 Mar 2021 12:08:11 -0600 Subject: [PATCH] It helps to use the right function --- src/voice/VoiceRecorder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/voice/VoiceRecorder.ts b/src/voice/VoiceRecorder.ts index 0d890160c3..077990ac17 100644 --- a/src/voice/VoiceRecorder.ts +++ b/src/voice/VoiceRecorder.ts @@ -19,7 +19,7 @@ import encoderPath from 'opus-recorder/dist/encoderWorker.min.js'; import {MatrixClient} from "matrix-js-sdk/src/client"; import CallMediaHandler from "../CallMediaHandler"; import {SimpleObservable} from "matrix-widget-api"; -import {percentageOf} from "../utils/numbers"; +import {clamp} from "../utils/numbers"; const CHANNELS = 1; // stereo isn't important const SAMPLE_RATE = 48000; // 48khz is what WebRTC uses. 12khz is where we lose quality. @@ -143,7 +143,7 @@ export class VoiceRecorder { // We're clamping the values so we can do that math operation mentioned above, // and to ensure that we produce consistent data (it's possible for the array // to exceed the specified range with some audio input devices). - translatedData.push(percentageOf(data[i], 0, 1)); + translatedData.push(clamp(data[i], 0, 1)); } this.observable.update({