diff --git a/4PointCutting/4Pcut_execute.lua b/4PointCutting/4Pcut_execute.lua index f4b3c1d..e596635 100644 --- a/4PointCutting/4Pcut_execute.lua +++ b/4PointCutting/4Pcut_execute.lua @@ -5,6 +5,7 @@ -- Git: https://files.eleton-audio.de/gitea/Ludwig/Reaper-Scripts.git -- License: GPL v3.0 -- Requires: Reaper 5 or 6 +-- Requires: SWS extensions, if not present no crossfades are created. http://standingwaterstudios.com -- Requires: This script goes with several other scripts that work closely together. local stored_cursorPos = 0 @@ -23,7 +24,7 @@ local mark_dstin_id = -1 local mark_dstout_pos = -1 local mark_dstout_id = -1 local edit_mode = 0 -local waitcount = 0 +local sws_present = false -- edit modes: 0=not enough markers set; 1=src-in, src-out, dst-in; 2=src-in, src-out, dst-out; -- 3=src-in, dst-in, dst-out; 4=src-out, dst-in, dst-out; 5=all four markers set; @@ -75,6 +76,8 @@ function select_dst_track_only() end -- START HERE vvvvvvvvvvvvvvvvvvvvvvvvvv +-- check for SWS extensions +if reaper.NamedCommandLookup('_SWS_ABOUT') > 0 then sws_present = true end -- run through all markers and get position of the 4 points local nof_markers = 0 local nof_regions = 0 @@ -172,6 +175,12 @@ reaper.MoveEditCursor(mark_dstin_pos - reaper.GetCursorPosition(), false) select_dst_track_only() reaper.Main_OnCommand(40058, 0) -- paste item --reaper.Main_OnCommand( reaper.NamedCommandLookup('_SWS_AWPASTE'), 0 ) -- SWS Paste +-- Crossfade (only with SWS extensions, "fill gaps") +reaper.Main_OnCommand( 40290, 0 ) -- set time selection to selected items +reaper.Main_OnCommand( 40320, 0 ) -- nudge left edge of time selection left +reaper.Main_OnCommand( 40323, 0 ) -- nudge right edge of time selection right +reaper.Main_OnCommand( 40718, 0 ) -- select items on selected tracks and in time selection +reaper.Main_OnCommand( reaper.NamedCommandLookup('_SWS_AWFILLGAPSQUICKXFADE'), 0 ) -- fill gaps between selected items and crossfade -- Move dstin marker according to edit mode if edit_mode == 1 then reaper.SetProjectMarker(mark_dstin_id, false, mark_dstin_pos + (mark_srcout_pos - mark_srcin_pos), 0, 'DST-IN_4Pcut')