--============== FUNCTION MODULE FUNCTION ========================= FUNCTION MODULE FUNCTION ============== FUNCTION MODULE FUNCTION ==============
local Fun,Load,Arc = reaper.GetResourcePath()..'/Scripts/Archie-ReaScripts/Functions'; Load,Arc = pcall(dofile,Fun..'/Arc_Function_lua.lua');--====
if not Load then reaper.RecursiveCreateDirectory(Fun,0);reaper.MB('Missing file / Отсутствует файл !\n\n'..Fun..'/Arc_Function_lua.lua',"Error",0);
return end; if not Arc.VersionArc_Function_lua("2.3.9",Fun,"")then Arc.no_undo() return end;--=====================================================
--============== FUNCTION MODULE FUNCTION ======▲=▲=▲============== FUNCTION MODULE FUNCTION ============== FUNCTION MODULE FUNCTION ==============
local Api_js,version = Arc.js_ReaScriptAPI(true,0.986);
if not Api_js then Arc.no_undo()return end;
local function Scroll(pos);
local trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(),1000);
local _,position,pageSize,min,max,trackPos=reaper.JS_Window_GetScrollInfo(trackview,"SB_HORZ");
local track = reaper.GetTrack(0,0);
local MIDIIt = reaper.CreateNewMIDIItemInProj(track,pos*2,pos*2+1,false);
reaper.DeleteTrackMediaItem(track,MIDIIt)
reaper.JS_Window_SetScrollPos(trackview,"SB_HORZ",pos);
end;
local midieditor = reaper.MIDIEditor_GetActive();
if midieditor then;
local Toggle = reaper.GetToggleCommandStateEx(32060,40750);
if Toggle ~= 1 then;
reaper.MIDIEditor_OnCommand(midieditor,40750);
end;
local Play = reaper.GetPlayPosition();
local Zoom = reaper.GetHZoomLevel();
local pos = math.floor((Play*Zoom),0.5);
Scroll(pos);
end;
Arc.SetToggleButtonOnOff(1);
hash=nil
local function loop();
local midieditor = reaper.MIDIEditor_GetActive();
if midieditor then;
local Take = reaper.MIDIEditor_GetTake(midieditor);
local Track = reaper.GetMediaItemTake_Track(Take);
local retval, hash2 = reaper.MIDI_GetTrackHash(Track,true,"");
if not hash then hash = hash2 end;
if hash2 ~= hash then;
local Toggle = reaper.GetToggleCommandStateEx(32060,40750);
if Toggle == 1 then;
reaper.MIDIEditor_OnCommand(midieditor,40750);
Arc.SetToggleButtonOnOff(0);
return;
end;
end;
else;
-- Arc.SetToggleButtonOnOff(0);
-- return;
end;
--t=(t or 0)+1
reaper.defer(loop);
end;
loop();
reaper.atexit(Arc.SetToggleButtonOnOff);