Skip to content

Commit

Permalink
Take Counter should use only when REAPER is greater than v7.28
Browse files Browse the repository at this point in the history
  • Loading branch information
chmaha committed Jan 3, 2025
1 parent 8a74ee5 commit eab7e35
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions ReaClassical/ReaClassical_Take Counter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,26 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
for key in pairs(reaper) do _G[key] = reaper[key] end

local main, get_take_count, clean_up, parse_time, parse_duration, check_time, remove_markers_by_name
local seconds_to_hhmm, find_first_rec_enabled_parent, draw
local seconds_to_hhmm, find_first_rec_enabled_parent, draw, get_reaper_version

local SWS_exists = APIExists("CF_GetSWSVersion")
if not SWS_exists then
MB('Please install SWS/S&M extension before running this function', 'Error: Missing Extension', 0)
return
end

---------------------------------------------------------------------

function get_reaper_version()
local version_str = GetAppVersion()
local version = version_str:match("^(%d+%.%d+)")
return tonumber(version)
end

---------------------------------------------------------------------

local reaper_ver = get_reaper_version()

local iterated_filenames = false
local added_take_number = false
local rec_name_set = false
Expand Down Expand Up @@ -267,8 +279,13 @@ function main()

if not rec_name_set then
local padded_take_text = string.format("%03d", tonumber(take_text))
SNM_SetStringConfigVar("recfile_wildcards", session_dir .. session_suffix
.. "$tracknameornumber_T" .. padded_take_text)
if reaper_ver > 7.28 then
SNM_SetStringConfigVar("recfile_wildcards", session_dir .. session_suffix
.. "$tracknameornumber_T" .. padded_take_text)
else
SNM_SetStringConfigVar("recfile_wildcards", session_dir .. session_suffix
.. "$track_T" .. padded_take_text)
end
rec_name_set = true
end

Expand Down

0 comments on commit eab7e35

Please sign in to comment.