fix: load existing projects will crash the playback or have no sound due to missing pitchBend array in the JSON

This commit is contained in:
Xiaohan-Tian
2026-05-05 21:52:57 -07:00
parent 98cccf5c7a
commit 6ed1dddebd
6 changed files with 117 additions and 8 deletions
@@ -6,6 +6,7 @@ import { upgradeToV4 } from './upgradeToV4';
import { upgradeToV5 } from './upgradeToV5';
import { upgradeToV6 } from './upgradeToV6';
import { upgradeToV7 } from './upgradeToV7';
import { upgradeToV8 } from './upgradeToV8';
/**
* Upgrade the given project to the latest structure version, one version at a time.
@@ -53,6 +54,10 @@ export function upgradeProjectToLatest(project: KGProject): KGProject {
workingProject = upgradeToV7(workingProject);
break;
}
case 8: {
workingProject = upgradeToV8(workingProject);
break;
}
default: {
// If an upgrader is missing, throw to prevent loading incompatible structures
throw new Error(`No upgrader found for project structure version ${nextVersion}`);