-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Knife Tool for Sample Clips #4998
Conversation
friend, this also serves for tco or piano roll clips ?. is that this tool looks great. |
This currently only works for sample clips. |
I'd love it if git didn't completely destroy everything every time I tried to rebase. Fetched and pulled on snap branch, checked out knife branch, fetched and pulled again, "rebase spek SESnap", everything explodes. |
I can help you with rebasing commits. |
It seems to have fixed itself once I fixed the merge "conflict" that there was an extra newline somewhere. For a while it was displaying changes as if I'd touched tens of files, even though the "changes" matched master exactly. I may have been trigger happy in my complaining, since last time was a huge timesink. |
I tried rebasing commits. Surprisingly, there were only 2 commits after rebasing. If you want a clean branch, I can push the rebased one. |
Feel free to do so!
…On Sat, Jul 27, 2019, 15:45 Hyunjin Song ***@***.***> wrote:
I tried rebasing commits. Surprisingly, there were only 2 commits after
rebasing. If you want a clean branch, I can push the rebased one.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4998?email_source=notifications&email_token=ACEBLGRLI2XI5T7IHPJMOH3QBRGNZA5CNFSM4HQTK6X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26LXQI#issuecomment-515685313>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACEBLGXJAN4BI6QMVSQFNCTQBRGNZANCNFSM4HQTK6XQ>
.
|
Rebased. You can pull the branch with
|
Great! Lots of refactoring coming soon, and a shift mode for this as well,
that snaps the length of the new left/right clip.
(EDIT: The issue description below this is incorrect.)
Just one tiny issue to fix: Cuts end up one pixel to the left of where they
should be at 200% zoom and less. Might have to do with the fact that the
patterns are drawn one pixel to the left of the bar lines.
One fix is to add a pixel to the calculations and see if it helps. Another
is to do the quantization twice, once for drawing and once for cutting, but
this results in essentially duplicate code. Therefore I'm trying the pixel
solution first, even though it feels hacky.
|
Fixing that "tiny issue" took a while. You'd think that the result from knifeMarkerPos( me ) could be converted back to a MidiTime and used for the actual cut itself, but for some reason the shift/default behavior ends up inverted if you do. Adding a boolean switch to flip the two still left some weirdness, so I moved the code that decides the position back into mouseReleaseEvent. After a ton of trial and error I think it's working, but I can't say I understand why it has to be the way it is. |
With the icon added, I don't think there's anything left to add to this. Ready for code review and testing! |
@Spekular If you right click while holding left click with the knife tool, the black marker line thing stays behind (even after switching tools). If you move the TCO with the black line left behind, then the mark will stay there permanently. |
Good catch. I can probably just add a call to disable the marker in the RMB
handling, will check when I get the time.
…On Sun, Jul 28, 2019, 22:52 Lost Robot ***@***.***> wrote:
@Spekular <https://github.com/Spekular> If you right click while holding
left click with the knife tool, the black marker line thing stays behind
(even after switching tools). If you move the TCO with the black line left
behind, then the mark will stay there permanently.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4998?email_source=notifications&email_token=ACEBLGSUF4TY3KCU3HZKGDTQBYBHZA5CNFSM4HQTK6X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD27GKOI#issuecomment-515794233>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACEBLGU3KSGGPSGMUTGV6OLQBYBHZANCNFSM4HQTK6XQ>
.
|
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.
There are a lot of spaces in braces. As far as I know, we decided to use the current coding convention if we write new code. Perhaps you look into it. I think I have not barked at every single point.
{ | ||
m_marker = e; | ||
} | ||
|
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.
Let's remove the spaces inside the brackets in new code.
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.
I thought policy was to match surrounding code until an autoformatter fixes this stuff.
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.
match surrounding code
setIsPlaying()
doesn't have spaces in the parentheses, but setSampleBuffer()
does. Neither way will match the surrounding code perfectly.
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.
The vast majority of the file uses spaces, but fair point.
@PhysSong I can't reproduce the hang. Does it still occur on the latest commt? |
I have found that both the default and classic them use odd sizes for the cursor which are different from each other. I will start with the knife tool cursor icons tomorrow with 32x32 and we can scale down to 16x16 if it seems too large. Might want to update the default cursor to match so that the size doesn't significantly jump and if it is more widely supported that may be an overall improvement. |
Between these I prefer the razor as well, but in general I'm partial to a knife/scalpel metaphor. One of my concerns with scissors is their association with cut as in cut/copy/paste. I've added a screenshot to the PR description where you can see what the icon for the button looks like, apologies for not having this up before :( |
@Spekular no problem, my mistake for not checking the current icon.
Good point, I agree.
I like this concept. I can refine the existing icon as well. Should the cursor match this icon, just in a 32x32 size w/ border? |
Feel free to, here's the .svg file.
Matching the orientation might look odd; the button icon has to aim 45 degrees down and left to match the pencil, whereas cursors usually range between pointing up/left and pointing straight up. Of course, if it doesn't look weird or out of place with the other cursors, I suppose it's not an issue. Otherwise I think it's probably a good idea for them to match. I assume you're referring to the black outline/stroke around most cursors when you say "border"? My first thought was a square frame around the icon so I'm double checking, haha. |
I think this is a great idea.
Yep 👍 Okay, I have created a slightly tweaked version for hopefully added crispness (.5 aligned slanted shapes tend to stairstep better) and a cursor version. For the cursor, I took out the slant on the tip of the blade so that it's a little more precise and matching a regular cursor expectation. I can leave the icon version with the slant as it does help metaphorically. Or we can make this straight as well for consistency. |
Looks awesome! I'm a fan of straight cursor + slanted button, so let's go with that unless you disagree? Once I have .pngs for the cursor and tweaked button I'll try to get the cursor implemented as soon as I can. (I might wait for #5489, though) |
It's a little tricky to make these crisp due to the number of slanted lines. I'm attaching the best results for the icon I could get. Slanted lines should translate better at half pixel but I don't see much of a difference in this case. If the icon master himself (@Umcaruje) has time to look at this and notices any way to crisp it up any further... But otherwise, let's just make sure to use a cairo export. |
LMMS sometimes crashes on undoing cuts. lmms/src/tracks/SampleTrack.cpp Lines 646 to 651 in 5cee7b2
It seems like getTCO(i) sometimes return null due to some multithread-unsafe code, and we don't check the return value.
The hang was fixed by not using |
Does this multithread unsafeness need to be fixed in the areas I've touched, or elsewhere? Also, that loop never references
Ok, so how do we move forward? I believe I tried using a copy constructor for the SampleBuffer, but the compiler complained about it not existing even though a default one should exist. |
I think
There's no default copy constructor because the copy constructor of |
@PhysSong how does this look? Still seems to work from a quick test, the first TCO stops playing when it should. If this is good then I should also add a copy assignment to SampleBuffer and SampleTCO. |
This PR builds off of #4973, so that one needs to be reviewed and merged first.Needs to be updated with all the changes from #4973 before merge, somehow.Mergeable once again!
Adds a knife tool for splitting sample clips, based on BaraMGB's work.
Screeshot shows, from left to right: Unquantized cut, quantized cut before releasing mouse, cut quantized to clip boundaries (in this case, two bars left of the clip's end)
TODO:
Usage: