View Single Post
Old 01-22-2018, 02:33 AM   #20
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,300
Default

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
__________________
HeDaScripts for REAPER

Last edited by heda; 01-22-2018 at 04:04 AM.
heda is offline   Reply With Quote