Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
09fccac
Initial clip splitting
regulus79 Aug 31, 2024
e010f28
Force midi clip splitting to be roudned to 1 bar
regulus79 Aug 31, 2024
ff8a47d
Make midi clip split into two clips and delete the old, instead of tr…
regulus79 Aug 31, 2024
8767dfd
Change splitting automation clips to be like midi clips: spawning two…
regulus79 Aug 31, 2024
fb2a222
Remove unecessary spacing and replace iterator type with auto
regulus79 Aug 31, 2024
70cf4dc
Invert if statement to return false early
regulus79 Aug 31, 2024
06b645e
Separate brackets from code with space
regulus79 Sep 2, 2024
4afdc87
Add space between for and parentheses
regulus79 Sep 2, 2024
c287cd0
Change spacing in if statment
regulus79 Sep 2, 2024
0f92817
Make param comment multiline
regulus79 Sep 2, 2024
6108c5d
Add spaces between // and comments
regulus79 Sep 2, 2024
360a5d1
Add space between if and parentheses
regulus79 Sep 2, 2024
273520c
Remove space between const and *
regulus79 Sep 2, 2024
607e810
Remove space between const and star again
regulus79 Sep 2, 2024
790a01f
Change code style for the other clip types
regulus79 Sep 2, 2024
1c45810
Code style changes for SampleClipView, plus inverting the if statement
regulus79 Sep 2, 2024
292e998
Update comment in ClipView.h
regulus79 Sep 2, 2024
da2e97c
Remove comments from .cpp files, and add single comment in ClipView.h
regulus79 Sep 2, 2024
c1f2928
Make rounded_pos lowerCamelCase
regulus79 Sep 2, 2024
de01890
Declare movedNote on the stack
regulus79 Sep 2, 2024
2995ba8
Force left clip to remain at original position after splitting
regulus79 Sep 2, 2024
72356bf
Change Knife Mode button tooltip
regulus79 Sep 4, 2024
ac8a1c4
Make knife cursor appear for all types of clips
regulus79 Sep 4, 2024
19b6916
Make double-click do nothing when in knife mode
regulus79 Sep 4, 2024
b2db31a
Fix midi clips having wrong length after splitting
regulus79 Sep 4, 2024
aa773a0
Remove spaces to fix code style
regulus79 Sep 4, 2024
39a8bb3
Use removeNodes() instead of recreating entire left clip
regulus79 Sep 4, 2024
a39be95
Add split marker to all clip types, and remove bar rounding on midi c…
regulus79 Sep 5, 2024
8f3955a
Do not populate notes as quantized in the new midi clips
regulus79 Sep 5, 2024
df5b49b
Change remove() to close() to fix undoing bug
regulus79 Sep 5, 2024
bf7d1f2
Remove spaces to fix code style
regulus79 Sep 7, 2024
6d13da1
Make splitClip() pure virtual
regulus79 Sep 22, 2024
19837bc
Remove whitespace
regulus79 Sep 22, 2024
f8b763c
Remove whitespace from PatternClipView
regulus79 Sep 22, 2024
7974445
Remove whitespace from AutomationClipView
regulus79 Sep 22, 2024
650b8b4
Remove whitespace from ClipView
regulus79 Sep 22, 2024
858330a
Initialize variables in AutomationClip's copy constructor
regulus79 Sep 22, 2024
e1269e7
Use remove() instead of close() to solve problem of midi clip playing…
regulus79 Sep 23, 2024
aa655ec
Fix automation clip behavior with out/in vals and tangents
regulus79 Sep 29, 2024
037497d
Simplify tangent setting code
regulus79 Oct 9, 2024
3c858b5
Allow resizing automation clips from the left and update splitting to…
regulus79 Oct 9, 2024
e8c25f0
Change offset from float to int
regulus79 Oct 9, 2024
6df2daf
Add/remove spacing around parentheses
regulus79 Nov 23, 2024
f0134ba
Change
regulus79 Nov 23, 2024
ccbb00d
Only automatically resize automation clips if the user has not resize…
regulus79 Nov 26, 2024
690f841
Make midi clips resizeable
regulus79 Jan 14, 2025
c7c4ff4
Cut off NotePlayHandles extending past end of clip
regulus79 Jan 14, 2025
599680a
Play notes overlapping with start
regulus79 Jan 15, 2025
bad83a0
Simplify code now that all clips are resizable
regulus79 Jan 15, 2025
959a99b
Add clip bounds overlay to piano roll and automation editor
regulus79 Jan 15, 2025
b0740b9
Merge branch 'master' into add-clip-splitting
regulus79 Jan 15, 2025
eb973df
Reset start offset when editing midi clip as pattern
regulus79 Jan 15, 2025
781beea
Update lambda syntax to c++20
regulus79 Jan 15, 2025
51007bd
Fix midi clip play length in piano roll to account for start offset
regulus79 Jan 16, 2025
4e20e2b
Fix merging midi clips to only merge visible notes
regulus79 Jan 16, 2025
cd895c3
Fix scrolling range in editors to account for start offset
regulus79 Jan 16, 2025
7eab22f
Limit PianoRoll playback to within clip bounds
regulus79 Jan 16, 2025
a86f509
Clamp pianoroll playhead position when opening editor
regulus79 Jan 17, 2025
aa725ad
Move mergeClips to MidiClipView
regulus79 Jan 17, 2025
49cc5f7
Add rightclick option to delete notes outside of clip bounds and rese…
regulus79 Jan 17, 2025
37dd961
Update icon
regulus79 Jan 18, 2025
2321726
Update editors when clip length changes
regulus79 Jan 18, 2025
9c08dee
Add explicit splitting via shift-knife
regulus79 Jan 19, 2025
92363ab
Update hints
regulus79 Jan 19, 2025
bcb3521
Add option to toggle auto resize, and tweak name of the other feature
regulus79 Jan 19, 2025
6b2ef42
Update hint depending on clip type
regulus79 Jan 19, 2025
9ebd3ff
Fix regression with midi clip splitting
regulus79 Jan 19, 2025
6a7d880
Update knife button tooltip
regulus79 Jan 20, 2025
5d3e35e
Add classic icon and change icon name
regulus79 Jan 20, 2025
3cdb590
Tweak classic icon
regulus79 Jan 20, 2025
38665bd
Change parameter name from splitExplicit to hardSplit
regulus79 Jan 20, 2025
bbfa4ac
Add option to toggle auto-resize in automation clips
regulus79 Jan 20, 2025
868b987
Add new icon for enabling/disabling auto-resize
regulus79 Jan 20, 2025
d3ca57b
Make hard-split midi clips hasBeenResized=true
regulus79 Jan 22, 2025
c969158
Add copy constructor to Clip, and use the copy constructor for all cl…
regulus79 Jan 23, 2025
e7faa8a
Reorder initialization
regulus79 Jan 24, 2025
bf23323
Generalize splitClip code in virtual function (and add Clip::clone), …
regulus79 Feb 2, 2025
43d2f18
Make clip copy constructors protected, and fix marker drawing if spli…
regulus79 Feb 2, 2025
1e7cfe7
Remove debug and fix formatting
regulus79 Feb 2, 2025
1be3077
Restore relative to start/end quantization, but have it combined with…
regulus79 Feb 4, 2025
85935c6
Fix marker line not disappearing after split
regulus79 Feb 5, 2025
abe7103
Make DetuningHelpers unique in Note constructors, and add copy constr…
regulus79 Feb 6, 2025
378c999
Remove sharedObject inheritance from InlineAutomation
regulus79 Feb 6, 2025
0658332
Make marker line consistant and themeable
regulus79 Feb 6, 2025
9c4308a
Change rgba to rgb
regulus79 Feb 6, 2025
278ee11
Rename hard splitting to destructive splitting, and clean up misc code
regulus79 Feb 6, 2025
93fb996
Fix midi clip hard splitting hasBeenResized
regulus79 Feb 6, 2025
16b2dad
Fix mistake
regulus79 Feb 6, 2025
0eac1ad
Fix empty clip size after destructive splitting
regulus79 Feb 8, 2025
3b98db5
Fix destructive split undo
regulus79 Feb 9, 2025
b3cd3d9
Merge branch 'master' into add-clip-splitting
regulus79 Feb 9, 2025
e3aaaab
Fix Style
regulus79 Feb 9, 2025
74b2afd
Update include/Clip.h
regulus79 Feb 9, 2025
0581e62
Change const TimePos & to const TimePos
regulus79 Feb 9, 2025
88a3d7b
Make splitClip not virtual, and make destructive splitting default to…
regulus79 Feb 9, 2025
212eaca
Fix hard splitting
regulus79 Feb 9, 2025
c5d3ec6
Merge branch 'master' into add-clip-splitting
regulus79 Feb 10, 2025
9bfa48b
Attempt to fix merge conflict again
regulus79 Feb 10, 2025
f865579
Make Note store its detuning as a unique_ptr
regulus79 Feb 10, 2025
76bae6b
Make InlineAutomation's AutomationClip std::unique_ptr
regulus79 Feb 10, 2025
716783e
Fix merging clips when the start/end of the note is outside clip bounds
regulus79 Feb 12, 2025
aa8041b
Simplify and clean up checks for notes partially out of bounds
regulus79 Feb 12, 2025
eb03363
Move variables out of for loop
regulus79 Feb 12, 2025
d9b5673
Make mergeClips resize resulting clip to extend from min/max of input…
regulus79 Feb 12, 2025
a1aa7e7
Fix SampleClip copy constructor
regulus79 Feb 13, 2025
870ce02
Make auto-resize toggle work with selections
regulus79 Feb 13, 2025
23f0c13
Fix bug with bulk toggle auto resize
regulus79 Feb 13, 2025
9475741
Quick fix undo for bulk toggle auto resize
regulus79 Feb 14, 2025
0d765d5
Refactor auto resize toggling to be simpler and support all clip type…
regulus79 Feb 14, 2025
eadd040
Fix bug with hard splitting when the left clip has start offset
regulus79 Feb 16, 2025
b925db1
Make right clip set hasBeenResized to true
regulus79 Feb 17, 2025
ea31c05
Fix notes being quantized in clearNotesOutOfBounds
regulus79 Feb 19, 2025
ef10305
Make automation clip auto-resize reset start offset
regulus79 Feb 28, 2025
e51b5f8
Merge branch 'master' into add-clip-splitting
regulus79 Mar 7, 2025
7c63007
Merge branch 'master' into add-clip-splitting
regulus79 Apr 18, 2025
b56391f
Fix Automation Clip FlipX (and make valueAt take the time realtive to…
regulus79 Apr 24, 2025
5bc9de8
Make Midi and Automation clips not resizable left past the start
regulus79 Apr 28, 2025
d37ca59
Rename get/setAutoResize to get/setResizable
regulus79 Apr 29, 2025
e3a06af
Rename hasBeenResized to autoResize
regulus79 Apr 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/AutomationClipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ protected slots:

QStaticText m_staticTextName;
void scaleTimemapToFit( float oldMin, float oldMax );
bool splitClip(const TimePos pos) override;
} ;


Expand Down
2 changes: 2 additions & 0 deletions include/MidiClipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ protected slots:
QStaticText m_staticTextName;

bool m_legacySEPattern;

bool splitClip(const TimePos pos) override;
} ;


Expand Down
2 changes: 2 additions & 0 deletions include/PatternClipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ protected slots:
QPixmap m_paintPixmap;

QStaticText m_staticTextName;

bool splitClip(const TimePos pos) override;
} ;


Expand Down
48 changes: 48 additions & 0 deletions src/gui/clips/AutomationClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,5 +486,53 @@ void AutomationClipView::scaleTimemapToFit( float oldMin, float oldMax )
m_clip->generateTangents();
}

//! Split this Clip.
/*! \param pos the position of the split, relative to the start of the clip */
bool AutomationClipView::splitClip(const TimePos pos)
{
setMarkerEnabled(false);

const TimePos splitPos = m_initialClipPos + pos;

//Don't split if we slid off the Clip or if we're on the clip's start/end
//Cutting at exactly the start/end position would create a zero length
//clip (bad), and a clip the same length as the original one (pointless).
if (splitPos <= m_initialClipPos || splitPos >= m_initialClipEnd) {return false;}

m_clip->getTrack()->addJournalCheckPoint();
m_clip->getTrack()->saveJournallingState(false);

auto rightClip = new AutomationClip(*m_clip);
auto leftClip = new AutomationClip(*m_clip);
rightClip->clear();
leftClip->clear();

for(auto it = m_clip->getTimeMap().begin(); it != m_clip->getTimeMap().end(); ++it)
{
if (POS(it) >= pos)
{
rightClip->putValues(POS(it) - pos, INVAL(it), OUTVAL(it), false);
}
else
{
leftClip->putValues(POS(it), INVAL(it), OUTVAL(it), false);
}
}
rightClip->putValue(0, m_clip->valueAt(pos));
leftClip->putValue(pos, m_clip->valueAt(pos));

leftClip->changeLength(splitPos - m_initialClipPos);

rightClip->movePosition(splitPos);
rightClip->changeLength(m_initialClipEnd - splitPos);

// For some reason, the new clips sometime randomly put themselves in record mode. This is a temportary fix which forces them to match the original clip.
rightClip->setRecording(m_clip->isRecording());
leftClip->setRecording(m_clip->isRecording());

m_clip->getTrack()->restoreJournallingState();
remove();
return true;
}

} // namespace lmms::gui
4 changes: 2 additions & 2 deletions src/gui/clips/ClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void ClipView::mousePressEvent( QMouseEvent * me )
setInitialPos( me->pos() );
setInitialOffsets();

if( m_clip->getAutoResize() )
if( m_clip->getAutoResize() && !knifeMode)
{ // Always move clips that can't be manually resized
m_action = Action::Move;
setCursor( Qt::SizeAllCursor );
Expand All @@ -680,7 +680,7 @@ void ClipView::mousePressEvent( QMouseEvent * me )
m_action = Action::ResizeLeft;
setCursor( Qt::SizeHorCursor );
}
else if( sClip && knifeMode )
else if(knifeMode)
{
m_action = Action::Split;
setCursor( m_cursorKnife );
Expand Down
51 changes: 51 additions & 0 deletions src/gui/clips/MidiClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,4 +675,55 @@ void MidiClipView::paintEvent( QPaintEvent * )
}


//! Split this Clip.
/*! \param pos the position of the split, relative to the start of the clip */
bool MidiClipView::splitClip(const TimePos pos)
{
// Currently, due to midi clips being required to be multiples of 1 bar in length, restrict the split pos to the nearest bar:
const TimePos rounded_pos = (pos + TimePos::ticksPerBar() / 2) - (pos + TimePos::ticksPerBar() / 2) % TimePos::ticksPerBar();
setMarkerEnabled( false );

const TimePos splitPos = m_initialClipPos + rounded_pos;

//Don't split if we slid off the Clip or if we're on the clip's start/end
//Cutting at exactly the start/end position would create a zero length
//clip (bad), and a clip the same length as the original one (pointless).
if (splitPos <= m_initialClipPos || splitPos >= m_initialClipEnd) {return false;}

m_clip->getTrack()->addJournalCheckPoint();
m_clip->getTrack()->saveJournallingState(false);

auto rightClip = new MidiClip(m_clip->instrumentTrack());
auto leftClip = new MidiClip(m_clip->instrumentTrack());

for (Note const * note : m_clip->m_notes)
{
if (note->pos() >= rounded_pos)
{
Note *moved_note = new Note(*note);
moved_note->setPos(note->pos() - rounded_pos);
rightClip->addNote(*moved_note);
}
}

for (Note const * note : m_clip->m_notes)
{
if (note->pos() < rounded_pos)
{
leftClip->addNote(*note);
}
}

leftClip->changeLength(splitPos - m_initialClipPos);

rightClip->movePosition(splitPos);
rightClip->changeLength(m_initialClipEnd - splitPos);

m_clip->getTrack()->restoreJournallingState();
remove();
return true;
}



} // namespace lmms::gui
27 changes: 27 additions & 0 deletions src/gui/clips/PatternClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,32 @@ void PatternClipView::update()
ClipView::update();
}

//! Split this Clip.
/*! \param pos the position of the split, relative to the start of the clip */
bool PatternClipView::splitClip(const TimePos pos)
{
setMarkerEnabled(false);

const TimePos splitPos = m_initialClipPos + pos;

//Don't split if we slid off the Clip or if we're on the clip's start/end
//Cutting at exactly the start/end position would create a zero length
//clip (bad), and a clip the same length as the original one (pointless).
if (splitPos <= m_initialClipPos || splitPos >= m_initialClipEnd) {return false;}

m_patternClip->getTrack()->addJournalCheckPoint();
m_patternClip->getTrack()->saveJournallingState(false);

auto rightClip = new PatternClip(m_patternClip->getTrack());

m_patternClip->changeLength(splitPos - m_initialClipPos);

rightClip->movePosition(splitPos);
rightClip->changeLength(m_initialClipEnd - splitPos);
rightClip->setStartTimeOffset(m_patternClip->startTimeOffset() - m_patternClip->length());

m_patternClip->getTrack()->restoreJournallingState();
return true;
}

} // namespace lmms::gui