Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 11-17-2018, 02:21 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,194
Default ReaScript API: Get MIDI editor on-screen layout via MIDIEditor_GetSetting_Int()

Scripts need access to the on-screen layout of the MIDI editor, in order to 1) accurately position transparent script GUIs over the editor, and to 2) quickly and accurately calculate the CC value, etc at the mouse position.

Unfortunately, REAPER's MIDI editor is secretive about its on-screen layout, with no native API functions to get information such as
* screen coordinates,
* CC lane heights,
* note vertical zoom, or
* leftmost scroll position, etc

Some of this information is supposed to be encoded in the item state chunk of the MIDI editor's active take, but it is unreliable:

* Screen coordinates are encoded in the CFGEDIT field, but it only gives the coordinates of the last-used UNmaximized size and position (and also includes the window frame).

* CC lane heights are encoded in VELLANE fields, but if two or more lanes are of the same type in the MIDI editor (for example, if two or more lanes are Pitch), only one lane is recorded in a VELLANE field. Scripts and SWS actions that try to calculate the CC lane under the mouse will fail in such situations.

Moreover, loading the item state chunk with GetItemStateChunk() is slow, which limits the responsiveness of scripts. Deferred scripts that try to load large state chunks in each defer cycle become jerky and can even slow REAPER down.

It would make scripts faster and more reliable -- and easier to code -- if REAPER could return reliable and up-to-date information about the MIDI editor's structure.

The existing API function MIDIEditor_GetSetting_Int can easily be expanded to return values such as:
* "note_zoom",
* "leftmost_pixel",
etc, and MIDIEditor_GetSetting_Str(editor, "cc_lanes", "") can return all the visible CC lanes as a single packed string.
juliansader is online now   Reply With Quote
Old 11-18-2018, 08:06 AM   #2
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 49
Default

+1 for this additional function!

I wanted to do something like a "smart grid" for the midi editor(Ableton style). grid snap setting follow grid visibility for midi editor.

It was cool, to have horizontal and vertical zoom data for midi editor window too.
nappies is online now   Reply With Quote
Old 11-26-2018, 11:12 AM   #3
MIP
Human being with feelings
 
Join Date: Sep 2017
Posts: 1
Default

Quote:
Originally Posted by nappies View Post
+1 for this additional function!

I wanted to do something like a "smart grid" for the midi editor(Ableton style). grid snap setting follow grid visibility for midi editor.

It was cool, to have horizontal and vertical zoom data for midi editor window too.
+1
Great feature
MIP is offline   Reply With Quote
Old 12-09-2018, 08:28 AM   #4
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 49
Default

I made cpu save "smart" grid using JS_Mouse_GetState it works only when you zoom



by the way Ableton take much more CPU then zooming in midi editor


Last edited by nappies; 12-09-2018 at 08:58 AM.
nappies is online now   Reply With Quote
Old 12-10-2018, 08:13 AM   #5
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 601
Default

+1
Everything that helps making programming the MIDI-Editor as versatile as the ArrangeView is a good thing.
__________________
Lua Coders of the world: UNITE!
This Saturday, 11am NewYorkCity time, head over to this thread:
https://forum.cockos.com/showthread....98#post2067798
mespotine 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 12:49 AM.


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