Skip to content
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

Sampletrack - resize from left #3487

Merged
merged 13 commits into from
Nov 1, 2017
Merged

Sampletrack - resize from left #3487

merged 13 commits into from
Nov 1, 2017

Conversation

BaraMGB
Copy link
Contributor

@BaraMGB BaraMGB commented Apr 5, 2017

https://www.youtube.com/watch?v=BQfWqTMjxUE&feature=youtu.be

Things to do:
- save to project doesn't work, yet

This one is the halve way to split (knife tool) a sample track in two.

@@ -67,7 +67,7 @@
#include "SongEditor.h"
#include "StringPairDrag.h"
#include "TextFloat.h"

#include <QDebug>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@@ -48,7 +48,7 @@
#include "Mixer.h"
#include "EffectRackView.h"
#include "TrackLabelButton.h"

#include <QDebug>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@Umcaruje
Copy link
Member

Umcaruje commented Apr 5, 2017

Omg I love you so much for doing this <3

@tresf tresf mentioned this pull request Apr 5, 2017
29 tasks
@BaraMGB
Copy link
Contributor Author

BaraMGB commented Apr 7, 2017

I guess, this is ready for review.

Copy link
Member

@jasp00 jasp00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested improvements.

#else
"Ctrl"),
#endif
embed::getIconPixmap( "hint" ), 0 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reuse the Resize case code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how could this happen economical. Maybe you can give me a tip? All three cases are very similar. I don't know how to consolidate.

@@ -58,6 +58,7 @@ class SampleTCO : public TrackContentObject
return m_sampleBuffer;
}

void setStartTimeOffset( MidiTime startTime );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this feature will not be useful for other TCOs? You do not have to implement those cases now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasp00 excellent point, yes this will be useful for other track types. Piano Roll, BBEdtior and Automation patterns can eventually benefit from this as well. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it into Track.h/.cpp in the TrackContentObject. 👍

arg( m_tco->endPosition().getTicks() %
MidiTime::ticksPerTact() ) );
s_textFloat->moveGlobal( this, QPoint( width() + 2,
height() + 2) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reuse the text float code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how could this happen economical. Maybe you can give me a tip?

@@ -925,6 +982,24 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me )
QCursor c( Qt::SizeHorCursor );
QApplication::setOverrideCursor( c );
}
else if( me->x() < RESIZE_GRIP_WIDTH && !me->buttons() )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should merge this block with the previous one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -954,7 +1029,7 @@ void TrackContentObjectView::mouseReleaseEvent( QMouseEvent * me )
setSelected( !isSelected() );
}

if( m_action == Move || m_action == Resize )
if( m_action == Move || m_action == Resize || m_action == ResizeLeft )
{
m_tco->setJournalling( true );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this?

// TODO: Fix m_tco->setJournalling() consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -603,10 +629,10 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
float framesPerTick = Engine::framesPerTick();
if( _start >= sTco->startPosition() && _start < sTco->endPosition() )
{
if( sTco->isPlaying() == false )
if( sTco->isPlaying() == false && _start > sTco->startPosition() + sTco->startTimeOffset() )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should refactor the offset information because playing is more important than GUI events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain, what is in your mind? @jasp00

@Umcaruje
Copy link
Member

So, I found a bug:
gifrecord_2017-04-14_121003

When you tweak the tempo, the end point of the sample gets reset. The starting point seems fine. Other than that cutting works, duplicating the sample works and sync is rock-solid, as always 👍

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Apr 14, 2017

@Umcaruje Ah! Cool! I'll look into it. Thanks!

@tresf
Copy link
Member

tresf commented Apr 14, 2017

When you tweak the tempo, the end point of the sample gets reset.

Just an FYI, this bug had existed prior to this feature.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Apr 17, 2017

@tresf Okay, that's another bug. I think, we should split this issue. The bug should be fixed for 1.2. I'll make a new pull request for this.

@tresf
Copy link
Member

tresf commented May 4, 2017

When you tweak the tempo, the end point of the sample gets reset.

Just an FYI, this bug had existed prior to this feature.

I think, we should split this issue

@BaraMGB refactor startTimeOffset(positive values)/change offset on tempochange 0849eec

@BaraMGB if I'm reading this correctly, we're fixing this in this PR, correct? Is the PR ready for testing?

@BaraMGB
Copy link
Contributor Author

BaraMGB commented May 4, 2017

@tresf actually I thought this one is a feature and so it doesn't goes into 1.2. The issue by resizing from the end and changing tempo is a bug though. So my plan is to handle it in a further pull request. But this one here is complicated. It works almost but is not perfect, yet.

@tresf tresf added this to the 1.3.0 milestone May 4, 2017
@tresf
Copy link
Member

tresf commented May 4, 2017

I thought this one is a feature and so it doesn't goes into 1.2.

Good point. We can always use some testing though, regardless of the branch. Please feel free to ping @UnityParadox when ready if you need a tester, he's been volunteering himself for testing.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented May 15, 2017

Okay. This seems to work. I want to clean up and optimize the code before we merge. Perhaps people wants to test this. @UnityParadox

@gi0e5b06
Copy link

Actually, this feature would be great for any type of track.
click-move for adjusting at the bar, click-shift move for extra precision.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Aug 25, 2017

Can someone please review this and merge if it's okay?

@Umcaruje
Copy link
Member

@BaraMGB It'll be first on my list tommorow.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Oct 29, 2017

Can someone please review this and merge if it's okay?

@gi0e5b06
Copy link

This should be available for any type of track, not just sample tracks.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Oct 30, 2017

This should be available for any type of track, not just sample tracks.

Step by step.

@zonkmachine
Copy link
Member

zonkmachine commented Nov 1, 2017

1 2 3 ... testing!

  • save to project doesn't work, yet

Save works fine as does the rest. I can't really assess the code but others have done this already. After testing it for an hour I'm happy to include it in master but someone else should really chip in.
The only question mark I have right now is about the rebase/merge that's been done here. I usually rebase branches I check out but this wouldn't work with sampletrackcut against latest master. I pretty much assume here that if github says this is fine and mergeable it's fine and I can merge it with master all right so I guess this is more out of curiosity. I only rebase local development branches against upstream so this usually don't create a separate commit. It sometimes does and I have yet to figure out why. Maybe because a merge have rewritten upstream? The problem is first of all that if I want to check this against the latest master I have to do a merge and the commits will come interleaved with each other and will be harder to dive into if I have to do a diff.

Edit: It's been tested with the fpe debug option.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Nov 1, 2017

Actually I merged the latest master into my branch, got the merge conflict and solved it with meld. I did this twice for this branch. But I'm a little bit tired of this. Therefore it would be nice if this could be merged.

@tresf
Copy link
Member

tresf commented Nov 1, 2017

zonkmachine approved these changes 10 hours ago

it would be nice if this could be merged.

Alrighty then. 👍

@tresf tresf merged commit c765249 into LMMS:master Nov 1, 2017
new StringPairDrag( QString( "tco_%1" ).arg(
m_tco->getTrack()->type() ),
dataFile.toString(), thumbnail, this );
m_action = ToggleSelected;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BaraMGB I guess something went wrong when you sync with master branch.
See https://github.com/LMMS/lmms/pull/3649/files#diff-cb2a453c979a4777b9330e2b96644f0eR701.

@PhysSong
Copy link
Member

I also found some serious GUI bugs introduced here(ex. can't copy TCOs with drag & drop). I'm going to fix that if @BaraMGB is not going to do that.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Nov 14, 2017

@PhysSong I'm appreciate for your help in this matter.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Nov 18, 2017

@PhysSong it's a long time ago when I wrote this. For fixing I need a little more help. Can you tell me which bugs you noticed? I don't get the problems. Copy TCOs by pressing ctrl and dragging don't work anymore is what I can reproduce. This should be easy to fix. But you pointed out that there are more GUI bugs. I need to know them. Thanks for the help.

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Nov 18, 2017

Okay, I guess I see whats's going on. I'll fix that.

PhysSong added a commit to PhysSong/lmms that referenced this pull request Nov 24, 2017
PhysSong added a commit that referenced this pull request Nov 29, 2017
* Fix TCO copy with Ctrl + Dragging
* Fix text float display in song editor
* avoids override cursor in BBEditor for sampletracks at left side
@tresf tresf mentioned this pull request Mar 5, 2019
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
Sampletrack - resize from left
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
)

* Fix TCO copy with Ctrl + Dragging
* Fix text float display in song editor
* avoids override cursor in BBEditor for sampletracks at left side
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants