-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix length of non-beat clips in the pattern editor #8369
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
91f4c57
8c8c474
de71521
988d6ac
d74cf31
07e9a1e
552da11
8558b62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,6 +221,13 @@ void PatternEditor::updateMaxSteps() | |
| auto mClip = static_cast<MidiClip*>(track->getClip(m_ps->currentPattern())); | ||
| m_maxClipLength = std::max(m_maxClipLength, static_cast<tick_t>(mClip->length())); | ||
| } | ||
| else | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Cursed, cursed, cursed! @messmerd is it a safe assumption that this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I completely missed the fact that there were so many types of tracks 😅 (What even is a Video or Count track?) I guess it would indeed do no harm to be explicit here, as we only only resize Sample and Automation clips for visual purposes (and all these other types, even if they happened to be present in the pattern store, are never displayed anyway).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, maybe an
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could also use a switch statement: switch (track->type())
{
case Track::Type::Instrument:
{
auto mClip = static_cast<MidiClip*>(track->getClip(m_ps->currentPattern()));
m_maxClipLength = std::max(m_maxClipLength, static_cast<tick_t>(mClip->length()));
break;
}
case Track::Type::Sample: [[fallthrough]];
case Track::Type::Automation:
{
auto clip = track->getClip(m_ps->currentPattern());
clip->updateLength();
break;
}
default:
assert(false);
break;
}
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well... actually yes... I'm a little embarrassed by my self from 2 weeks ago. (I believe I somehow thought that it had an impact on the pattern length ?!) (Edit: I fact my past me just left this block as it was previously, which is pretty reasonable) |
||
| { | ||
| // The length of automation and sample clips is updated here. | ||
| // "Why here ?" will you ask. The answer is: Because. | ||
| auto clip = track->getClip(m_ps->currentPattern()); | ||
| clip->updateLength(); | ||
| } | ||
| } | ||
| updatePixelsPerBar(); | ||
| } | ||
|
|
||
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.
Clipalready stores aTrack, and has a getter calledgetTrack().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.
That's the first thing I should have checked. Thank you for pointing it out.