Open regulus79 opened 4 weeks ago
@szeli1 mind reviewing this?
@szeli1 mind reviewing this?
I will review this soon
Here are some things I noticed while testing it:
Unrelated bug: In the Piano Roll, the mouse icon when in Pitch Bend mode can disappear if you click on a note, then close the note's automation editor window.
Other than the issues above, everything seems to work fine. I'm pretty excited about this feature and hope we can get it merged soon.
I think I have fixed most of the bugs, however I don't understand how journalling works enough to fix the bug where the new clips don't disappear after undoing. I will continue to look into it, but I may need some help.
Also, I decided to remove the restriction on midi clips needing to be split on the bar, and instead implemented your suggestion on letting the left clip's length be longer and extend behind the right clip. So now they can be split at arbitrary positions!
Ah, nevermind, it seems that using close()
instead of remove()
makes it work! I will have to look into why that happens.
@regulus79 It seems that when I split a midi clip, the original singular clip still remains though it is invisible. You can hear it when the song plays since it plays twice as loud as before the clip was split, and if you clone the track, it becomes visible in the cloned track.
Okay that's an interesting bug... I think it may have to do with me using close()
instead of remove()
when removing the old clip. But that's odd, since it doesn't appear to happen for AutomationClips
which also use close()
(???)
After some testing, it appears that using remove()
solves the issue. I also think I found the cause of the old problem when using remove()
, which is that I was calling it after m_clip->getTrack()->restoreJournallingState();
. Again, I'm not an expert in Journalling, but calling it before appears to fix the problem.
I fixed the problem with out/in values and tangents in automation clip splitting.
Makes the knife tool work for all types of clips, not just
SampleClip
s.Changes
Most of the code is copied from
SampleClipView.cpp
'ssplitClip()
function, and then modified for each clip type.ClipView.cpp
to allow splitting more than justSampleClip
s, and to hold off on dragging clips that cannot be resized (MidiClip
s) when knife mode is enabled.PatternClip
s was trivial.AutomationClip
s andMidiClip
s was more involved, as becausesetStartTimeOffset()
appears to do nothing, it required copying the correct nodes over and offsetting them back by the length of the left clip. However, the original clip still had all the notes, which meant that if the user changed some of them, its length would snap back to full. I had difficulty finding a good way to delete certain notes via a loop, so I decided to instead spawn two new clips, one left and one right, populate them with notes, and delete the original clip.Notes
AutomationClipView.cpp
, for some reason when splitting an automation clip, the new clips sometimes sets themselves to record mode. I added a temporary fix for this by setting the recording mode to the mode of the original clip.BecauseMidiClip
s are only drawn in multiples of 1 bar, splitting them between bars led to buggy graphics. Because of this, I forced the split position to be a multiple of a bar.remove()
close()
at the end ofspltiClip()
forAutomationClipView.cpp
andMidiClipView.cpp
, so I hope that takes care of everything.