From ae2d7a12ad3cbdfa7b8a0c2fa3f9f42cc471b44d Mon Sep 17 00:00:00 2001 From: or-else Date: Wed, 23 Mar 2022 16:10:47 -0700 Subject: [PATCH] rename calcPreviewBars -> resampleBars --- src/widgets/audio-player.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/widgets/audio-player.jsx b/src/widgets/audio-player.jsx index 317bdbdc..3e03dd57 100644 --- a/src/widgets/audio-player.jsx +++ b/src/widgets/audio-player.jsx @@ -39,7 +39,7 @@ export default class AudioPlayer extends React.PureComponent { this.initAudio = this.initAudio.bind(this); this.initCanvas = this.initCanvas.bind(this); - this.calcPreviewBars = this.calcPreviewBars.bind(this); + this.resampleBars = this.resampleBars.bind(this); this.visualize = this.visualize.bind(this); this.handlePlay = this.handlePlay.bind(this); @@ -106,7 +106,7 @@ export default class AudioPlayer extends React.PureComponent { this.canvasContext = this.canvasRef.current.getContext('2d'); this.canvasContext.lineCap = 'round'; - this.viewBuffer = this.calcPreviewBars(this.state.preview); + this.viewBuffer = this.resampleBars(this.state.preview); this.visualize(); } @@ -172,7 +172,7 @@ export default class AudioPlayer extends React.PureComponent { } // Quick and dirty downsampling of the original preview bars into a smaller (or equal) number of bars we can display here. - calcPreviewBars(original) { + resampleBars(original) { const barCount = Math.min(original.length, ((this.canvasRef.current.width - SPACING) / (LINE_WIDTH + SPACING)) | 0); const factor = original.length / barCount; let amps = [];