loukai-app 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +558 -0
- package/bin/loukai.js +32 -0
- package/package.json +243 -0
- package/src/main/appState.js +250 -0
- package/src/main/audioEngine.js +478 -0
- package/src/main/creator/conversionService.js +503 -0
- package/src/main/creator/downloadManager.js +1128 -0
- package/src/main/creator/ffmpegService.js +487 -0
- package/src/main/creator/installLogger.js +51 -0
- package/src/main/creator/keyDetection.js +212 -0
- package/src/main/creator/llmService.js +370 -0
- package/src/main/creator/lrclibService.js +340 -0
- package/src/main/creator/python/crepe_runner.py +189 -0
- package/src/main/creator/python/demucs_runner.py +158 -0
- package/src/main/creator/python/whisper_runner.py +172 -0
- package/src/main/creator/pythonRunner.js +268 -0
- package/src/main/creator/stemBuilder.js +491 -0
- package/src/main/creator/systemChecker.js +474 -0
- package/src/main/handlers/appHandlers.js +45 -0
- package/src/main/handlers/audioHandlers.js +33 -0
- package/src/main/handlers/autotuneHandlers.js +28 -0
- package/src/main/handlers/canvasHandlers.js +84 -0
- package/src/main/handlers/creatorHandlers.js +159 -0
- package/src/main/handlers/editorHandlers.js +98 -0
- package/src/main/handlers/effectsHandlers.js +100 -0
- package/src/main/handlers/fileHandlers.js +45 -0
- package/src/main/handlers/index.js +78 -0
- package/src/main/handlers/libraryHandlers.js +96 -0
- package/src/main/handlers/mixerHandlers.js +64 -0
- package/src/main/handlers/playerHandlers.js +39 -0
- package/src/main/handlers/preferencesHandlers.js +46 -0
- package/src/main/handlers/queueHandlers.js +81 -0
- package/src/main/handlers/rendererHandlers.js +63 -0
- package/src/main/handlers/settingsHandlers.js +42 -0
- package/src/main/handlers/webServerHandlers.js +105 -0
- package/src/main/main.js +2351 -0
- package/src/main/preload.js +252 -0
- package/src/main/settingsManager.js +139 -0
- package/src/main/statePersistence.js +193 -0
- package/src/main/utils/pathValidator.js +112 -0
- package/src/main/webServer.js +2535 -0
- package/src/native/autotune.js +417 -0
- package/src/renderer/adapters/ElectronBridge.js +677 -0
- package/src/renderer/canvas.html +80 -0
- package/src/renderer/components/App.jsx +303 -0
- package/src/renderer/components/AppRoot.jsx +37 -0
- package/src/renderer/components/AudioDeviceSettings.jsx +145 -0
- package/src/renderer/components/EffectsPanelWrapper.jsx +267 -0
- package/src/renderer/components/MixerTab.jsx +233 -0
- package/src/renderer/components/MixerTabWrapper.jsx +31 -0
- package/src/renderer/components/PortalSelect.jsx +239 -0
- package/src/renderer/components/QueueTab.jsx +116 -0
- package/src/renderer/components/RequestsListWrapper.jsx +78 -0
- package/src/renderer/components/ServerTab.jsx +472 -0
- package/src/renderer/components/SongInfoBarWrapper.jsx +77 -0
- package/src/renderer/components/StatusBar.jsx +92 -0
- package/src/renderer/components/TabNavigation.jsx +77 -0
- package/src/renderer/components/TransportControlsWrapper.jsx +69 -0
- package/src/renderer/components/creator/CreateTab.jsx +1236 -0
- package/src/renderer/dist/assets/kaiPlayer-CoMx__a_.js +2 -0
- package/src/renderer/dist/assets/kaiPlayer-CoMx__a_.js.map +1 -0
- package/src/renderer/dist/assets/microphoneEngine-BaCUhhQc.js +2 -0
- package/src/renderer/dist/assets/microphoneEngine-BaCUhhQc.js.map +1 -0
- package/src/renderer/dist/assets/player-DVrqp7N5.js +3 -0
- package/src/renderer/dist/assets/player-DVrqp7N5.js.map +1 -0
- package/src/renderer/dist/assets/songLoaders-BaTgGib4.js +2 -0
- package/src/renderer/dist/assets/songLoaders-BaTgGib4.js.map +1 -0
- package/src/renderer/dist/assets/webrtcManager-BhCHWceK.js +2 -0
- package/src/renderer/dist/assets/webrtcManager-BhCHWceK.js.map +1 -0
- package/src/renderer/dist/js/autoTuneWorklet.js +224 -0
- package/src/renderer/dist/js/micPitchDetectorWorklet.js +137 -0
- package/src/renderer/dist/js/musicAnalysisWorklet.js +216 -0
- package/src/renderer/dist/js/phaseVocoderWorklet.js +341 -0
- package/src/renderer/dist/js/soundtouch-worklet.js +1395 -0
- package/src/renderer/dist/renderer.css +1 -0
- package/src/renderer/dist/renderer.js +62 -0
- package/src/renderer/dist/renderer.js.map +1 -0
- package/src/renderer/dist/renderer.woff2 +0 -0
- package/src/renderer/hooks/useKeyboardShortcuts.js +154 -0
- package/src/renderer/index.html +24 -0
- package/src/renderer/index.html.backup +372 -0
- package/src/renderer/js/PlayerInterface.js +267 -0
- package/src/renderer/js/autoTuneWorklet.js +224 -0
- package/src/renderer/js/butterchurnVerify.js +46 -0
- package/src/renderer/js/canvas-app.js +114 -0
- package/src/renderer/js/cdgPlayer.js +685 -0
- package/src/renderer/js/kaiPlayer.js +1200 -0
- package/src/renderer/js/karaokeRenderer.js +3392 -0
- package/src/renderer/js/micPitchDetectorWorklet.js +137 -0
- package/src/renderer/js/microphoneEngine.js +656 -0
- package/src/renderer/js/musicAnalysisWorklet.js +216 -0
- package/src/renderer/js/phaseVocoderWorklet.js +341 -0
- package/src/renderer/js/player.js +232 -0
- package/src/renderer/js/referencePitchTracker.js +130 -0
- package/src/renderer/js/songLoaders.js +334 -0
- package/src/renderer/js/soundtouch-worklet.js +1395 -0
- package/src/renderer/js/webrtcManager.js +511 -0
- package/src/renderer/lib/butterchurn.min.js +6739 -0
- package/src/renderer/lib/butterchurnPresets.min.js +1 -0
- package/src/renderer/lib/cdgraphics-wrapper.js +16 -0
- package/src/renderer/lib/cdgraphics.js +299 -0
- package/src/renderer/public/js/autoTuneWorklet.js +224 -0
- package/src/renderer/public/js/micPitchDetectorWorklet.js +137 -0
- package/src/renderer/public/js/musicAnalysisWorklet.js +216 -0
- package/src/renderer/public/js/phaseVocoderWorklet.js +341 -0
- package/src/renderer/public/js/soundtouch-worklet.js +1395 -0
- package/src/renderer/react-entry.jsx +44 -0
- package/src/renderer/styles/tailwind.css +106 -0
- package/src/renderer/utils/qrCodeGenerator.js +98 -0
- package/src/renderer/vite.config.js +31 -0
- package/src/shared/adapters/BridgeInterface.js +195 -0
- package/src/shared/components/EffectsPanel.jsx +177 -0
- package/src/shared/components/LibraryPanel.jsx +701 -0
- package/src/shared/components/LineDetailCanvas.jsx +167 -0
- package/src/shared/components/LyricLine.jsx +505 -0
- package/src/shared/components/LyricRejection.jsx +84 -0
- package/src/shared/components/LyricSuggestion.jsx +80 -0
- package/src/shared/components/LyricsEditorCanvas.jsx +271 -0
- package/src/shared/components/MixerPanel.jsx +94 -0
- package/src/shared/components/PlayerControls.jsx +206 -0
- package/src/shared/components/PortalSelect.jsx +239 -0
- package/src/shared/components/QueueList.jsx +365 -0
- package/src/shared/components/QuickSearch.jsx +126 -0
- package/src/shared/components/RequestsList.jsx +121 -0
- package/src/shared/components/SongEditor.jsx +1362 -0
- package/src/shared/components/SongInfoBar.jsx +81 -0
- package/src/shared/components/ThemeToggle.jsx +106 -0
- package/src/shared/components/Toast.jsx +30 -0
- package/src/shared/components/VisualizationSettings.jsx +243 -0
- package/src/shared/constants.js +95 -0
- package/src/shared/context/BridgeContext.jsx +32 -0
- package/src/shared/contexts/AudioContext.jsx +37 -0
- package/src/shared/contexts/PlayerContext.jsx +66 -0
- package/src/shared/contexts/SettingsContext.jsx +50 -0
- package/src/shared/defaults.js +158 -0
- package/src/shared/formatUtils.js +59 -0
- package/src/shared/formatUtils.test.js +207 -0
- package/src/shared/hooks/useAppState.js +97 -0
- package/src/shared/hooks/useAudioEngine.js +264 -0
- package/src/shared/hooks/usePlayer.js +89 -0
- package/src/shared/hooks/useSettingsPersistence.js +74 -0
- package/src/shared/hooks/useWebRTC.js +118 -0
- package/src/shared/ipcContracts.js +299 -0
- package/src/shared/package.json +3 -0
- package/src/shared/services/creatorService.js +373 -0
- package/src/shared/services/creatorService.test.js +413 -0
- package/src/shared/services/editorService.js +213 -0
- package/src/shared/services/editorService.test.js +219 -0
- package/src/shared/services/effectsService.js +271 -0
- package/src/shared/services/effectsService.test.js +418 -0
- package/src/shared/services/libraryService.js +438 -0
- package/src/shared/services/libraryService.test.js +474 -0
- package/src/shared/services/mixerService.js +172 -0
- package/src/shared/services/mixerService.test.js +399 -0
- package/src/shared/services/playerService.js +221 -0
- package/src/shared/services/playerService.test.js +357 -0
- package/src/shared/services/preferencesService.js +219 -0
- package/src/shared/services/queueService.js +226 -0
- package/src/shared/services/queueService.test.js +430 -0
- package/src/shared/services/requestsService.js +155 -0
- package/src/shared/services/requestsService.test.js +362 -0
- package/src/shared/services/serverSettingsService.js +151 -0
- package/src/shared/services/settingsService.js +257 -0
- package/src/shared/services/settingsService.test.js +295 -0
- package/src/shared/state/StateManager.js +263 -0
- package/src/shared/utils/audio.js +42 -0
- package/src/shared/utils/format.js +32 -0
- package/src/shared/utils/lyricsUtils.js +162 -0
- package/src/test/setup.js +40 -0
- package/src/utils/cdgLoader.js +180 -0
- package/src/utils/m4aLoader.js +333 -0
- package/src/web/App.jsx +578 -0
- package/src/web/adapters/WebBridge.js +428 -0
- package/src/web/components/PlayerSettingsPanel.jsx +231 -0
- package/src/web/components/SongSearch.jsx +180 -0
- package/src/web/dist/assets/index-0H-RnRrV.js +51 -0
- package/src/web/dist/assets/index-0H-RnRrV.js.map +1 -0
- package/src/web/dist/assets/index-DYW2zB0u.css +1 -0
- package/src/web/dist/index.html +15 -0
- package/src/web/index.html +14 -0
- package/src/web/main.jsx +10 -0
- package/src/web/package-lock.json +1765 -0
- package/src/web/pages/SongRequestPage.jsx +619 -0
- package/src/web/styles/tailwind.css +68 -0
- package/src/web/vite.config.js +27 -0
- package/static/fonts/material-icons.woff2 +0 -0
- package/static/images/butterchurn-screenshots/Aderrasi - Potion of Spirits.png +0 -0
- package/static/images/butterchurn-screenshots/Aderrasi - Songflower _Moss Posy_.png +0 -0
- package/static/images/butterchurn-screenshots/Aderrasi - Storm of the Eye _Thunder_ - mash0000 - quasi pseudo meta concentrics.png +0 -0
- package/static/images/butterchurn-screenshots/Aderrasi _ Geiss - Airhandler _Kali Mix_ - Canvas Mix.png +0 -0
- package/static/images/butterchurn-screenshots/An AdamFX n Martin Infusion 2 flexi - Why The Sky Looks Diffrent Today - AdamFx n Martin Infusion - Tack Tile Disfunction B.png +0 -0
- package/static/images/butterchurn-screenshots/Cope - The Neverending Explosion of Red Liquid Fire.png +0 -0
- proton lights __Krash_s beat code_ _Phat_remix02b.png +0 -0
- package/static/images/butterchurn-screenshots/Eo_S_ _ Phat - cubetrace - v2.png +0 -0
- package/static/images/butterchurn-screenshots/Eo_S_ _ Zylot - skylight _Stained Glass Majesty mix_.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - alien fish pond.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - area 51.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - infused with the spiral.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - mindblob _shiny mix_.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - mindblob mix.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - predator-prey-spirals.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - smashing fractals _acid etching mix_.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi - truly soft piece of software - this is generic texturing _Jelly_ .png +0 -0
- package/static/images/butterchurn-screenshots/Flexi _ Martin - astral projection.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi _ Martin - cascading decay swing.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi _ amandio c - piercing 05 - Kopie _2_ - Kopie.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi _ stahlregen - jelly showoff parade.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi_ fishbrain_ Geiss _ Martin - tokamak witchery.png +0 -0
- package/static/images/butterchurn-screenshots/Flexi_ martin _ geiss - dedicated to the sherwin maxawow.png +0 -0
- package/static/images/butterchurn-screenshots/Fumbling_Foo _ Flexi_ Martin_ Orb_ Unchained - Star Nova v7b.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss - Cauldron - painterly 2 _saturation remix_.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss - Reaction Diffusion 2.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss - Spiral Artifact.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss - Thumb Drum.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss _ Flexi _ Martin - disconnected.png +0 -0
- package/static/images/butterchurn-screenshots/Geiss_ Flexi _ Stahlregen - Thumbdrum Tokamak _crossfiring aftermath jelly mashup_.png +0 -0
- package/static/images/butterchurn-screenshots/Goody - The Wild Vort.png +0 -0
- package/static/images/butterchurn-screenshots/Idiot - Star Of Annon.png +0 -0
- package/static/images/butterchurn-screenshots/Krash _ Illusion - Spiral Movement.png +0 -0
- package/static/images/butterchurn-screenshots/Martin - QBikal - Surface Turbulence IIb.png +0 -0
- package/static/images/butterchurn-screenshots/Martin - acid wiring.png +0 -0
- package/static/images/butterchurn-screenshots/Martin - charisma.png +0 -0
- package/static/images/butterchurn-screenshots/Martin - liquid arrows.png +0 -0
- package/static/images/butterchurn-screenshots/Milk Artist At our Best - FED - SlowFast Ft AdamFX n Martin - HD CosmoFX.png +0 -0
- package/static/images/butterchurn-screenshots/ORB - Waaa.png +0 -0
- package/static/images/butterchurn-screenshots/Phat_fiShbRaiN_Eo_S_Mandala_Chasers_remix.png +0 -0
- package/static/images/butterchurn-screenshots/Rovastar - Oozing Resistance.png +0 -0
- package/static/images/butterchurn-screenshots/Rovastar _ Loadus _ Geiss - FractalDrop _Triple Mix_.png +0 -0
- package/static/images/butterchurn-screenshots/TonyMilkdrop - Leonardo Da Vinci_s Balloon _Flexi - merry-go-round _ techstyle_.png +0 -0
- package/static/images/butterchurn-screenshots/TonyMilkdrop - Magellan_s Nebula _Flexi - you enter first _ multiverse_.png +0 -0
- package/static/images/butterchurn-screenshots/Unchained - Rewop.png +0 -0
- package/static/images/butterchurn-screenshots/Unchained - Unified Drag 2.png +0 -0
- package/static/images/butterchurn-screenshots/Unchained _ Rovastar - Wormhole Pillars _Hall of Shadows mix_.png +0 -0
- package/static/images/butterchurn-screenshots/Zylot - Paint Spill _Music Reactive Paint Mix_.png +0 -0
- package/static/images/butterchurn-screenshots/Zylot - Star Ornament.png +0 -0
- package/static/images/butterchurn-screenshots/Zylot - True Visionary _Final Mix_.png +0 -0
- package/static/images/butterchurn-screenshots/_Aderrasi - Wanderer in Curved Space - mash0000 - faclempt kibitzing meshuggana schmaltz _Geiss color mix_.png +0 -0
- package/static/images/butterchurn-screenshots/_Geiss - Artifact 01.png +0 -0
- package/static/images/butterchurn-screenshots/_Geiss - Desert Rose 2.png +0 -0
- package/static/images/butterchurn-screenshots/_Geiss - untitled.png +0 -0
- package/static/images/butterchurn-screenshots/_Mig_049.png +0 -0
- package/static/images/butterchurn-screenshots/_Mig_085.png +0 -0
- package/static/images/butterchurn-screenshots/_Rovastar _ Geiss - Hurricane Nightmare _Posterize Mix_.png +0 -0
- package/static/images/butterchurn-screenshots/___ Royal - Mashup _197_.png +0 -0
- package/static/images/butterchurn-screenshots/___ Royal - Mashup _220_.png +0 -0
- package/static/images/butterchurn-screenshots/___ Royal - Mashup _431_.png +0 -0
- package/static/images/butterchurn-screenshots/cope _ martin - mother-of-pearl.png +0 -0
- package/static/images/butterchurn-screenshots/fiShbRaiN _ Flexi - witchcraft 2_0.png +0 -0
- package/static/images/butterchurn-screenshots/flexi - bouncing balls _double mindblob neon mix_.png +0 -0
- package/static/images/butterchurn-screenshots/flexi - mom_ why the sky looks different today.png +0 -0
- package/static/images/butterchurn-screenshots/flexi - patternton_ district of media_ capitol of the united abstractions of fractopia.png +0 -0
- package/static/images/butterchurn-screenshots/flexi - swing out on the spiral.png +0 -0
- package/static/images/butterchurn-screenshots/flexi - what is the matrix.png +0 -0
- package/static/images/butterchurn-screenshots/flexi _ amandio c - organic _random mashup_.png +0 -0
- package/static/images/butterchurn-screenshots/flexi _ amandio c - organic12-3d-2_milk.png +0 -0
- package/static/images/butterchurn-screenshots/flexi _ fishbrain - neon mindblob grafitti.png +0 -0
- package/static/images/butterchurn-screenshots/flexi _ geiss - pogo cubes vs_ tokamak vs_ game of life _stahls jelly 4_5 finish_.png +0 -0
- package/static/images/butterchurn-screenshots/high-altitude basket unraveling - singh grooves nitrogen argon nz_.png +0 -0
- package/static/images/butterchurn-screenshots/martin - The Bridge of Khazad-Dum.png +0 -0
- package/static/images/butterchurn-screenshots/martin - angel flight.png +0 -0
- package/static/images/butterchurn-screenshots/martin - another kind of groove.png +0 -0
- package/static/images/butterchurn-screenshots/martin - bombyx mori.png +0 -0
- package/static/images/butterchurn-screenshots/martin - castle in the air.png +0 -0
- package/static/images/butterchurn-screenshots/martin - chain breaker.png +0 -0
- package/static/images/butterchurn-screenshots/martin - disco mix 4.png +0 -0
- package/static/images/butterchurn-screenshots/martin - extreme heat.png +0 -0
- package/static/images/butterchurn-screenshots/martin - frosty caves 2.png +0 -0
- package/static/images/butterchurn-screenshots/martin - fruit machine.png +0 -0
- package/static/images/butterchurn-screenshots/martin - ghost city.png +0 -0
- package/static/images/butterchurn-screenshots/martin - glass corridor.png +0 -0
- package/static/images/butterchurn-screenshots/martin - infinity _2010 update_.png +0 -0
- package/static/images/butterchurn-screenshots/martin - mandelbox explorer - high speed demo version.png +0 -0
- package/static/images/butterchurn-screenshots/martin - mucus cervix.png +0 -0
- package/static/images/butterchurn-screenshots/martin - reflections on black tiles.png +0 -0
- package/static/images/butterchurn-screenshots/martin - stormy sea _2010 update_.png +0 -0
- package/static/images/butterchurn-screenshots/martin - witchcraft reloaded.png +0 -0
- package/static/images/butterchurn-screenshots/martin _ flexi - diamond cutter _prismaticvortex_com_ - camille - i wish i wish i wish i was constrained.png +0 -0
- package/static/images/butterchurn-screenshots/martin _shadow harlequins shape code_ - fata morgana.png +0 -0
- package/static/images/butterchurn-screenshots/martin_ flexi_ fishbrain _ sto - enterstate _random mashup_.png +0 -0
- package/static/images/butterchurn-screenshots/sawtooth grin roam.png +0 -0
- package/static/images/butterchurn-screenshots/shifter - dark tides bdrv mix 2.png +0 -0
- package/static/images/butterchurn-screenshots/suksma - Rovastar - Sunflower Passion _Enlightment Mix__Phat_edit _ flexi und martin shaders - circumflex in character classes in regular expression.png +0 -0
- package/static/images/butterchurn-screenshots/suksma - heretical crosscut playpen.png +0 -0
- package/static/images/butterchurn-screenshots/suksma - uninitialized variabowl _hydroponic chronic_.png +0 -0
- package/static/images/butterchurn-screenshots/suksma - vector exp 1 - couldn_t not.png +0 -0
- package/static/images/butterchurn-screenshots/yin - 191 - Temporal singularities.png +0 -0
- package/static/images/logo-512.png +0 -0
- package/static/images/logo.png +0 -0
- package/static/loukai-logo.png +0 -0
- package/static/screenshot-generator.html +610 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Checker - Validates system requirements for the Creator feature
|
|
3
|
+
*
|
|
4
|
+
* Checks for:
|
|
5
|
+
* - Python availability
|
|
6
|
+
* - PyTorch installation
|
|
7
|
+
* - Demucs (stem separation)
|
|
8
|
+
* - Whisper (transcription)
|
|
9
|
+
* - CREPE (pitch detection)
|
|
10
|
+
* - FFmpeg (audio processing)
|
|
11
|
+
* - Downloaded models
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync, statSync } from 'fs';
|
|
15
|
+
import { homedir, platform } from 'os';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
import { execSync, spawn } from 'child_process';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the data directory for loukai creator (Python, models, etc.)
|
|
21
|
+
* Uses the same base as Electron's userData for consistency
|
|
22
|
+
*/
|
|
23
|
+
export function getCacheDir() {
|
|
24
|
+
const plat = platform();
|
|
25
|
+
if (plat === 'darwin') {
|
|
26
|
+
return join(homedir(), 'Library', 'Application Support', 'loukai', 'creator');
|
|
27
|
+
} else if (plat === 'win32') {
|
|
28
|
+
return join(homedir(), 'AppData', 'Local', 'loukai', 'creator');
|
|
29
|
+
} else {
|
|
30
|
+
return join(homedir(), '.config', 'loukai', 'creator');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get the Python executable path
|
|
36
|
+
*/
|
|
37
|
+
export function getPythonPath() {
|
|
38
|
+
const cacheDir = getCacheDir();
|
|
39
|
+
const plat = platform();
|
|
40
|
+
|
|
41
|
+
if (plat === 'win32') {
|
|
42
|
+
return join(cacheDir, 'python', 'python.exe');
|
|
43
|
+
} else {
|
|
44
|
+
return join(cacheDir, 'python', 'bin', 'python3');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get environment variables for Python processes
|
|
50
|
+
* Includes cached FFmpeg in PATH so Python scripts can find it
|
|
51
|
+
*/
|
|
52
|
+
export function getPythonEnv() {
|
|
53
|
+
const cacheDir = getCacheDir();
|
|
54
|
+
const binDir = join(cacheDir, 'bin');
|
|
55
|
+
|
|
56
|
+
// Prepend our bin directory to PATH so cached ffmpeg/ffprobe are found
|
|
57
|
+
const pathSep = platform() === 'win32' ? ';' : ':';
|
|
58
|
+
const existingPath = process.env.PATH || process.env.Path || '';
|
|
59
|
+
const newPath = `${binDir}${pathSep}${existingPath}`;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
...process.env,
|
|
63
|
+
PATH: newPath,
|
|
64
|
+
Path: newPath, // Windows uses 'Path'
|
|
65
|
+
TORCH_HOME: join(cacheDir, 'models', 'torch'),
|
|
66
|
+
HF_HOME: join(cacheDir, 'models', 'huggingface'),
|
|
67
|
+
XDG_CACHE_HOME: cacheDir, // For whisper model cache
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Check if a system command is available
|
|
73
|
+
*/
|
|
74
|
+
function checkSystemCommand(command) {
|
|
75
|
+
try {
|
|
76
|
+
const plat = platform();
|
|
77
|
+
const checkCmd = plat === 'win32' ? `where ${command}` : `which ${command}`;
|
|
78
|
+
execSync(checkCmd, { stdio: 'ignore' });
|
|
79
|
+
return true;
|
|
80
|
+
} catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Check if Python is installed and get version
|
|
87
|
+
*/
|
|
88
|
+
export function checkPython() {
|
|
89
|
+
const pythonPath = getPythonPath();
|
|
90
|
+
|
|
91
|
+
if (!existsSync(pythonPath)) {
|
|
92
|
+
return { installed: false, reason: 'not_found' };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const output = execSync(`"${pythonPath}" --version`, {
|
|
97
|
+
encoding: 'utf8',
|
|
98
|
+
timeout: 10000,
|
|
99
|
+
});
|
|
100
|
+
const version = output.trim().replace('Python ', '');
|
|
101
|
+
return { installed: true, version, path: pythonPath };
|
|
102
|
+
} catch (e) {
|
|
103
|
+
return { installed: false, reason: 'not_executable', error: e.message };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Check if a Python package is installed by trying to import it
|
|
109
|
+
*/
|
|
110
|
+
function checkPythonPackage(packageName, versionAttr = '__version__') {
|
|
111
|
+
const pythonPath = getPythonPath();
|
|
112
|
+
|
|
113
|
+
if (!existsSync(pythonPath)) {
|
|
114
|
+
return { installed: false, reason: 'no_python' };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const script = `
|
|
118
|
+
import sys
|
|
119
|
+
try:
|
|
120
|
+
import ${packageName}
|
|
121
|
+
version = getattr(${packageName}, '${versionAttr}', 'unknown')
|
|
122
|
+
print(f"OK:{version}")
|
|
123
|
+
except ImportError as e:
|
|
124
|
+
print(f"ERROR:{e}")
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
return new Promise((resolve) => {
|
|
128
|
+
const proc = spawn(pythonPath, ['-c', script], {
|
|
129
|
+
env: getPythonEnv(),
|
|
130
|
+
timeout: 30000,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
let stdout = '';
|
|
134
|
+
let stderr = '';
|
|
135
|
+
|
|
136
|
+
proc.stdout.on('data', (data) => {
|
|
137
|
+
stdout += data.toString();
|
|
138
|
+
});
|
|
139
|
+
proc.stderr.on('data', (data) => {
|
|
140
|
+
stderr += data.toString();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
proc.on('close', (_code) => {
|
|
144
|
+
const output = stdout.trim();
|
|
145
|
+
if (output.startsWith('OK:')) {
|
|
146
|
+
const version = output.replace('OK:', '');
|
|
147
|
+
resolve({ installed: true, version });
|
|
148
|
+
} else {
|
|
149
|
+
resolve({ installed: false, reason: 'import_failed', error: output || stderr });
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
proc.on('error', (err) => {
|
|
154
|
+
resolve({ installed: false, reason: 'spawn_failed', error: err.message });
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Check PyTorch and detect GPU availability
|
|
161
|
+
*/
|
|
162
|
+
export function checkPyTorch() {
|
|
163
|
+
const pythonPath = getPythonPath();
|
|
164
|
+
|
|
165
|
+
if (!existsSync(pythonPath)) {
|
|
166
|
+
return { installed: false, reason: 'no_python' };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const script = `
|
|
170
|
+
import sys
|
|
171
|
+
try:
|
|
172
|
+
import torch
|
|
173
|
+
version = torch.__version__
|
|
174
|
+
if torch.cuda.is_available():
|
|
175
|
+
device = 'cuda'
|
|
176
|
+
elif hasattr(torch.backends, 'mps') and torch.backends.mps.is_available():
|
|
177
|
+
device = 'mps'
|
|
178
|
+
else:
|
|
179
|
+
device = 'cpu'
|
|
180
|
+
print(f"OK:{version}:{device}")
|
|
181
|
+
except ImportError as e:
|
|
182
|
+
print(f"ERROR:{e}")
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
|
+
const proc = spawn(pythonPath, ['-c', script], {
|
|
187
|
+
env: getPythonEnv(),
|
|
188
|
+
timeout: 30000,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
let stdout = '';
|
|
192
|
+
let stderr = '';
|
|
193
|
+
|
|
194
|
+
proc.stdout.on('data', (data) => {
|
|
195
|
+
stdout += data.toString();
|
|
196
|
+
});
|
|
197
|
+
proc.stderr.on('data', (data) => {
|
|
198
|
+
stderr += data.toString();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
proc.on('close', () => {
|
|
202
|
+
const output = stdout.trim();
|
|
203
|
+
if (output.startsWith('OK:')) {
|
|
204
|
+
const [version, device] = output.replace('OK:', '').split(':');
|
|
205
|
+
resolve({ installed: true, version, device });
|
|
206
|
+
} else {
|
|
207
|
+
resolve({ installed: false, reason: 'import_failed', error: output || stderr });
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
proc.on('error', (err) => {
|
|
212
|
+
resolve({ installed: false, reason: 'spawn_failed', error: err.message });
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Check Demucs
|
|
219
|
+
*/
|
|
220
|
+
export function checkDemucs() {
|
|
221
|
+
return checkPythonPackage('demucs', '__version__');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Check Whisper
|
|
226
|
+
*/
|
|
227
|
+
export function checkWhisper() {
|
|
228
|
+
return checkPythonPackage('whisper', '__version__');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Check CREPE (torchcrepe)
|
|
233
|
+
*/
|
|
234
|
+
export function checkCrepe() {
|
|
235
|
+
return checkPythonPackage('torchcrepe', '__version__');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Check SoundFile (audio backend for torchaudio)
|
|
240
|
+
*/
|
|
241
|
+
export function checkSoundFile() {
|
|
242
|
+
return checkPythonPackage('soundfile', '__version__');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get the FFmpeg executable path
|
|
247
|
+
* Returns system ffmpeg if available, otherwise cached version
|
|
248
|
+
*/
|
|
249
|
+
export function getFFmpegPath() {
|
|
250
|
+
// Check system PATH first
|
|
251
|
+
if (checkSystemCommand('ffmpeg')) {
|
|
252
|
+
return 'ffmpeg';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Check cache directory
|
|
256
|
+
const cacheDir = getCacheDir();
|
|
257
|
+
const plat = platform();
|
|
258
|
+
const filename = plat === 'win32' ? 'ffmpeg.exe' : 'ffmpeg';
|
|
259
|
+
const ffmpegPath = join(cacheDir, 'bin', filename);
|
|
260
|
+
|
|
261
|
+
if (existsSync(ffmpegPath)) {
|
|
262
|
+
return ffmpegPath;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Fallback to assuming it's in PATH
|
|
266
|
+
return 'ffmpeg';
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Check FFmpeg and FFprobe availability
|
|
271
|
+
* Both binaries are required for Creator functionality
|
|
272
|
+
*/
|
|
273
|
+
export function checkFFmpeg() {
|
|
274
|
+
const plat = platform();
|
|
275
|
+
const cacheDir = getCacheDir();
|
|
276
|
+
const ffmpegFilename = plat === 'win32' ? 'ffmpeg.exe' : 'ffmpeg';
|
|
277
|
+
const ffprobeFilename = plat === 'win32' ? 'ffprobe.exe' : 'ffprobe';
|
|
278
|
+
|
|
279
|
+
let ffmpegFound = false;
|
|
280
|
+
let ffprobeFound = false;
|
|
281
|
+
let source = null;
|
|
282
|
+
let version = null;
|
|
283
|
+
|
|
284
|
+
// Check system PATH first
|
|
285
|
+
if (checkSystemCommand('ffmpeg')) {
|
|
286
|
+
ffmpegFound = true;
|
|
287
|
+
source = 'system';
|
|
288
|
+
try {
|
|
289
|
+
const output = execSync('ffmpeg -version', { encoding: 'utf8', timeout: 5000 });
|
|
290
|
+
const versionMatch = output.match(/ffmpeg version (\S+)/);
|
|
291
|
+
version = versionMatch ? versionMatch[1] : 'unknown';
|
|
292
|
+
} catch {
|
|
293
|
+
// Version check failed but ffmpeg exists
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (checkSystemCommand('ffprobe')) {
|
|
298
|
+
ffprobeFound = true;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// If both found in system, we're good
|
|
302
|
+
if (ffmpegFound && ffprobeFound) {
|
|
303
|
+
return { installed: true, version, source: 'system' };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Check cache directory for missing binaries
|
|
307
|
+
const cachedFfmpegPath = join(cacheDir, 'bin', ffmpegFilename);
|
|
308
|
+
const cachedFfprobePath = join(cacheDir, 'bin', ffprobeFilename);
|
|
309
|
+
|
|
310
|
+
if (!ffmpegFound && existsSync(cachedFfmpegPath)) {
|
|
311
|
+
ffmpegFound = true;
|
|
312
|
+
source = 'cached';
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (!ffprobeFound && existsSync(cachedFfprobePath)) {
|
|
316
|
+
ffprobeFound = true;
|
|
317
|
+
source = source || 'cached';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Both must be available
|
|
321
|
+
if (ffmpegFound && ffprobeFound) {
|
|
322
|
+
return {
|
|
323
|
+
installed: true,
|
|
324
|
+
version,
|
|
325
|
+
source,
|
|
326
|
+
ffmpegPath: cachedFfmpegPath,
|
|
327
|
+
ffprobePath: cachedFfprobePath,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Report which is missing
|
|
332
|
+
return {
|
|
333
|
+
installed: false,
|
|
334
|
+
ffmpegFound,
|
|
335
|
+
ffprobeFound,
|
|
336
|
+
reason:
|
|
337
|
+
!ffmpegFound && !ffprobeFound
|
|
338
|
+
? 'both_missing'
|
|
339
|
+
: !ffmpegFound
|
|
340
|
+
? 'ffmpeg_missing'
|
|
341
|
+
: 'ffprobe_missing',
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Check if a Whisper model is downloaded
|
|
347
|
+
*/
|
|
348
|
+
export function checkWhisperModel(modelName) {
|
|
349
|
+
const cacheDir = getCacheDir();
|
|
350
|
+
|
|
351
|
+
// Whisper stores models in ~/.cache/whisper/ by default
|
|
352
|
+
// We redirect via XDG_CACHE_HOME to our cache dir
|
|
353
|
+
const modelPaths = [
|
|
354
|
+
join(cacheDir, 'whisper', `${modelName}.pt`),
|
|
355
|
+
join(homedir(), '.cache', 'whisper', `${modelName}.pt`),
|
|
356
|
+
];
|
|
357
|
+
|
|
358
|
+
// Expected minimum sizes for models (to detect truncated downloads)
|
|
359
|
+
const minSizes = {
|
|
360
|
+
tiny: 70_000_000,
|
|
361
|
+
base: 130_000_000,
|
|
362
|
+
small: 450_000_000,
|
|
363
|
+
medium: 1_400_000_000,
|
|
364
|
+
large: 2_800_000_000,
|
|
365
|
+
'large-v2': 2_800_000_000,
|
|
366
|
+
'large-v3': 2_800_000_000,
|
|
367
|
+
'large-v3-turbo': 1_500_000_000,
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
for (const modelPath of modelPaths) {
|
|
371
|
+
if (existsSync(modelPath)) {
|
|
372
|
+
try {
|
|
373
|
+
const stats = statSync(modelPath);
|
|
374
|
+
const minSize = minSizes[modelName] || 0;
|
|
375
|
+
|
|
376
|
+
if (stats.size >= minSize) {
|
|
377
|
+
return { installed: true, path: modelPath, size: stats.size };
|
|
378
|
+
} else {
|
|
379
|
+
return { installed: false, reason: 'truncated', size: stats.size, expected: minSize };
|
|
380
|
+
}
|
|
381
|
+
} catch {
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return { installed: false, reason: 'not_found' };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Check if Demucs model is downloaded
|
|
392
|
+
*/
|
|
393
|
+
export function checkDemucsModel(_modelName = 'htdemucs_ft') {
|
|
394
|
+
const cacheDir = getCacheDir();
|
|
395
|
+
|
|
396
|
+
// Demucs stores models in torch hub cache
|
|
397
|
+
const checkPaths = [
|
|
398
|
+
join(cacheDir, 'models', 'torch', 'hub', 'checkpoints'),
|
|
399
|
+
join(homedir(), '.cache', 'torch', 'hub', 'checkpoints'),
|
|
400
|
+
];
|
|
401
|
+
|
|
402
|
+
for (const checkPath of checkPaths) {
|
|
403
|
+
if (existsSync(checkPath)) {
|
|
404
|
+
// Just check if directory has files - model names vary
|
|
405
|
+
return { installed: true, path: checkPath };
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return { installed: false, reason: 'not_found' };
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Perform complete system check
|
|
414
|
+
*/
|
|
415
|
+
export async function checkAllComponents() {
|
|
416
|
+
const [python, pytorch, soundfile, demucs, whisper, crepe] = await Promise.all([
|
|
417
|
+
checkPython(),
|
|
418
|
+
checkPyTorch(),
|
|
419
|
+
checkSoundFile(),
|
|
420
|
+
checkDemucs(),
|
|
421
|
+
checkWhisper(),
|
|
422
|
+
checkCrepe(),
|
|
423
|
+
]);
|
|
424
|
+
|
|
425
|
+
const ffmpeg = checkFFmpeg();
|
|
426
|
+
const whisperModel = checkWhisperModel('large-v3-turbo');
|
|
427
|
+
const demucsModel = checkDemucsModel('htdemucs_ft');
|
|
428
|
+
|
|
429
|
+
const components = {
|
|
430
|
+
python,
|
|
431
|
+
pytorch,
|
|
432
|
+
soundfile,
|
|
433
|
+
demucs,
|
|
434
|
+
whisper,
|
|
435
|
+
crepe,
|
|
436
|
+
ffmpeg,
|
|
437
|
+
whisperModel,
|
|
438
|
+
demucsModel,
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// Check if all required components are installed
|
|
442
|
+
const allInstalled =
|
|
443
|
+
python.installed &&
|
|
444
|
+
pytorch.installed &&
|
|
445
|
+
soundfile.installed &&
|
|
446
|
+
demucs.installed &&
|
|
447
|
+
whisper.installed &&
|
|
448
|
+
crepe.installed &&
|
|
449
|
+
ffmpeg.installed &&
|
|
450
|
+
whisperModel.installed &&
|
|
451
|
+
demucsModel.installed;
|
|
452
|
+
|
|
453
|
+
return {
|
|
454
|
+
...components,
|
|
455
|
+
allInstalled,
|
|
456
|
+
cacheDir: getCacheDir(),
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export default {
|
|
461
|
+
getCacheDir,
|
|
462
|
+
getPythonPath,
|
|
463
|
+
getPythonEnv,
|
|
464
|
+
getFFmpegPath,
|
|
465
|
+
checkPython,
|
|
466
|
+
checkPyTorch,
|
|
467
|
+
checkDemucs,
|
|
468
|
+
checkWhisper,
|
|
469
|
+
checkCrepe,
|
|
470
|
+
checkFFmpeg,
|
|
471
|
+
checkWhisperModel,
|
|
472
|
+
checkDemucsModel,
|
|
473
|
+
checkAllComponents,
|
|
474
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App IPC Handlers
|
|
3
|
+
* Handles miscellaneous application operations (app info, song, shell, library, settings)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ipcMain, app, shell } from 'electron';
|
|
7
|
+
import * as libraryService from '../../shared/services/libraryService.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Register all app-related IPC handlers
|
|
11
|
+
* @param {Object} mainApp - Main application instance
|
|
12
|
+
*/
|
|
13
|
+
export function registerAppHandlers(mainApp) {
|
|
14
|
+
// Get application version
|
|
15
|
+
ipcMain.handle('app:getVersion', () => {
|
|
16
|
+
return app.getVersion();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Get current app state snapshot
|
|
20
|
+
ipcMain.handle('app:getState', () => {
|
|
21
|
+
return mainApp.appState.getSnapshot();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Get currently loaded song
|
|
25
|
+
ipcMain.handle('song:getCurrentSong', () => {
|
|
26
|
+
if (mainApp.currentSong && mainApp.currentSong.metadata) {
|
|
27
|
+
return {
|
|
28
|
+
path: mainApp.currentSong.metadata.path || mainApp.currentSong.filePath,
|
|
29
|
+
title: mainApp.currentSong.metadata.title,
|
|
30
|
+
artist: mainApp.currentSong.metadata.artist,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Open external URL in default browser
|
|
37
|
+
ipcMain.handle('shell:openExternal', async (event, url) => {
|
|
38
|
+
await shell.openExternal(url);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Search library for songs
|
|
42
|
+
ipcMain.handle('library:search', (event, query) => {
|
|
43
|
+
return libraryService.searchSongs(mainApp, query);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio IPC Handlers
|
|
3
|
+
* Handles all audio device enumeration and routing
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ipcMain } from 'electron';
|
|
7
|
+
import { AUDIO_CHANNELS } from '../../shared/ipcContracts.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Register all audio-related IPC handlers
|
|
11
|
+
* @param {Object} mainApp - Main application instance
|
|
12
|
+
*/
|
|
13
|
+
export function registerAudioHandlers(mainApp) {
|
|
14
|
+
// Get audio devices
|
|
15
|
+
ipcMain.handle(AUDIO_CHANNELS.GET_DEVICES, () => {
|
|
16
|
+
return mainApp.audioEngine ? mainApp.audioEngine.getDevices() : [];
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Enumerate audio devices
|
|
20
|
+
ipcMain.handle(AUDIO_CHANNELS.ENUMERATE_DEVICES, () => {
|
|
21
|
+
// This will be called from renderer to get real device list
|
|
22
|
+
return [];
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Set audio device
|
|
26
|
+
ipcMain.handle(AUDIO_CHANNELS.SET_DEVICE, (event, deviceType, deviceId) => {
|
|
27
|
+
console.log(`🎧 IPC: Setting ${deviceType} device to ${deviceId}`);
|
|
28
|
+
if (mainApp.audioEngine) {
|
|
29
|
+
return mainApp.audioEngine.setDevice(deviceType, deviceId);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autotune IPC Handlers
|
|
3
|
+
* Handles autotune audio effect operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ipcMain } from 'electron';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Register all autotune-related IPC handlers
|
|
10
|
+
* @param {Object} mainApp - Main application instance
|
|
11
|
+
*/
|
|
12
|
+
export function registerAutotuneHandlers(mainApp) {
|
|
13
|
+
// Enable/disable autotune
|
|
14
|
+
ipcMain.handle('autotune:setEnabled', (event, enabled) => {
|
|
15
|
+
if (mainApp.audioEngine) {
|
|
16
|
+
return mainApp.audioEngine.setAutotuneEnabled(enabled);
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Update autotune settings
|
|
22
|
+
ipcMain.handle('autotune:setSettings', (event, settings) => {
|
|
23
|
+
if (mainApp.audioEngine) {
|
|
24
|
+
return mainApp.audioEngine.setAutotuneSettings(settings);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas Window IPC Handlers
|
|
3
|
+
* Handles canvas window management and WebRTC streaming operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ipcMain } from 'electron';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Register all canvas-related IPC handlers
|
|
10
|
+
* @param {Object} mainApp - Main application instance
|
|
11
|
+
*/
|
|
12
|
+
export function registerCanvasHandlers(mainApp) {
|
|
13
|
+
// Open canvas window
|
|
14
|
+
ipcMain.handle('window:openCanvas', () => {
|
|
15
|
+
mainApp.createCanvasWindow();
|
|
16
|
+
return { success: true };
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Start canvas streaming
|
|
20
|
+
ipcMain.handle('canvas:startStreaming', () => {
|
|
21
|
+
mainApp.startCanvasStreaming();
|
|
22
|
+
return { success: true };
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Stop canvas streaming
|
|
26
|
+
ipcMain.handle('canvas:stopStreaming', () => {
|
|
27
|
+
mainApp.stopCanvasStreaming();
|
|
28
|
+
return { success: true };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Send image data to canvas window
|
|
32
|
+
ipcMain.handle('canvas:sendImageData', (event, imageDataArray, width, height) => {
|
|
33
|
+
if (mainApp.canvasWindow && !mainApp.canvasWindow.isDestroyed()) {
|
|
34
|
+
mainApp.canvasWindow.webContents.send(
|
|
35
|
+
'canvas:receiveImageData',
|
|
36
|
+
imageDataArray,
|
|
37
|
+
width,
|
|
38
|
+
height
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Canvas window ready signal
|
|
44
|
+
ipcMain.on('canvas:childReady', () => {
|
|
45
|
+
console.log('Child window ready, starting canvas streaming');
|
|
46
|
+
// Small delay to ensure everything is fully initialized
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
mainApp.startCanvasStreaming();
|
|
49
|
+
}, 100);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Relay ICE candidates between sender and receiver
|
|
53
|
+
ipcMain.handle('canvas:sendICECandidate', (event, source, candidate) => {
|
|
54
|
+
console.log('🧊 Relaying ICE candidate from', source);
|
|
55
|
+
if (source === 'sender') {
|
|
56
|
+
// Send to receiver via IPC
|
|
57
|
+
if (mainApp.canvasWindow && !mainApp.canvasWindow.isDestroyed()) {
|
|
58
|
+
mainApp.canvasWindow.webContents.send('webrtc:addReceiverICECandidate', candidate);
|
|
59
|
+
}
|
|
60
|
+
} else if (source === 'receiver') {
|
|
61
|
+
// Send to sender via IPC
|
|
62
|
+
if (mainApp.mainWindow && !mainApp.mainWindow.isDestroyed()) {
|
|
63
|
+
mainApp.mainWindow.webContents.send('webrtc:addICECandidate', candidate);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Toggle canvas window fullscreen
|
|
69
|
+
ipcMain.handle('canvas:toggleFullscreen', (event, shouldBeFullscreen) => {
|
|
70
|
+
if (mainApp.canvasWindow && !mainApp.canvasWindow.isDestroyed()) {
|
|
71
|
+
console.log('🖥️ Toggling canvas window fullscreen:', shouldBeFullscreen);
|
|
72
|
+
mainApp.canvasWindow.setFullScreen(shouldBeFullscreen);
|
|
73
|
+
return { success: true, fullscreen: shouldBeFullscreen };
|
|
74
|
+
}
|
|
75
|
+
return { success: false, error: 'Canvas window not available' };
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Send frame to canvas window
|
|
79
|
+
ipcMain.handle('canvas:sendFrame', (event, dataUrl) => {
|
|
80
|
+
if (mainApp.canvasWindow && !mainApp.canvasWindow.isDestroyed()) {
|
|
81
|
+
mainApp.canvasWindow.webContents.send('canvas:receiveFrame', dataUrl);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|