|
|
@ -129,6 +129,9 @@ elseif (edit_mode == 1 or edit_mode == 2 or edit_mode == 5) and (mark_srcin_pos |
|
|
|
elseif (edit_mode == 3 or edit_mode == 4 or edit_mode == 5) and (mark_dstin_pos >= mark_dstout_pos) then |
|
|
|
msg('DST-IN Marker must be set left of DST-OUT marker! Aborting.') |
|
|
|
return |
|
|
|
elseif not sws_present then |
|
|
|
msg('SWS extensions are not installed but needed! Aborting.') |
|
|
|
return |
|
|
|
end |
|
|
|
|
|
|
|
-- Do stuff before actual edits... |
|
|
@ -178,22 +181,21 @@ reaper.GoToMarker(0, mark_dstin_id, 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") |
|
|
|
if sws_present then |
|
|
|
-- select track with selected items |
|
|
|
local selected_items_count = reaper.CountSelectedMediaItems(0) |
|
|
|
for i = 0, selected_items_count - 1 do |
|
|
|
local item = reaper.GetSelectedMediaItem(0, i) |
|
|
|
local track = reaper.GetMediaItem_Track(item) |
|
|
|
reaper.SetTrackSelected(track, true) |
|
|
|
end |
|
|
|
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_CROSSFADE'), 0 ) -- fill gaps between selected items and crossfade |
|
|
|
|
|
|
|
-- Crossfade |
|
|
|
local selected_items_count = reaper.CountSelectedMediaItems(0) |
|
|
|
for i = 0, selected_items_count - 1 do -- select tracks with selected items... |
|
|
|
local item = reaper.GetSelectedMediaItem(0, i) |
|
|
|
local track = reaper.GetMediaItem_Track(item) |
|
|
|
reaper.SetTrackSelected(track, true) |
|
|
|
end |
|
|
|
-- Move dstin marker according to edit mode |
|
|
|
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_CROSSFADE'), 0 ) -- Crossfade adjacent selected items |
|
|
|
|
|
|
|
-- 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') |
|
|
|
elseif edit_mode == 2 then |
|
|
|