|
|
|
05-02-2021, 12:22 PM
|
#1
|
Human being with feelings
Join Date: Jan 2016
Location: Los Angeles, CA
Posts: 3,128
|
"Grab" nearest crossfade to mouse cursor?
REQ: Grab nearest crossfade to mouse cursor
Scenario: tracks/items can get very cluttered with all the different hotspots for the different mouse actions. It's often really finnicky to try and grab onto a crossfade when editing vocals for example that have a huge number of splits.
I envision holding a hotkey and left-clicking to "bring the nearest split/crossfade to the mouse cursor" rather than hunting for it and dragging it to where you want.
Result: immediate access to split/crossfade editing
|
|
|
10-23-2021, 09:24 AM
|
#2
|
Human being with feelings
Join Date: Mar 2019
Posts: 205
|
omg! definitely!
no such action? how do you guys grabbing that crossfade everytime?
if you have lots of splits this can take some time.
a yes from me =)
or maybe there is a workaround that we just don't know of? hmm...
Last edited by ArtemiHo; 10-23-2021 at 09:44 AM.
|
|
|
10-23-2021, 02:46 PM
|
#3
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Test if this is ok:
Code:
local x, y = reaper.GetMousePosition()
local item = reaper.GetItemFromPoint( x, y, true )
if not item then return reaper.defer(function() end ) end
local fade_in = reaper.GetMediaItemInfo_Value( item, "D_FADEINLEN_AUTO" )
local fade_out = reaper.GetMediaItemInfo_Value( item, "D_FADEOUTLEN_AUTO" )
local IN = fade_in ~= 0
local OUT = fade_out ~= 0
if not IN and not OUT then return reaper.defer(function() end ) end
local proj_pos = reaper.BR_PositionAtMouseCursor( false )
local item_id = reaper.GetMediaItemInfo_Value( item, "IP_ITEMNUMBER" )
local item_pos = reaper.GetMediaItemInfo_Value( item, "D_POSITION" )
local item_end = item_pos + reaper.GetMediaItemInfo_Value( item, "D_LENGTH" )
local track = reaper.GetMediaItemTrack( item )
local abs = math.abs
local function eq( n1, n2 )
return abs( n1 - n2 ) <= 0.000001
end
local move_xfadein, move_xfadeout
local prev_item, next_item
reaper.PreventUIRefresh( 1 )
if IN and OUT then
prev_item = reaper.GetTrackMediaItem( track, item_id-1 )
local xfade_in, xfade_out
if prev_item then
if eq( reaper.GetMediaItemInfo_Value( prev_item, "D_FADEOUTLEN_AUTO" ), fade_in) then
xfade_in = true
end
end
next_item = reaper.GetTrackMediaItem( track, item_id+1 )
if next_item then
if eq( reaper.GetMediaItemInfo_Value( next_item, "D_FADEINLEN_AUTO" ), fade_out) then
xfade_out = true
end
end
if not xfade_in and not xfade_out then return reaper.defer(function() end ) end
if xfade_in and xfade_out then
if proj_pos - item_pos < item_end - proj_pos then
move_xfadein = true
else
move_xfadeout = true
end
elseif xfade_in then
move_xfadein = true
elseif xfade_out then
move_xfadeout = true
end
elseif IN then
prev_item = reaper.GetTrackMediaItem( track, item_id-1 )
if prev_item then
if eq( reaper.GetMediaItemInfo_Value( prev_item, "D_FADEOUTLEN_AUTO" ), fade_in) then
move_xfadein = true
end
end
elseif OUT then
next_item = reaper.GetTrackMediaItem( track, item_id+1 )
if next_item then
if eq( reaper.GetMediaItemInfo_Value( next_item, "D_FADEINLEN_AUTO" ), fade_out) then
move_xfadeout = true
end
end
end
if move_xfadein then
reaper.BR_SetItemEdges( item, proj_pos - fade_in/2, item_end )
local prev_item_pos = reaper.GetMediaItemInfo_Value( prev_item, "D_POSITION" )
local prev_item_end = prev_item_pos + reaper.GetMediaItemInfo_Value( prev_item, "D_LENGTH" )
reaper.BR_SetItemEdges( prev_item, prev_item_pos, proj_pos + fade_in/2 )
end
if move_xfadeout then
reaper.BR_SetItemEdges( item, item_pos, proj_pos + fade_out/2 )
local next_item_pos = reaper.GetMediaItemInfo_Value( next_item, "D_POSITION" )
local next_item_end = next_item_pos + reaper.GetMediaItemInfo_Value(next_item, "D_LENGTH" )
reaper.BR_SetItemEdges( next_item, proj_pos - fade_out/2, next_item_end )
end
reaper.PreventUIRefresh( -1 )
reaper.UpdateArrange()
reaper.Undo_OnStateChange( "Move closest xfade to mouse cursor" )
|
|
|
10-24-2021, 12:27 AM
|
#4
|
Human being with feelings
Join Date: Mar 2019
Posts: 205
|
Hey amagalma.
Thanks a lot for this amazing script, it works! Really appreciate this.
The only thing that I've noticed is that when I hold the action key and move the slider it seem to wobble all the text above, it seem to happen because the action performs continuously through out my pressing =)
|
|
|
10-24-2021, 01:15 AM
|
#5
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I could make it so that it creates an undo point only after you stopped pressing the key, but this will require JS_ReascriptAPI and some more work...
However, do you really need to keep pressing the key? You can always press just once after placing the mouse at the position you want the x-fade to be moved. Also, you don't need to place your mouse above or very near the x-fade! The script will move the closest x-fade at the mouse position. Look:
|
|
|
10-24-2021, 01:49 AM
|
#6
|
Human being with feelings
Join Date: Mar 2019
Posts: 205
|
Quote:
Originally Posted by amagalma
I could make it so that it creates an undo point only after you stopped pressing the key, but this will require JS_ReascriptAPI and some more work...
However, do you really need to keep pressing the key? You can always press just once after placing the mouse at the position you want the x-fade to be moved. Also, you don't need to place your mouse above or very near the x-fade! The script will move the closest x-fade at the mouse position. Look:
|
yes that will work also
gotta check out this scipt with the real project now, thanks again
just yesterday I was searching in the Reapack and couldn't find any appropriate script for this. =)
|
|
|
10-24-2021, 01:02 PM
|
#7
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
amagalma_Move closest crossfade to mouse cursor
# Moves the closest cross-fade to the mouse position
- Only one undo point is created after key shortcut is released
- Requires JS_ReaScriptAPI
in ReaPack
|
|
|
10-24-2021, 11:40 PM
|
#8
|
Human being with feelings
Join Date: Jun 2020
Posts: 666
|
Quote:
Originally Posted by amagalma
amagalma_Move closest crossfade to mouse cursor
# Moves the closest cross-fade to the mouse position
- Only one undo point is created after key shortcut is released
- Requires JS_ReaScriptAPI
in ReaPack
|
Thanks for this!
|
|
|
10-25-2021, 12:20 AM
|
#9
|
Human being with feelings
Join Date: Mar 2019
Posts: 205
|
Quote:
Originally Posted by amagalma
amagalma_Move closest crossfade to mouse cursor
# Moves the closest cross-fade to the mouse position
- Only one undo point is created after key shortcut is released
- Requires JS_ReaScriptAPI
in ReaPack
|
сan't see it in the ReaPack though..
is it possible to edit the takes split points with this script?
or it's totally different from the crossfade?
Last edited by ArtemiHo; 10-25-2021 at 05:13 AM.
|
|
|
05-10-2022, 11:35 AM
|
#10
|
Human being with feelings
Join Date: Oct 2016
Posts: 35
|
Hello!
Amazing script! Helps a lot on cleaning up bad crossfades when grid aligning items.
Is there any way this behavior could also affect grouped items?
I tried using it on grouped items and it only applies on the item under the mouse cursor.
Thank you!
|
|
|
03-13-2024, 11:27 AM
|
#11
|
Human being with feelings
Join Date: Sep 2023
Location: Spain
Posts: 45
|
hey amagalma!
thank you so much for not just this script but all of your scripts and contributions to the reaper community!
I recently came across this script and started using it and it's already become essential to my workflow when editing vocals or other "one-track" instruments. However, I now used your script on a drum group of multiple tracks, and even though group editing is enabled your script does not obey the group editing and will only move that single crossfade that is under the mouse.
So I had a glimpse at the code and even though I know a little bit about coding (mainly C/C++) and have been looking and modifying a couple of lua/eel scripts before your script is way beyond my scope and much of it is a mystery to me haha :-D
So my polite question is: Would you be willing and able to upgrade your script to obey track group editing? If so, I would definitely be willing to donate something for your time and efforts.
So, basically the same that @pane.valentin is asking :-D
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:26 AM.
|