Fix lamejs import for MP3 encoding
Use static import instead of dynamic import to fix MPEGMode undefined error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -538,6 +538,7 @@
|
|||||||
import { SoundfontMIDIPlayer } from './src/synthesis/SoundfontMIDIPlayer.ts';
|
import { SoundfontMIDIPlayer } from './src/synthesis/SoundfontMIDIPlayer.ts';
|
||||||
import { MotifEngine } from './src/core/MotifEngine.ts';
|
import { MotifEngine } from './src/core/MotifEngine.ts';
|
||||||
import { unlockAudio } from './src/utils/audioUnlock.ts';
|
import { unlockAudio } from './src/utils/audioUnlock.ts';
|
||||||
|
import lamejs from 'lamejs';
|
||||||
|
|
||||||
const NUM_BARS = 40;
|
const NUM_BARS = 40;
|
||||||
const midiService = new MIDIService();
|
const midiService = new MIDIService();
|
||||||
@@ -798,9 +799,8 @@
|
|||||||
|
|
||||||
shareHint.textContent = 'Encoding MP3…';
|
shareHint.textContent = 'Encoding MP3…';
|
||||||
|
|
||||||
// Lazy-load MP3 encoder
|
// Use statically imported lamejs
|
||||||
const lameMod = await import('lamejs');
|
const Mp3Encoder = lamejs.Mp3Encoder;
|
||||||
const Mp3Encoder = lameMod.Mp3Encoder || (lameMod.default && lameMod.default.Mp3Encoder);
|
|
||||||
if (!Mp3Encoder) throw new Error('MP3 encoder not available');
|
if (!Mp3Encoder) throw new Error('MP3 encoder not available');
|
||||||
|
|
||||||
const channels = audioBuffer.numberOfChannels;
|
const channels = audioBuffer.numberOfChannels;
|
||||||
|
|||||||
Reference in New Issue
Block a user