Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b154120

Browse files
committed
It helps to use the right function
1 parent 60326e3 commit b154120

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/voice/VoiceRecorder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import encoderPath from 'opus-recorder/dist/encoderWorker.min.js';
1919
import {MatrixClient} from "matrix-js-sdk/src/client";
2020
import CallMediaHandler from "../CallMediaHandler";
2121
import {SimpleObservable} from "matrix-widget-api";
22-
import {percentageOf} from "../utils/numbers";
22+
import {clamp} from "../utils/numbers";
2323

2424
const CHANNELS = 1; // stereo isn't important
2525
const SAMPLE_RATE = 48000; // 48khz is what WebRTC uses. 12khz is where we lose quality.
@@ -143,7 +143,7 @@ export class VoiceRecorder {
143143
// We're clamping the values so we can do that math operation mentioned above,
144144
// and to ensure that we produce consistent data (it's possible for the array
145145
// to exceed the specified range with some audio input devices).
146-
translatedData.push(percentageOf(data[i], 0, 1));
146+
translatedData.push(clamp(data[i], 0, 1));
147147
}
148148

149149
this.observable.update({

0 commit comments

Comments
 (0)