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

Reply
 
Thread Tools Display Modes
Old 06-18-2017, 01:59 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,005
Default Reascript: new function MIDIEditor_Update for faster MIDI scripts

REAPER's API includes functions to either prevent the arrange view from updating while a script is running (PreventUIRefresh), or to force the arrange view to update (UpdateArrange and UpdateTimeline).

The MIDI editor does not currently enjoy similar functionality as UpdateArrange and UpdateTimeline:

By default, REAPER does not update the MIDI editor UI while scripts are running -- which is very good, since it makes execution of scripts much faster.

However, it would be useful in some cases to be able to force a MIDI editor to update its UI even before a script ends -- *without* updating the arrange view too. In particular, MIDI editing scripts (that track mouse movements and update the MIDI editor in realtime) currently have to use deferred loops instead of a plain while-loops, since the MIDI editor cannot be updated inside such while-loops.

I expect that while-loops would execute much faster than deferred loops, since while-loops can skip updating of the arrange view and all the other background stuff. (Note that REAPER's native MIDI editing mouse modifier actions do not update the arrange window while the action is running, either.)

I therefore propose a new API function:
Code:
Lua: reaper.MIDIEditor_Update(HWND midieditor)

Redraw the MIDI editor, without updating the arrange view and ruler

Last edited by juliansader; 06-18-2017 at 02:25 PM.
juliansader is offline   Reply With Quote
Old 06-23-2017, 11:22 AM   #2
Ulf3000
Human being with feelings
 
Join Date: May 2016
Posts: 235
Default

as a little hack you could do

reaper.MIDIEditor_LastFocused_OnCommand(40501,0) --Invert Selection x2 ... little hack to activate the new notes ...
reaper.MIDIEditor_LastFocused_OnCommand(40501,0) --... reaper.MIDI_Sort(MidiTake) is messing up the notes

yes i just used that yesterday as reaper.MIDI_Sort(MidiTake) messes up overlapping notes
it also seems to update the arrange view and midiplayback (updates the midi editor)

every selection action does that .. i haven´t tried any more .. maybe theres an action with even less impact to trigger the update
Ulf3000 is offline   Reply With Quote
Old 06-23-2017, 01:21 PM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,005
Default

Thanks for the reply!

Unfortunately (if I am not mistaken?), the OnCommand actions are only visibly drawn in the MIDI editor once a script exits, or starts a new defer cycle. What I would like to achieve, is to force the MIDI editor to immediately redraw itself on the screen while a script is still running -- without having to exit the script, and without redrawing the arrange view (and without doing anything else that is time-consuming). Hopefully this will speed up deferred scripts.
juliansader 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 10:31 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.