initial public release.

This commit is contained in:
Xiaohan-Tian
2025-08-11 18:37:21 -07:00
commit de51967b49
186 changed files with 32322 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import { Expose, Type } from 'class-transformer';
import { KGRegion } from './KGRegion';
import { KGMidiNote } from '../midi/KGMidiNote';
/**
* KGMidiRegion - Class representing a MIDI region in the DAW
* Contains MIDI notes and inherits position/length from KGRegion
*/
export class KGMidiRegion extends KGRegion {
@Expose()
protected override __type: string = 'KGMidiRegion';
@Expose()
@Type(() => KGMidiNote)
protected notes: KGMidiNote[] = [];
constructor(id: string, trackId: string, trackIndex: number, name: string, startFromBeat: number = 0, length: number = 0) {
super(id, trackId, trackIndex, name, startFromBeat, length);
this.__type = 'KGMidiRegion';
}
// Getter
public getNotes(): KGMidiNote[] {
return this.notes;
}
// Setter
public setNotes(notes: KGMidiNote[]): void {
this.notes = notes;
}
// Add a single note
public addNote(note: KGMidiNote): void {
this.notes.push(note);
}
// Remove a note by ID
public removeNote(noteId: string): void {
this.notes = this.notes.filter(note => note.getId() !== noteId);
}
// Override getCurrentType to return specific subclass type
public override getCurrentType(): string {
return 'KGMidiRegion';
}
}