script_title = "pitch mouswheel"
local _,_,_,_,_,_,val = reaper.get_action_context()
local count = reaper.CountSelectedMediaItems()
function Pitch()
if val > 0 then
reaper.PreventUIRefresh(1)
for i = 0, count-1 do
count = reaper.CountSelectedMediaItems()
selitem = reaper.GetSelectedMediaItem(0,i)
take = reaper.GetActiveTake(selitem)
pitch = reaper.GetMediaItemTakeInfo_Value(take, 'D_PITCH' )
reaper.SetMediaItemTakeInfo_Value(take, 'D_PITCH', pitch+1)
reaper.UpdateItemInProject(selitem)
end
reaper.PreventUIRefresh(-1)
end
if val < 0 then
reaper.PreventUIRefresh(1)
for i = 0, count-1 do
count = reaper.CountSelectedMediaItems()
selitem = reaper.GetSelectedMediaItem(0,i)
take = reaper.GetActiveTake(selitem)
pitch = reaper.GetMediaItemTakeInfo_Value(take, 'D_PITCH' )
reaper.SetMediaItemTakeInfo_Value(take, 'D_PITCH', pitch-1)
reaper.UpdateItemInProject(selitem)
end
reaper.PreventUIRefresh(-1)
end
end
reaper.defer(Pitch)