Skip to content

Commit 9a58f5b

Browse files
Add midi editor note time edit action
1 parent 0622523 commit 9a58f5b

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/ui/component/editor/MIDIContentViewer.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,31 @@ void MIDIContentViewer::insertNote(
630630
}
631631

632632
void MIDIContentViewer::setNoteStartTime(int tempIndex, double time) {
633-
/** TODO */
633+
/** Get Note */
634+
if (tempIndex < 0 || tempIndex >= this->noteRectTempList.size()) { return; }
635+
auto [index, rect, channel] = this->noteRectTempList[tempIndex];
636+
637+
if (index < 0 || index >= this->midiDataTemp.size()) { return; }
638+
auto note = this->midiDataTemp[index];
639+
640+
/** Set Time */
641+
CoreActions::midiSetNoteTime(
642+
this->ref, this->currentMIDITrack,
643+
index, time, note.endSec);
634644
}
635645

636646
void MIDIContentViewer::setNoteEndTime(int tempIndex, double time) {
637-
/** TODO */
647+
/** Get Note */
648+
if (tempIndex < 0 || tempIndex >= this->noteRectTempList.size()) { return; }
649+
auto [index, rect, channel] = this->noteRectTempList[tempIndex];
650+
651+
if (index < 0 || index >= this->midiDataTemp.size()) { return; }
652+
auto note = this->midiDataTemp[index];
653+
654+
/** Set Time */
655+
CoreActions::midiSetNoteTime(
656+
this->ref, this->currentMIDITrack,
657+
index, note.startSec, time);
638658
}
639659

640660
void MIDIContentViewer::updateKeyImageTemp() {

0 commit comments

Comments
 (0)