-
-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add splitting to all types of clips #7477
base: master
Are you sure you want to change the base?
Conversation
…ying to remove notes from current clip
… new, removing the old.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style review. Do look at fixing the bracket spacing by looking at the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
@szeli1 mind reviewing this? |
I will review this soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the requested changes for all cases.
You should update this line inside ClipView
:
//! Return true iff the clip could be split. Currently only implemented for samples
virtual bool splitClip( const TimePos pos ){ return false; };
And lastly I think using the remove()
method is fine.
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
Co-authored-by: szeli1 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nitpicks before I test it
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick review before I test it again
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
@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 After some testing, it appears that using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Midi clip splitting seems to work fine now. I wasn't able to find any problems with it while testing.
Pattern clip splitting also seems fine.
However, for automation clips, if you make the split directly on a node with modified tangents or with an outValue, it doesn't split correctly.
if (m_marker) | ||
{ | ||
p.drawLine(m_markerPos, rect().bottom(), m_markerPos, rect().top()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? I'm not sure why it's in the double click event
if (m_marker) | ||
{ | ||
p.drawLine(m_markerPos, rect().bottom(), m_markerPos, rect().top()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
if (m_marker) | ||
{ | ||
p.drawLine(m_markerPos, rect().bottom(), m_markerPos, rect().top()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here too. SampleClipView
doesn't have this.
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.