drop python backend layer
This commit is contained in:
+12
-15
@@ -1,3 +1,5 @@
|
||||
import { renderKeyboardTrack } from './audio/export';
|
||||
import type { SampleCache } from './audio/sampleCache';
|
||||
import type { LegacySwitchType, Marker, Project, SwitchType } from './types';
|
||||
import { app, setActiveSwitch, setMarkers, setSelectedIds } from './store.svelte';
|
||||
|
||||
@@ -50,24 +52,19 @@ export function loadProject(data: Project & { version?: number; switch?: string
|
||||
setSelectedIds(new Set());
|
||||
}
|
||||
|
||||
export async function exportAudio(duration: number) {
|
||||
/**
|
||||
* Export keyboard SFX only as a WAV file (no video audio).
|
||||
* Rendered client-side at 1× via OfflineAudioContext.
|
||||
*/
|
||||
export async function exportAudio(duration: number, cache?: SampleCache) {
|
||||
const project = buildProject();
|
||||
const response = await fetch('/api/export/audio', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
duration,
|
||||
switch: project.switch,
|
||||
markers: project.markers,
|
||||
}),
|
||||
const blob = await renderKeyboardTrack({
|
||||
duration,
|
||||
switchType: project.switch,
|
||||
markers: project.markers,
|
||||
cache,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const detail = await response.text();
|
||||
throw new Error(detail || 'Audio export failed');
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href = url;
|
||||
|
||||
Reference in New Issue
Block a user