Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 01-15-2021, 06:36 PM   #1
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default MIDI window get highest/lowest note on display, Get Height size of notes in pixels

I am wondering if it is possible to get these info:


High note on editor display
Lowest note on editor display

Height size of notes in pixels.
daniellumertz is offline   Reply With Quote
Old 01-15-2021, 09:16 PM   #2
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

To get this information, you need to parse the chunk of the editor's active take.

The MIDI editor scroll and zoom are hidden within the CFGEDITVIEW field of the chunk:

Code:
ME_LeftmostTick, ME_HorzZoom, ME_TopPitch, ME_PixelsPerPitch = activeTakeChunk:match("\nCFGEDITVIEW (%S+) (%S+) (%S+) (%S+)")
ME_LeftmostTick: Scroll position, given by the leftmost tick visible in the editor.
ME_HorzZoom: If the MIDI editor's timebase = project synced or project time, horizontal zoom is given as pixels per second. If timebase is beats, pixels per tick.
ME_TopPitch:
ME_PixelsPerPitch: Vertical zoom

To get the bottom pitch, you need to get the size of the "midiview" child window using JS_Window_GetClientSize, then get the heights of each of the CC lanes from the chunk, and subtract these heights from the window size.

This is quite an involved process, which I why I submitted a Feature Request that should be very easy to implement:
ReaScript API: Get MIDI editor on-screen layout via MIDIEditor_GetSetting_Int().

Last edited by juliansader; 01-15-2021 at 09:21 PM.
juliansader is offline   Reply With Quote
Old 01-15-2021, 09:21 PM   #3
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

thanks a lot julian ! Very very helpful!!

edit:
Now saw the edit! Thanks gold info there!! Will keep my project going then, will read the FR
daniellumertz 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 03:35 PM.


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