diff --git a/ReaClassical/ReaClassical_Classical Take Record.lua b/ReaClassical/ReaClassical_Classical Take Record.lua index 418bf30e..6ae97d86 100644 --- a/ReaClassical/ReaClassical_Classical Take Record.lua +++ b/ReaClassical/ReaClassical_Classical Take Record.lua @@ -121,6 +121,12 @@ function main() end end + --group last recorded items + Main_OnCommand(40032, 0) + --save recorded item guid + local recorded_item = GetSelectedMediaItem(0,0) + local recorded_item_guid = BR_GetMediaItemGUID(recorded_item) + SetProjExtState(0, "ReaClassical", "LastRecordedItem", recorded_item_guid) Main_OnCommand(40289, 0) -- Unselect all items if workflow == "Vertical" then diff --git a/ReaClassical/ReaClassical_Rank Higher.lua b/ReaClassical/ReaClassical_Rank Higher.lua index cf2a6d0d..98a5787d 100644 --- a/ReaClassical/ReaClassical_Rank Higher.lua +++ b/ReaClassical/ReaClassical_Rank Higher.lua @@ -75,7 +75,7 @@ function modify_item_name(item) return colors.rank_good end, [0] = function() - return 0 -- Default color + return 0 -- Default color end, [-1] = function() return colors.rank_below_average @@ -116,12 +116,13 @@ function process_items() modify_item_name(item) end else - local track = GetTrack(0, 0) - if track then - local item_count = CountTrackMediaItems(track) - if item_count > 0 then - local last_item = GetTrackMediaItem(track, item_count - 1) - modify_item_name(last_item) + local _, recorded_item_guid = GetProjExtState(0, "ReaClassical", "LastRecordedItem") + if recorded_item_guid ~= "" then + local recorded_item = BR_GetMediaItemByGUID(0, recorded_item_guid) + if recorded_item then + modify_item_name(recorded_item) + else + MB("The previously recorded item no longer exists.", "ReaClassical Take Ranking", 0) end end end diff --git a/ReaClassical/ReaClassical_Rank Lower.lua b/ReaClassical/ReaClassical_Rank Lower.lua index e566d479..29bada2f 100644 --- a/ReaClassical/ReaClassical_Rank Lower.lua +++ b/ReaClassical/ReaClassical_Rank Lower.lua @@ -119,12 +119,13 @@ function process_items() modify_item_name(item) end else - local track = GetTrack(0, 0) - if track then - local item_count = CountTrackMediaItems(track) - if item_count > 0 then - local last_item = GetTrackMediaItem(track, item_count - 1) - modify_item_name(last_item) + local _, recorded_item_guid = GetProjExtState(0, "ReaClassical", "LastRecordedItem") + if recorded_item_guid ~= "" then + local recorded_item = BR_GetMediaItemByGUID(0, recorded_item_guid) + if recorded_item then + modify_item_name(recorded_item) + else + MB("The previously recorded item no longer exists.", "ReaClassical Take Ranking", 0) end end end diff --git a/ReaClassical/ReaClassical_Remove Ranking.lua b/ReaClassical/ReaClassical_Remove Ranking.lua index 78583b7e..435cc13a 100644 --- a/ReaClassical/ReaClassical_Remove Ranking.lua +++ b/ReaClassical/ReaClassical_Remove Ranking.lua @@ -76,13 +76,13 @@ function process_items() modify_item_name(item) end else - -- No items selected, process the last item on track 1 - local track = reaper.GetTrack(0, 0) -- Get track 1 - if track then - local item_count = reaper.CountTrackMediaItems(track) - if item_count > 0 then - local last_item = reaper.GetTrackMediaItem(track, item_count - 1) - modify_item_name(last_item) + local _, recorded_item_guid = GetProjExtState(0, "ReaClassical", "LastRecordedItem") + if recorded_item_guid ~= "" then + local recorded_item = BR_GetMediaItemByGUID(0, recorded_item_guid) + if recorded_item then + modify_item_name(recorded_item) + else + MB("The previously recorded item no longer exists.", "ReaClassical Take Ranking", 0) end end end diff --git a/ReaClassical/ReaClassical_Take Counter.lua b/ReaClassical/ReaClassical_Take Counter.lua index 00dab13e..f2de691e 100644 --- a/ReaClassical/ReaClassical_Take Counter.lua +++ b/ReaClassical/ReaClassical_Take Counter.lua @@ -110,9 +110,9 @@ local start_time, end_time, duration local run_once = false local F9_command = NamedCommandLookup("_RS25887d941a72868731ba67ccb1abcbacb587e006") -local auto_group = NamedCommandLookup("_SWS_AWAUTOGROUPTOG") -local auto_group_state = GetToggleCommandState(auto_group) -if auto_group_state ~= 1 then Main_OnCommand(auto_group, 0) end +-- local auto_group = NamedCommandLookup("_SWS_AWAUTOGROUPTOG") +-- local auto_group_state = GetToggleCommandState(auto_group) +-- if auto_group_state ~= 1 then Main_OnCommand(auto_group, 0) end ---------------------------------------------------------------------