preset_tracks = {}
control_tracks = {}
counttrack = reaper.CountTracks(0)
if counttrack ~= nil then
for i=1, counttrack do
tr = reaper.GetTrack(0,i-1)
if tr ~= nil then
_, tr_name = reaper.GetSetMediaTrackInfo_String(tr, 'P_NAME', '', false)
if tr_name:match("%u%u%u%d%d_P1") then table.insert(preset_tracks, i) end
-- if tr_name:match("%u%u%u%d%d_P2") then table.insert(preset_tracks, i) end
if tr_name:match("%u%u%u%d%d_Control") then table.insert(control_tracks, i) end
end
end
end
reaper.ShowConsoleMsg(table.concat(preset_tracks, '\n'))
reaper.ShowConsoleMsg("\n\n")
reaper.ShowConsoleMsg(table.concat(control_tracks, '\n'))
reaper.ShowConsoleMsg("\n\n")
if preset_tracks ~= nil then
for n = 1, #preset_tracks do
tr = reaper.GetTrack(0, preset_tracks[n]-1)
if tr ~= nil then
vol = reaper.GetMediaTrackInfo_Value(tr, 'D_VOL')
reaper.SetMediaTrackInfo_Value(tr, "D_VOL", vol*0.3)
end
end
end
if control_tracks ~= nil then
for n = 1, #control_tracks do
tr = reaper.GetTrack(0, control_tracks[n]-1)
if tr ~= nil then
vol = reaper.GetMediaTrackInfo_Value(tr, 'D_VOL')
reaper.SetMediaTrackInfo_Value(tr, "D_VOL", vol/0.3)
end
end
end