disable unused param check for building; updated version number; avoid relying on constructor.name to determine class type due to class name mangling.
This commit is contained in:
@@ -229,6 +229,8 @@ export class KGAudioInterface {
|
||||
public preparePlayback(project: KGProject, startPosition: number): void {
|
||||
// Clear any existing scheduled events
|
||||
this.clearScheduledEvents();
|
||||
|
||||
console.log("Preparing playback");
|
||||
|
||||
try {
|
||||
// Set project BPM and time signature FIRST (this affects timing calculations)
|
||||
@@ -245,10 +247,14 @@ export class KGAudioInterface {
|
||||
project.getTracks().forEach(track => {
|
||||
const trackId = track.getId().toString();
|
||||
const audioBus = this.trackAudioBuses.get(trackId);
|
||||
|
||||
console.log(`Track ${trackId} has audio bus: ${audioBus ? 'true' : 'false'}; type: ${track.getType()}`);
|
||||
|
||||
if (audioBus && track.getType() === 'MIDI') {
|
||||
track.getRegions().forEach(region => {
|
||||
if (region.constructor.name === 'KGMidiRegion') {
|
||||
console.log(`Region ${region.getId().toString()}: type: ${region.getCurrentType()}`);
|
||||
|
||||
if (region.getCurrentType() === 'KGMidiRegion') {
|
||||
const midiRegion = region as unknown as { getNotes: () => KGMidiNote[] };
|
||||
|
||||
// Get notes from region (assuming it has a getNotes method)
|
||||
|
||||
@@ -35,7 +35,7 @@ export class RemoveTrackCommand extends KGCommand {
|
||||
this.originalTrackIndex = trackToRemove.getTrackIndex();
|
||||
|
||||
// Store instrument if it's a MIDI track
|
||||
if (trackToRemove.constructor.name === 'KGMidiTrack' && 'getInstrument' in trackToRemove) {
|
||||
if (trackToRemove.getCurrentType() === 'KGMidiTrack' && 'getInstrument' in trackToRemove) {
|
||||
this.originalInstrument = (trackToRemove as KGMidiTrack).getInstrument();
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ export const useProjectStore = create<ProjectState>((set, get) => {
|
||||
|
||||
// Type guard to check if track is KGMidiTrack
|
||||
const isMidiTrack = (track: KGTrack): track is KGMidiTrack => {
|
||||
return track.constructor.name === 'KGMidiTrack' && 'getInstrument' in track;
|
||||
return track.getCurrentType() === 'KGMidiTrack' && 'getInstrument' in track;
|
||||
};
|
||||
|
||||
// Check if instrument changed (only for MIDI tracks)
|
||||
@@ -455,7 +455,7 @@ export const useProjectStore = create<ProjectState>((set, get) => {
|
||||
const trackId = track.getId().toString();
|
||||
// Get instrument from track model if it's a MIDI track
|
||||
let instrument: InstrumentType = 'acoustic_grand_piano'; // Default fallback
|
||||
if (track.constructor.name === 'KGMidiTrack' && 'getInstrument' in track) {
|
||||
if (track.getCurrentType() === 'KGMidiTrack' && 'getInstrument' in track) {
|
||||
instrument = (track as KGMidiTrack).getInstrument();
|
||||
}
|
||||
audioInterface.createTrackSynth(trackId, instrument);
|
||||
|
||||
Reference in New Issue
Block a user