I found this:
https://github.com/MichaelPilyavskiy...ackground).lua
It looks as though I could borrow a couple of methods from here and it should work, but no joy (runs OK but doesn't seem to do anything)
Is there some further documentation on how to use SetTrackStateChunk to do this sort of thing?
function ShowChildrenInMCP(tr, is_show, return_state)
local tr_chunk = eugen27771_GetTrackStateChunk(tr)
local BUSCOMP_var1 = tonumber(tr_chunk:match('BUSCOMP (%d+)'))
local BUSCOMP_var2 = tonumber(tr_chunk:match('BUSCOMP %d+ (%d+)'))
if return_state then return BUSCOMP_var2==0 end
local tr_chunk_out = tr_chunk:gsub('BUSCOMP '..BUSCOMP_var1..' %d+', 'BUSCOMP '..BUSCOMP_var1..' '..(is_show and 0 or 1))
if BUSCOMP_var2 ~= (is_show and 0 or 1) then reaper.SetTrackStateChunk(tr, tr_chunk_out,true) end
end
function eugen27771_GetTrackStateChunk(track)
if not track then return end
local fast_str, track_chunk
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)
return track_chunk
end
Edit: it's working, just had to understand the method sig of ShowChildrenInMCP properly