27
27
*/
28
28
29
29
/* eslint-disable no-console */
30
- /* eslint-disable import/prefer-default-export */
31
30
/* eslint-disable no-restricted-syntax */
32
31
/* eslint-disable max-len */
33
32
/* eslint-disable guard-for-in */
@@ -74,7 +73,6 @@ const AUDIO_PROCESSOR_TYPES = {
74
73
AUDIO_WORKLET : 'audio_worklet' ,
75
74
} ;
76
75
77
-
78
76
/**
79
77
* TIMESTAMP IMPLEMENTATION DOCUMENTATION:
80
78
*
@@ -188,7 +186,7 @@ class ScriptProcessorAudioProcessor extends AudioProcessor {
188
186
if ( ! this . isProcessing ) return ;
189
187
190
188
// Get input data from the left channel
191
- const inputBuffer = audioProcessingEvent . inputBuffer ;
189
+ const { inputBuffer } = audioProcessingEvent ;
192
190
const inputData = inputBuffer . getChannelData ( 0 ) ;
193
191
194
192
// Convert float32 audio data to int16 range
@@ -288,7 +286,7 @@ class AudioWorkletAudioProcessor extends AudioProcessor {
288
286
} catch ( pathError ) {
289
287
// Collect detailed diagnostic information
290
288
const diagnostic = {
291
- path : path ,
289
+ path,
292
290
error : pathError . message ,
293
291
errorName : pathError . name ,
294
292
errorType : this . diagnoseAudioWorkletError ( pathError , path ) ,
@@ -604,7 +602,7 @@ export class AudioManager {
604
602
processorType = AudioProcessorFactory . getBestProcessorType ( ) ;
605
603
console . log ( `🎵 Auto-selected audio processor: ${ processorType } ` ) ;
606
604
console . log (
607
- ` 🎵 (Will automatically fallback to ScriptProcessor if AudioWorklet fails to load)` ,
605
+ ' 🎵 (Will automatically fallback to ScriptProcessor if AudioWorklet fails to load)' ,
608
606
) ;
609
607
}
610
608
@@ -674,11 +672,10 @@ export class AudioManager {
674
672
if ( this . isAudioWorkletSupported ( ) ) {
675
673
this . setProcessorType ( AUDIO_PROCESSOR_TYPES . AUDIO_WORKLET ) ;
676
674
return true ;
677
- } else {
678
- console . warn ( '🎵 AudioWorklet not supported, using ScriptProcessor' ) ;
679
- this . setProcessorType ( AUDIO_PROCESSOR_TYPES . SCRIPT_PROCESSOR ) ;
680
- return false ;
681
675
}
676
+ console . warn ( '🎵 AudioWorklet not supported, using ScriptProcessor' ) ;
677
+ this . setProcessorType ( AUDIO_PROCESSOR_TYPES . SCRIPT_PROCESSOR ) ;
678
+ return false ;
682
679
}
683
680
684
681
/**
@@ -1027,7 +1024,7 @@ export class AudioManager {
1027
1024
* @param {File } file - The selected audio file
1028
1025
*/
1029
1026
updateButtonText ( button , file ) {
1030
- button . textContent = file . name . length > 20 ? `${ file . name . substring ( 0 , 17 ) } ...` : file . name ;
1027
+ button . textContent = file . name . length > 20 ? `${ file . name . substring ( 0 , 17 ) } ...` : file . name ;
1031
1028
}
1032
1029
1033
1030
/**
@@ -1264,7 +1261,7 @@ window.useBestAudioProcessor = function () {
1264
1261
*/
1265
1262
window . forceAudioWorklet = function ( ) {
1266
1263
audioManager . setProcessorType ( AUDIO_PROCESSOR_TYPES . AUDIO_WORKLET ) ;
1267
- console . log ( ` 🎵 Forced AudioWorklet mode (with automatic ScriptProcessor fallback)` ) ;
1264
+ console . log ( ' 🎵 Forced AudioWorklet mode (with automatic ScriptProcessor fallback)' ) ;
1268
1265
return audioManager . getProcessorType ( ) ;
1269
1266
} ;
1270
1267
@@ -1274,7 +1271,7 @@ window.forceAudioWorklet = function () {
1274
1271
*/
1275
1272
window . forceScriptProcessor = function ( ) {
1276
1273
audioManager . setProcessorType ( AUDIO_PROCESSOR_TYPES . SCRIPT_PROCESSOR ) ;
1277
- console . log ( ` 🎵 Forced ScriptProcessor mode` ) ;
1274
+ console . log ( ' 🎵 Forced ScriptProcessor mode' ) ;
1278
1275
return audioManager . getProcessorType ( ) ;
1279
1276
} ;
1280
1277
@@ -1330,7 +1327,7 @@ window.testAudioWorkletPath = async function (customPath = null) {
1330
1327
continue ;
1331
1328
}
1332
1329
1333
- console . log ( ` 🎵 ✅ File exists and is accessible` ) ;
1330
+ console . log ( ' 🎵 ✅ File exists and is accessible' ) ;
1334
1331
} catch ( fetchError ) {
1335
1332
console . log ( `🎵 ❌ Fetch error: ${ fetchError . message } ` ) ;
1336
1333
continue ;
@@ -1339,7 +1336,7 @@ window.testAudioWorkletPath = async function (customPath = null) {
1339
1336
// Now try loading as AudioWorklet module
1340
1337
// deno-lint-ignore no-await-in-loop
1341
1338
await testContext . audioWorklet . addModule ( path ) ;
1342
- console . log ( ` 🎵 🎵 ✅ AudioWorklet module loaded successfully!` ) ;
1339
+ console . log ( ' 🎵 🎵 ✅ AudioWorklet module loaded successfully!' ) ;
1343
1340
1344
1341
testContext . close ( ) ;
1345
1342
return true ;
@@ -1364,8 +1361,8 @@ window.getAudioWorkletEnvironmentInfo = function () {
1364
1361
host : window . location . host ,
1365
1362
pathname : window . location . pathname ,
1366
1363
isSecureContext : self . isSecureContext ,
1367
- audioWorkletSupported : 'audioWorklet' in
1368
- ( window . AudioContext || window . webkitAudioContext ) . prototype ,
1364
+ audioWorkletSupported : 'audioWorklet'
1365
+ in ( window . AudioContext || window . webkitAudioContext ) . prototype ,
1369
1366
userAgent : navigator . userAgent ,
1370
1367
} ;
1371
1368
@@ -1409,11 +1406,13 @@ window.getAudioBufferStats = function () {
1409
1406
totalSamples : acc . totalSamples + stat . totalSamples ,
1410
1407
totalMemoryKB : acc . totalMemoryKB + stat . memoryEstimateKB ,
1411
1408
activeStreams : acc . activeStreams + 1 ,
1412
- } ) , { totalBufferCount : 0 , totalSamples : 0 , totalMemoryKB : 0 , activeStreams : 0 } ) ;
1409
+ } ) , {
1410
+ totalBufferCount : 0 , totalSamples : 0 , totalMemoryKB : 0 , activeStreams : 0 ,
1411
+ } ) ;
1413
1412
1414
1413
return {
1415
1414
individual : stats ,
1416
- totals : totals ,
1415
+ totals,
1417
1416
limit : {
1418
1417
maxBuffers : MAX_AUDIO_BUFFER_LIMIT ,
1419
1418
description :
@@ -1454,7 +1453,7 @@ class AudioBufferStorage {
1454
1453
// Add new buffer
1455
1454
this . buffers . push ( {
1456
1455
samples : Array . from ( sampleBuffer ) , // Convert to regular array for JSON serialization
1457
- timestamp : timestamp ,
1456
+ timestamp,
1458
1457
} ) ;
1459
1458
this . totalSamples += sampleBuffer . length ;
1460
1459
}
0 commit comments