feat: implemented the logic to automatically create a chord when a suitable guide chord is highlighted.

This commit is contained in:
Xiaohan-Tian
2025-12-15 21:59:56 -08:00
parent fbd13eef9f
commit 54b227c1be
3 changed files with 100 additions and 16 deletions
+27
View File
@@ -17,6 +17,9 @@ export class KGPianoRollState {
// Chord guide state
private currentSuitableChords: Record<string, string[]> = {}; // Map of chord symbols to note names (e.g., {"I": ["C", "E", "G"]})
private currentSuitableChordsPitchClasses: Record<string, number[]> = {}; // Map of chord symbols to pitch classes (e.g., {"I": [0, 4, 7]})
private currentMatchingChords: number[][] = [];
private currentSelectedChordIndex: number = 0;
private currentChordCursorPitch: number | null = null;
private constructor() {
console.log("KGPianoRollState initialized");
@@ -77,4 +80,28 @@ export class KGPianoRollState {
public setCurrentSuitableChordsPitchClasses(chordsPitchClasses: Record<string, number[]>): void {
this.currentSuitableChordsPitchClasses = chordsPitchClasses;
}
public getCurrentMatchingChords(): number[][] {
return this.currentMatchingChords;
}
public setCurrentMatchingChords(chords: number[][]): void {
this.currentMatchingChords = chords;
}
public getCurrentSelectedChordIndex(): number {
return this.currentSelectedChordIndex;
}
public setCurrentSelectedChordIndex(index: number): void {
this.currentSelectedChordIndex = index;
}
public getCurrentChordCursorPitch(): number | null {
return this.currentChordCursorPitch;
}
public setCurrentChordCursorPitch(pitch: number | null): void {
this.currentChordCursorPitch = pitch;
}
}