File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ export class AudioChannelMixer extends AbstractAudioModule {
198198 const canvas = els . volumeMeter ;
199199 const ctx = els . volumeMeterCtx ;
200200
201- const width = canvas . clientWidth * window . devicePixelRatio ;
201+ const width = canvas . clientWidth * window . devicePixelRatio * 2 ;
202202 const height = canvas . clientHeight * window . devicePixelRatio ;
203203 if ( width === 0 || height === 0 ) return ;
204204
@@ -216,7 +216,7 @@ export class AudioChannelMixer extends AbstractAudioModule {
216216 const minDb = outputMeter . minDecibels ;
217217 const maxDb = outputMeter . maxDecibels ;
218218 const now = Date . now ( ) ;
219- const channelWidth = width / data . length ;
219+ const channelWidthDivided = ( width + 1 ) / data . length ;
220220
221221 data . forEach ( ( channelData , i ) => {
222222 const cache = this . outputMeterCache [ i ] ;
@@ -237,7 +237,9 @@ export class AudioChannelMixer extends AbstractAudioModule {
237237 cache . peakTime = now ;
238238 }
239239
240- const xStart = i * channelWidth ;
240+ const xStart = Math . round ( i * channelWidthDivided ) ;
241+ const xEnd = Math . round ( ( i + 1 ) * channelWidthDivided ) ;
242+ const channelWidth = xEnd - xStart - ( i === data . length - 1 ? 0 : 1 ) ; // 1px gap except last channel
241243 for ( let i = 0 ; i < rectCount ; i ++ ) {
242244 const y = height - ( i + 1 ) * rectHeight ;
243245
You can’t perform that action at this time.
0 commit comments