-
Notifications
You must be signed in to change notification settings - Fork 693
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
add fade_in_length() and fade_out_length() methods to audioregion #592
base: master
Are you sure you want to change the base?
Conversation
…give access to theses values from Lua script. Give a script example that makes a new playlist in selected tracks with only audible regions.
mmmh, all things considered I probably made a mistake. |
yes, these methods should return samplecnt_t not double |
Ok that is done. Maybe you will prefer that the script only clear the playlist of selected regions, and this action could be undo. |
I was going to rebase + merge this, but there's a merge conflict even after fixing the rebase conflict. If you don't mind fixing that up against master, I'll be happy to merge it. |
conflict fixed ! |
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.
NIce very elaborate example script too!
Few comments inline
samplecnt_t | ||
AudioRegion::fade_in_length () | ||
{ | ||
samplecnt_t fade_in_length = (samplecnt_t) _fade_in->when(false); |
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.
Why use a temporary variable instead of return _fade_in->when(false)
?
ControlList::when (false) returns the position of the last point, which is only the length if ControlList::when(true) == 0
.
Either name the function fade_in_end_position()
, or subtract _fader_in->when(true)
.
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.
Why use a temporary variable instead of return _fade_in->when(false)?
TBH, I can't remember, indeed it's useless.
I didn't know it is possible that fade in could start before or after the region start. Is it really possible ? I don't see how to do it in the GUI. The script doesn't manage this possibility.
AudioRegion::fade_out_length () | ||
{ | ||
samplecnt_t fade_out_length = (samplecnt_t) _fade_out->when(false); | ||
return fade_out_length; |
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.
see above comment for AudioRegion::fade_in_length()
-- s : A___________D | ||
|
||
-- worst case, compared region rg is above r, | ||
-- rg starts after and finish before r. |
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.
whitespace (should use tabs for indent)
if ra:fade_in_active() then | ||
r_no_cut_before = r_front + ra:fade_in_length() + 64 | ||
end | ||
|
||
if ra:fade_out_active() then | ||
r_no_cut_after = r_end - ra:fade_out_length() - 64 | ||
end |
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 happens if the region is shorter than 128 samples?
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.
regions shorter than 128 samples are not copied to the new playlist, because an isolated region with a such length could only be noise. But at this point of the script we just check from when we could cut the compared regions.
Any plans to polish this up for use in 7.0? |
Hi.
This has been discussed with Robin on IRC, this PR adds fade_in_length() and fade_out_length() methods to audioregion.
The goal is to give access to theses values from a Lua script.
I also give a script that makes a new playlist in selected tracks with only audible regions. That means it cuts or removes regions if they are below other ones (except during their fade of course). The new playlist is named track_name.MAIN because I attempt to do another script to copy selected regions to the track_name.MAIN playlist.
The idea came making music, with many takes on a guitar track playlist, and always have to move many regions to get a silence at a moment. This script allows to have a very clean playlist easier to edit with exactly the same audible contents.
The script has no undo method because I didn't find any way to remove a playlist.
Cheers.