|
|
|
04-17-2014, 05:52 AM
|
#1
|
Human being with feelings
Join Date: Jun 2012
Posts: 442
|
switch from main actions to midi editor actions
Hi, is it possible in the same script to trigger actions for the main and for the midi editor?
An example:
- Open midi editor for selected item
- make some actions in the midi editor
possible?
thanks in advance!
|
|
|
04-18-2014, 01:41 AM
|
#2
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Here's an EEL example (it opens the selected item in MIDI editor and selects all notes)
Code:
function do_actions_from_main_and_midi_sections()
(
main_section_action = 40153; // 40153 == open selected item in MIDI editor
midi_editor_section_action = 40003; // 40003 == select all notes
Main_OnCommand(main_section_action, 0);
MIDIEditor_OnCommand(MIDIEditor_GetActive(), midi_editor_section_action);
);
do_actions_from_main_and_midi_sections();
|
|
|
04-18-2014, 04:17 AM
|
#3
|
Human being with feelings
Join Date: Jun 2012
Posts: 442
|
Quote:
Originally Posted by spk77
Here's an EEL example (it opens the selected item in MIDI editor and selects all notes)
Code:
function do_actions_from_main_and_midi_sections()
(
main_section_action = 40153; // 40153 == open selected item in MIDI editor
midi_editor_section_action = 40003; // 40003 == select all notes
Main_OnCommand(main_section_action, 0);
MIDIEditor_OnCommand(MIDIEditor_GetActive(), midi_editor_section_action);
);
do_actions_from_main_and_midi_sections();
|
Thank you man! It seems to me that ell script respond faster than python or is it a my impression?
I would like to learn one of these...which one would you suggest? Better learn python or ell?
thanks for your help!
|
|
|
04-18-2014, 06:27 AM
|
#4
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by spinlud
Thank you man! It seems to me that ell script respond faster than python or is it a my impression?
I would like to learn one of these...which one would you suggest? Better learn python or ell?
thanks for your help!
|
Yes, EEL scripts seem to respond faster (I don't know if there's a significant "speed difference" when f.ex. calling the API functions in a loop from a script). I'm still learning both languages, but I think Python might be easier (at least for a beginner).
|
|
|
04-19-2014, 03:42 AM
|
#5
|
Human being with feelings
Join Date: Jun 2012
Posts: 442
|
Quote:
Originally Posted by spk77
Yes, EEL scripts seem to respond faster (I don't know if there's a significant "speed difference" when f.ex. calling the API functions in a loop from a script). I'm still learning both languages, but I think Python might be easier (at least for a beginner).
|
Thanks for the information. Both languages have the same possibilities inside Reaper or one is more versatile then the other?
|
|
|
04-19-2014, 06:17 AM
|
#6
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by spinlud
Thanks for the information. Both languages have the same possibilities inside Reaper or one is more versatile then the other?
|
There are almost the same API functions available for both languages (SWS ReaScript functions aren't supported in EEL currently), but f.ex. handling arrays (sorting etc.) and manipulating strings is easier in Python (I think ). Open the help menu in Reaper -> select ReaScript documentation - there you can see the current ReaScript API functions. I'm still using both languages for my scripts.
|
|
|
04-26-2015, 02:36 PM
|
#7
|
Human being with feelings
Join Date: Nov 2011
Location: Denver, CO, USA
Posts: 447
|
Thank you so much spk77! I know nothing about scripting but I managed to modify that script to do something I always wanted to:
1) open midi editor
2) zoom to content
3) zoom to one loop iteration
All now bound to my 'E' key. Which also is bound to close my midi editor so it's like a toggle to open the midi editor just the way I like it!
I'm so happy right now.
|
|
|
04-26-2015, 03:50 PM
|
#8
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by djjedidiah
Thank you so much spk77! I know nothing about scripting but I managed to modify that script to do something I always wanted to:
1) open midi editor
2) zoom to content
3) zoom to one loop iteration
All now bound to my 'E' key. Which also is bound to close my midi editor so it's like a toggle to open the midi editor just the way I like it!
I'm so happy right now.
|
I'm glad it works for you
|
|
|
04-26-2015, 04:09 PM
|
#9
|
Human being with feelings
Join Date: Nov 2013
Location: Argentina
Posts: 326
|
Please djjedidiah ! Share that script! I heard and lived so Many times that , about the midi editor opening with the most desconcerting zoom settings... I, and many others for sure, gonna be very gratefull...
edit: reading the script example of spk77, it's so simple to understand, i think I'm gonna try to modify it myself, seems easy enough for a first step in scripting. Anyways, still think it's a good idea the upload of your script to the stash
__________________
Living la vida loca
Last edited by Pasajeromoronmoreno; 04-26-2015 at 04:35 PM.
|
|
|
04-27-2015, 07:28 AM
|
#10
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Pasajeromoronmoreno
Please djjedidiah ! Share that script! I heard and lived so Many times that , about the midi editor opening with the most desconcerting zoom settings... I, and many others for sure, gonna be very gratefull...
edit: reading the script example of spk77, it's so simple to understand, i think I'm gonna try to modify it myself, seems easy enough for a first step in scripting. Anyways, still think it's a good idea the upload of your script to the stash
|
Try this:
(Add this to the MAIN section of the action list)
Code:
function do_actions_from_main_and_midi_sections()
(
Main_OnCommand(40153, 0); // MAIN section action 40153: "open selected item in MIDI editor"
active_MIDI_editor = MIDIEditor_GetActive(); // Now the MIDI editor is opened -> get MIDI editor ID
MIDIEditor_OnCommand(active_MIDI_editor, 40466); // ME action: "zoom to content"
MIDIEditor_OnCommand(active_MIDI_editor, 40468); // ME action: "zoom to one loop iteration"
);
do_actions_from_main_and_midi_sections();
|
|
|
04-28-2015, 12:37 AM
|
#11
|
Mobile
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,669
|
Out of interest, why is Python slower than EEL in REAPER? I've been trying to find ways to speed up the initial latency when calling a script.
Kind of wish they could be preloaded as C++ plugins are so:
1) They're ready to go immediately
2) Could have multiple functions in a .py (instead of 16 files where you need actions for channels 1-16 etc)
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
|
|
|
04-30-2015, 05:52 AM
|
#12
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Spk77,
This works like a charm for me, great script, thanks !!
I have it binded to a key shortcut.
Is it somehow possible to alter the script, so that that same key shortcut also CLOSES the midi editor ?? So that it is a toggle ?
Quote:
Originally Posted by spk77
Try this:
(Add this to the MAIN section of the action list)
Code:
function do_actions_from_main_and_midi_sections()
(
Main_OnCommand(40153, 0); // MAIN section action 40153: "open selected item in MIDI editor"
active_MIDI_editor = MIDIEditor_GetActive(); // Now the MIDI editor is opened -> get MIDI editor ID
MIDIEditor_OnCommand(active_MIDI_editor, 40466); // ME action: "zoom to content"
MIDIEditor_OnCommand(active_MIDI_editor, 40468); // ME action: "zoom to one loop iteration"
);
do_actions_from_main_and_midi_sections();
|
|
|
|
04-30-2015, 06:55 AM
|
#13
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Maybe add this after the MIDI Editor actions:
Code:
MIDIEditor_OnCommand(active_MIDI_editor, 40477); // ME action: "Close window if not docked"
|
|
|
04-30-2015, 09:21 AM
|
#14
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by drew
Out of interest, why is Python slower than EEL in REAPER? I've been trying to find ways to speed up the initial latency when calling a script.
|
I've been wondering this too. I noticed that when calling ReaScript functions f.ex. from a tkinter GUI, there is no noticeable latency.
|
|
|
04-30-2015, 11:14 AM
|
#15
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by spk77
I've been wondering this too. I noticed that when calling ReaScript functions f.ex. from a tkinter GUI, there is no noticeable latency.
|
I think that's because every time REAPER calls .py script, it has to get compiled into byte code and then interpreted by virtual machine (or something like that, I'm not really familiar with details of Python implementation)
I always wondered if REAPER could maybe cache .pyc files and call those instead if original .py is unchanged (and upon exiting REAPER, delete those cached .pyc files). Maybe that could speed things up a bit?
Then again...what if some other file ( which is not a REAPER script) included in the script changes? :/
Last edited by Breeder; 04-30-2015 at 11:24 AM.
|
|
|
05-04-2015, 07:36 AM
|
#16
|
Human being with feelings
Join Date: Feb 2007
Posts: 3,221
|
fellas! i've been trying to make this work with single midi notes for a LONG time (midi note triggers action from main and also from midi editor -- specifically "fold" to hide unused/unnamed note rows) and it wasn't working...this solves my problem!! if the OP was any more specific, it'd have been my doppelganger
thank you so much, and thank you for finally giving me the impetus to start working with reascripts!
breeder, you keep popping up everywhere i look, i'm not stalking you i promise
|
|
|
09-23-2015, 12:11 PM
|
#17
|
Human being with feelings
Join Date: Feb 2013
Location: Apple Valley, California
Posts: 84
|
If I modify the code in post #2, changing the ME action 40003 with 40151 'Go to edit cursor'. It doesn't seem to work because I still have to execute 40151 after the MIDI editor opens.
Yet, it does seem to work fine with 'Select all notes'
Can anyone shed any light on this?
Code:
function do_actions_from_main_and_midi_sections()
(
main_section_action = 40153; // 40153 == open selected item in MIDI editor
midi_editor_section_action = 40151; // 40151 == go to edit cursor
Main_OnCommand(main_section_action, 0);
MIDIEditor_OnCommand(MIDIEditor_GetActive(), midi_editor_section_action);
);
do_actions_from_main_and_midi_sections();
Reajoice,
Bob
__________________
The Heavens Declare the Glory of God
|
|
|
09-24-2015, 01:51 PM
|
#18
|
Human being with feelings
Join Date: Jan 2010
Location: Kalispell
Posts: 14,745
|
Bump.... I'm interested in an answer to Bob's question too. Anybody know?
Quote:
Originally Posted by Big Bob
If I modify the code in post #2, changing the ME action 40003 with 40151 'Go to edit cursor'. It doesn't seem to work because I still have to execute 40151 after the MIDI editor opens.
Yet, it does seem to work fine with 'Select all notes'
Can anyone shed any light on this?
Code:
function do_actions_from_main_and_midi_sections()
(
main_section_action = 40153; // 40153 == open selected item in MIDI editor
midi_editor_section_action = 40151; // 40151 == go to edit cursor
Main_OnCommand(main_section_action, 0);
MIDIEditor_OnCommand(MIDIEditor_GetActive(), midi_editor_section_action);
);
do_actions_from_main_and_midi_sections();
Reajoice,
Bob
|
|
|
|
09-25-2015, 09:41 AM
|
#19
|
Human being with feelings
Join Date: Feb 2013
Location: Apple Valley, California
Posts: 84
|
Thank you for your response Veto,
Quote:
Originally Posted by Veto
Don't have Reaper installed atm, but did you try to place a ME action called "...pause 0.1s..." or so between those two actions? From time to time it helps..
|
I'm not aware of any ME action to introduce any wait time (there are some in the Main actions). However, I did try many equivalents such as inserting several other ME actions prior to 40151. I also tried using several 40151's in sequence, etc.
No matter which of these things I did, once the ME is open, hitting the hot key for 40151 would move the view to where I had hoped the macro would have already positioned it. Therefore, I conclude that the action 40151 in the macro is not taking effect.
Quote:
I tried it, the "Go to edit cursor" action only works if the "start position" of the edit cursor is within the bounds of the opened item.
|
Well if the view already includes the cursor, one doesn't need the 'go to cursor' action because it's already accomplished. The whole idea of this macro was to put the cursor in view after opening the ME for those situations where the cursor is outside the last ME viewing area.
Reajoice,
Bob
__________________
The Heavens Declare the Glory of God
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 08:37 AM.
|