Old 05-23-2018, 05:01 AM   #1
Zirrex
Human being with feelings
 
Join Date: Jul 2017
Location: Russia
Posts: 75
Default Midi Editor: Auto zoom

Hi.

1. One track.
2. One midi Item.
3. 2x mouse click to Item.
4. This item opens in the midi editor.
5. NOW WE HAVE THIS ZOOM - https://i.imgur.com/L4ClNUG.png
6*. WILL BE GREAT TO HAVE THIS ZOOM - https://i.imgur.com/Wf7WNTt.png

* It is displayed in the center of the screen. Left and right two empty bars. The notes are vertically centered. Above and below the ground is 1 octave.

P.S. if I choose another item (one click), it also opens in the center.

Thank tou! :-)

Last edited by Zirrex; 05-23-2018 at 05:18 AM.
Zirrex is offline   Reply With Quote
Old 05-23-2018, 05:34 AM   #2
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 24,790
Default

Which MIDI editor timebase are you using?


Also, MIDI editor zoom/scroll improvements are coming in v5.90... any day now.
EvilDragon is online now   Reply With Quote
Old 05-23-2018, 07:23 AM   #3
Zirrex
Human being with feelings
 
Join Date: Jul 2017
Location: Russia
Posts: 75
Default

Quote:
Originally Posted by EvilDragon View Post
Which MIDI editor timebase are you using?
Also, MIDI editor zoom/scroll improvements are coming in v5.90... any day now.
I tried different settings, but the result does not change.
https://i.imgur.com/WBMpeX9.png

p.s. now I have Reaper 5.90rc9
Zirrex is offline   Reply With Quote
Old 05-23-2018, 10:42 AM   #4
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 24,790
Default

Hm, it centers the item in MIDI editor over here when I double-click on it. I'm using one MIDI editor per project, project beats timebase, and MIDI editor docked on second display...
EvilDragon is online now   Reply With Quote
Old 05-23-2018, 03:47 PM   #5
Zirrex
Human being with feelings
 
Join Date: Jul 2017
Location: Russia
Posts: 75
Default

Yes. I have the same settings.
Now Midi Editor docked on second display.

When I click the second time, it is already opened in the center, but stretched completely on the horizontal - https://i.imgur.com/zusGSqI.png
But there is no free space on top.
I wish it would open like this - https://i.imgur.com/Zyt3Lbl.png
Or like this - https://i.imgur.com/QCiEQfC.png
Zirrex is offline   Reply With Quote
Old 05-23-2018, 11:33 PM   #6
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 24,790
Default

That doesn't seem to happen over here...
EvilDragon is online now   Reply With Quote
Old 11-25-2019, 10:49 AM   #7
vsgrt
Human being with feelings
 
Join Date: May 2017
Posts: 186
Default

Bumping this. Any solutions?
vsgrt is offline   Reply With Quote
Old 03-07-2020, 04:18 PM   #8
Denys
Human being with feelings
 
Denys's Avatar
 
Join Date: Jan 2011
Location: Tokyo
Posts: 319
Default

Hi, I use the action "Zoom to Content" but if it was possible to do this automatically whenever the MIDI Editor window is opened, it would be awesome. Does anyone know a workaround?
__________________
Katabui Original Soundtrack
Denys is offline   Reply With Quote
Old 03-07-2020, 05:42 PM   #9
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by Denys View Post
Hi, I use the action "Zoom to Content" but if it was possible to do this automatically whenever the MIDI Editor window is opened, it would be awesome. Does anyone know a workaround?
I double click midi items in arrangeview to open in ME so trick I use is to set the 'Media item bottom half' 'double-click' mouse modifier to a Lua script. There may be other modifiers you can use though I never tried.

I like the zoom to content idea, so made this lua script,..

Code:
-- Open midi editor and zoom to content
-- Usage: Set mouse modifier [Media item bottom half] [Double Click] > Default/keys > Action list > this script.

function Main()
  local item = reaper.GetSelectedMediaItem(0,0)
  if item == nil then return end
  local take = reaper.GetActiveTake(item)
  if take == nil then return end -- FIX
  if not reaper.TakeIsMIDI(take) then
    -- Optional: do something else here.
    return -- exit
  end  
  
  pass = pass -1  -- requires a delay between actions!
  if pass < 0 then
    pass = 2
    action_index = action_index -1 -- counter/which action to run next
    if action_index == 1 then -- run first action
      reaper.Main_OnCommand(40153, 0) -- Item: Open in built-in MIDI editor
    elseif action_index == 0 then  -- run second action
      reaper.MIDIEditor_OnCommand(reaper.MIDIEditor_GetActive(), 40466) -- View: Zoom to content
    else  -- We're done, exit!
      return
    end  
  end
  reaper.defer(Main)
end

pass = 0
action_index = 2 -- # of actions to run
Main()
EDIT: FIX, would crash if you clicked an Empty item, Added, if take == nil then return end

Last edited by Edgemeal; 03-30-2020 at 04:50 PM. Reason: FIX bug for Empty Items
Edgemeal is offline   Reply With Quote
Old 03-08-2020, 05:48 PM   #10
Denys
Human being with feelings
 
Denys's Avatar
 
Join Date: Jan 2011
Location: Tokyo
Posts: 319
Default

Hey Edgemeal, that works flawlessly, thank you very much!
__________________
Katabui Original Soundtrack
Denys is offline   Reply With Quote
Old 03-09-2020, 01:02 PM   #11
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Glad it helps. You can also have the script do something else when the item is a non-MIDI item.

For example, toggle track zoom, just replace this part,
Code:
  if take == nil then return end
  if not reaper.TakeIsMIDI(take) then
    -- Optional: do something else here.
    return -- exit
  end
with this,
Code:
  if take == nil then return end
  if not reaper.TakeIsMIDI(take) then
    reaper.Main_OnCommand(40113, 0) -- View: Toggle track zoom to maximum height  
    return -- exit
  end
2 birds 1 stone.

EDIT: Fix for Empty Items,.. if take == nil then return end

Last edited by Edgemeal; 03-30-2020 at 04:52 PM.
Edgemeal is offline   Reply With Quote
Old 03-11-2020, 05:01 AM   #12
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Wow! It's very nice, thank you. How can I add this type of action? _RSa31cc4069db13d6ff5851612db10e9ec2ef54e2f
Skorobagatko is offline   Reply With Quote
Old 03-11-2020, 10:56 AM   #13
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

For Custom, SWS, etc, actions you need to use NamedCommandLookup,..

Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup('_RSa31cc4069db13d6ff5851612db10e9ec2ef54e2f'), 0) -- launch custom script:
Edgemeal is offline   Reply With Quote
Old 03-11-2020, 12:03 PM   #14
pandabot
Human being with feelings
 
pandabot's Avatar
 
Join Date: Oct 2018
Posts: 367
Default

I've got some similar scripts to make the midi editor behave

https://github.com/benjohnson2001/Re...rFunctions.lua
https://github.com/benjohnson2001/Re...orObserver.lua
pandabot is offline   Reply With Quote
Old 03-11-2020, 01:49 PM   #15
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Edgemeal View Post
For Custom, SWS, etc, actions you need to use NamedCommandLookup,..

Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup('_RSa31cc4069db13d6ff5851612db10e9ec2ef54e2f'), 0) -- launch custom script:
Thank you!

Quote:
Originally Posted by pandabot View Post
How to install it? I'm confused with this: local workingDirectory = reaper.GetResourcePath() .. "/Scripts/ReactivePanda/src"
Skorobagatko is offline   Reply With Quote
Old 03-17-2020, 09:27 AM   #16
pandabot
Human being with feelings
 
pandabot's Avatar
 
Join Date: Oct 2018
Posts: 367
Default

Those midi editor functions are used in the ReactivePanda action that runs whenever Reaper starts up (using the "SWS/S&M: Set global startup action")
pandabot is offline   Reply With Quote
Old 06-01-2020, 02:04 AM   #17
Mrmot
Human being with feelings
 
Join Date: Apr 2008
Location: Philippines
Posts: 34
Default

Quote:
Originally Posted by Edgemeal View Post
I double click midi items in arrangeview to open in ME so trick I use is to set the 'Media item bottom half' 'double-click' mouse modifier to a Lua script. There may be other modifiers you can use though I never tried.

I like the zoom to content idea, so made this lua script,..

Code:
-- Open midi editor and zoom to content
-- Usage: Set mouse modifier [Media item bottom half] [Double Click] > Default/keys > Action list > this script.

function Main()
  local item = reaper.GetSelectedMediaItem(0,0)
  if item == nil then return end
  local take = reaper.GetActiveTake(item)
  if take == nil then return end -- FIX
  if not reaper.TakeIsMIDI(take) then
    -- Optional: do something else here.
    return -- exit
  end  
  
  pass = pass -1  -- requires a delay between actions!
  if pass < 0 then
    pass = 2
    action_index = action_index -1 -- counter/which action to run next
    if action_index == 1 then -- run first action
      reaper.Main_OnCommand(40153, 0) -- Item: Open in built-in MIDI editor
    elseif action_index == 0 then  -- run second action
      reaper.MIDIEditor_OnCommand(reaper.MIDIEditor_GetActive(), 40466) -- View: Zoom to content
    else  -- We're done, exit!
      return
    end  
  end
  reaper.defer(Main)
end

pass = 0
action_index = 2 -- # of actions to run
Main()
EDIT: FIX, would crash if you clicked an Empty item, Added, if take == nil then return end
holy cow, this is soooo good, thanks a lot!
Mrmot is offline   Reply With Quote
Old 06-03-2020, 05:28 AM   #18
rayultine
Human being with feelings
 
Join Date: Oct 2015
Posts: 55
Default

good god, y'all. Why is this not yet part of the main code? This kind of misbehavior has been moaned about for like 8 years.

Can someone explain the rationale for why the problems in this thread and https://forum.cockos.com/showthread.php?t=91048
require workarounds?
rayultine is offline   Reply With Quote
Old 06-03-2020, 10:08 AM   #19
pandabot
Human being with feelings
 
pandabot's Avatar
 
Join Date: Oct 2018
Posts: 367
Default

The devs probably don't use midi very much in their own music, if they did this would drive them crazy and it would be fixed
pandabot is offline   Reply With Quote
Old 06-03-2020, 10:46 AM   #20
rayultine
Human being with feelings
 
Join Date: Oct 2015
Posts: 55
Default

I had to mess with Sonar a few weeks ago to migrate an old project to Reaper, and I was like dang! The MIDI is so smooth and intuitive. And that's about the only thing I miss about Sonar/Cakewalk.
rayultine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.