this one should be compatible with the reaper.GetTrackStateChunk. returning ret and track_chunk. For easy updating current code that uses reaper.GetTrackStateChunk
Code:
function GetTrackChunk(track)
if not track then return end
-- Try standard function -----
local ret, track_chunk = reaper.GetTrackStateChunk(track, "", false) -- isundo = false
if ret and track_chunk and #track_chunk < 4194303 then return ret, track_chunk end
-- If chunk_size >= max_size, use wdl fast string --
local fast_str = reaper.SNM_CreateFastString("")
if reaper.SNM_GetSetObjectState(track, fast_str, false, false) then
track_chunk = reaper.SNM_GetFastString(fast_str)
end
reaper.SNM_DeleteFastString(fast_str)
if track_chunk then return true, track_chunk end
end