fix: add try-catch + nextMetronomeBeatRef init to startPianoRollRecording
This commit is contained in:
@@ -9850,9 +9850,12 @@ const App = () => {
|
||||
};
|
||||
|
||||
const startPianoRollRecording = (tab) => {
|
||||
try {
|
||||
const context = getAudioContext();
|
||||
const secondsPerBeat = 60.0 / (parseInt(bpm) || 120);
|
||||
const startTime = currentTime;
|
||||
const startBeat = startTime / secondsPerBeat;
|
||||
nextMetronomeBeatRef.current = Math.ceil(startBeat);
|
||||
const midiRec = new ClientMIDIRecorder(context, parseInt(bpm) || 120, 4);
|
||||
midiRec.tempTabId = tab.id;
|
||||
midiRec.selectedMidiInputId = selectedMidiInputId || 'ALL';
|
||||
@@ -9896,7 +9899,15 @@ const App = () => {
|
||||
s.id === tab.id ? { ...s, currentTime: startTime + sec, isDirty: true } : s
|
||||
));
|
||||
};
|
||||
if (!tab._recordingStarted) {
|
||||
tab._recordingStarted = true;
|
||||
}
|
||||
showToast('Recording MIDI to Piano Roll...', 'info');
|
||||
} catch (err) {
|
||||
console.error('startPianoRollRecording error:', err);
|
||||
showToast('Lỗi khi bắt đầu ghi âm Piano Roll: ' + err.message, 'warning');
|
||||
setRecordingState('IDLE');
|
||||
}
|
||||
};
|
||||
|
||||
const startRecordingTake = async (armedTracks) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user