-
-
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
Adds automation flipping. #1486
Conversation
@diizy flipping horizontally in song editor calls flip with the boolean "visible" set to true, doing so from automaton editor does so with it set to false. Once I figure out how to flip it based on pattern length in song editor (which I might need some help with), I can set it up so it behaves differently based on which editor it's used from. |
for( int i = 0; i <= numPoints; i++ ) | ||
{ | ||
|
||
if (min < 0) |
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.
formatting :) if ( min < 0 )
Please make the formatting changes (there are a few more I left out). You can push to this same branch and it will automatically be reflected in the pull request. |
Thanks! I'll fix it asap |
While editing AutomationPatternView I saw m_pat->length(), which seems like it would give the length of the pattern in song editor. I have a couple different ideas on how to proceed now. Option 1 might not be possible, Option 2 bothers me (I shouldn't have to pass two variables when I can pass 0/1 instead with option 3), and Option 3 creates two entire separate functions, which might be overkill. @diizy which do you think is best? |
On 12/23/2014 11:17 AM, Spekular wrote:
How about you create a function with a default parameter: flipX( int So if you call flipX() it's the same as calling flipX(-1) Then in the function just check the length parameter, if it's negative, |
@diizy I wasn't aware you could do that, thanks EDIT: I've cleaned up the code a bit by removing commented out lines and making it adhere better to standards. |
On 12/23/2014 02:04 PM, Spekular wrote:
Upload the code and I'll take a look |
Me neither. I've done this in other looser typed languages, but never in C++. Good to know. 👍 -Tres |
@diizy That was my fault, it wasn't building the changes because I was modifying my backup and not the actual code. Anyways, progress is pretty good. |
@diizy @tresf ok so m_pat->length() is still the wrong length. I changed the code to add a point at m_pat->() length, and no matter how large I scaled the pattern in song editor it was 3 bars (I guess the point right on the end of bar two counts as the beginning of bar three and it rounds up). Do any of you know how to actually get the visibile length of an automation pattern in the song editor? It has to be stored somewhere and it's the one thing holding this up. |
No, I don't but finding out how other parts of the software do it is your best best. Perhaps somewhere in The idea is that each Tact represents a certain amount of ticks. Perhaps that can help? Sorry I'm not of more use. |
I've got a not very good solution. width() in AutomationPatternView gives a pixel width. Then I divide that by pixelsPerTact and multiply by tickPerTact to get the number of ticks. The issue with this is that it's not precise enough, but I don't see any actual measurement of ticks. Rounding to the nearest bar would fix this when that's desired, but still wouldn't allow precise dragging/flipping. |
On 12/23/2014 04:03 PM, Spekular wrote:
Try TrackContentObject::length() as in m_pat->TrackContentObject::length() |
Yeah as Vesa said, length is of type MidiTime already, you can treat it as such. I believe the confusing part is that you can treat length() as a number and use its underlying value, but don't. Treat it like a MidiTime object. Pattern.h makes this pretty clear as length() always returns a MidiTime object. |
Sorry smartphone makes that close button too easy to click on :) |
On 12/23/2014 07:10 PM, Tres Finocchiaro wrote:
That doesn't actually matter, MidiTime converts automatically to int |
On 12/23/2014 06:58 PM, Spekular wrote:
Don't do that. Just use TrackContentObject::length() |
👍 |
Ok, so flipping horizontally and vertically both work in automation editor, flipping the pattern only. Flipping horizontally in song editor flips the visible area properly no matter if the pattern is larger, smaller than, or the same size as the visible area. Flipping vertically from song editor does not currently take into account the visible area, but this should be a relatively easy fix (I'd forgotten about it, which is why I haven't gotten it done). |
Flipping vertically can probably stay as it is... |
I'll probably need to draw the icons to make sure they fit in with the other icons... other than that, things look ok here. |
:D Awesome! |
Congrats @Spekular. Thanks for the hard work! I think we already have some compelling reasons to start building betas of 1.2. Next milestone... Here we come :) If we could give codenames, I think 1.0: Codename "Fundamental". 1.1 Codename "Instrumental". 1.2 Codename: "Precision" :) |
:) |
for( int i = 0; i <= numPoints; i++ ) | ||
{ | ||
tempValue = valueAt( ( iterate + i ).key() ); | ||
cleanObjects(); |
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 is the purpose of the cleanObjects() call here? Flipping shouldn't require any changes to the automation connections.
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.
@vesa I'm not entirely sure, I don't recall adding it.
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.
On 12/30/2014 09:02 PM, Spekular wrote:
In src/core/AutomationPattern.cpp
#1486 (diff):
numPoints++;
- }
- float realLength = ( iterate + numPoints ).key();
- if ( length != -1 && length != realLength)
- {
if ( realLength < length )
{
tempValue = valueAt( ( iterate + numPoints ).key() );
putValue( MidiTime( length ) , tempValue, false);
numPoints++;
for( int i = 0; i <= numPoints; i++ )
{
tempValue = valueAt( ( iterate + i ).key() );
@vesa https://github.com/Vesa I'm not entirely sure, I don't recallcleanObjects();
adding it.
Then it should be removed.
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 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.
@vesa will do ASAP.
@vesa Should be fixed now! |
@diizy is it safe to delete my branch for this now? |
Sorry, where is the commit for the fixes? |
@diizy it should be the latest one. Spekular@d533bce |
Well... you called your branch "master" and your changes have already been merged. Do you want to delete your own master branch? :) Normally in your case a developer would fast forward his/her master branch and continue using it, although ideally these types of changes would be on a separate branch that could be easily deleted once merged. |
On 01/05/2015 04:12 PM, Spekular wrote:
You can't add commits to a pr after it's merged. You need to do a new pr. |
Well, yes... sort of. First, backup your code changes. Next, fast forward per our wiki tutorial. Last, verify your code is good and make a new PR. If you really want to clean house, backup your code, hard reset your master branch, and do future changes via a dedicated branch as to not mess up your own master. Lastly, you can always delete your repo on GitHub which will really clean things up... but if you're like me and use it for other things (namely Windows binary releases and Wiki articles), you may want to weigh your options first due to the amount of work involved in carrying the content over 👍 . |
Related #1554 |
Implements #1289.