Old 05-20-2017, 04:18 PM   #1
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default API to set active take in MIDI editor?

In the MIDI editor, when the Track List is enabled, the icon to the right of the track color indicates whether the item on that track is set to be the target for inserted MIDI events.

How can I set this programmatically?

We have MIDIEditor_GetTake() but no MIDIEditor_SetTake() which is exactly what I want to be able to do.

I thought I had a workaround where I'd select only the take I want to activate, and then invoke command 40153 (Item: Open in built-in MIDI editor). But this is buggy: if the track of the selected item contains multiple items, then this actually activates the last item on the track of the programmatically selected item, not the actually selected item.

Any ideas?

Thanks,
Jason.
tack is online now   Reply With Quote
Old 05-21-2017, 02:36 PM   #2
kawa_
Human being with feelings
 
kawa_'s Avatar
 
Join Date: Mar 2016
Posts: 117
Default

hi! I have wrote scripting.(I attached scripts this post.)

Quote:
API to set active take in MIDI editor?
it may exsit other way though, I was using "reaper.SetMediaItemInfo_Value" function.



I think it will to using as combination "next midi take" and "prev midi take", that can be quick compare.
I could not testing these scripts enough, if you get unexpected results, please let me know. I will check
Attached Files
File Type: lua kawa_MAIN_change_ActiveTake_next.lua (1.6 KB, 284 views)
File Type: lua kawa_MAIN_change_ActiveTake_prev.lua (1.6 KB, 205 views)
File Type: lua kawa_MIDI_change_ActiveTake_next.lua (1.4 KB, 181 views)
File Type: lua kawa_MIDI_change_ActiveTake_prev.lua (1.4 KB, 268 views)
__________________
web | kawaScripts | donate | twitter |

Last edited by kawa_; 05-21-2017 at 04:00 PM.
kawa_ is offline   Reply With Quote
Old 05-22-2017, 12:57 PM   #3
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default

Hi kawa,

Quote:
Originally Posted by kawa_ View Post
it may exsit other way though, I was using "reaper.SetMediaItemInfo_Value" function.
Your example will change the take of the currently active item. I should clarify: I'd like to be able to set the active take in the MIDI editor of any item, even if the item isn't currently the one with an active take in the editor.

I ended up doing a silly kludge, which was to keep triggering the "Activate next MIDI item" action in a loop, and after each call, checking to see if the new MIDI item in the editor is the one I wanted to set.

It works well enough, but I expect this would perform poorly with a project with a large number of MIDI items. So much better would be reaper.MIDIEditor_SetTake(new_take), which is a function I imagine would exist if Reaper's API was designed rather than evolved.

Thanks!
tack is online now   Reply With Quote
Old 05-22-2017, 03:02 PM   #4
kawa_
Human being with feelings
 
kawa_'s Avatar
 
Join Date: Mar 2016
Posts: 117
Default

Hi tack

Indeed, one of weak point of my lua scripts that when process many number of items ,it will be slowing .
reaper.MIDIEditor_SetTake(new_take) , I think that function will be good.

Thanks!
__________________
web | kawaScripts | donate | twitter |
kawa_ is offline   Reply With Quote
Old 05-23-2017, 02:44 PM   #5
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

+1. Coordination between MIDI Editor and Arrange is not quite there yet in my opinion.

I'd like to have a simple "Activate MIDI Item Take under mouse" action.

One issue with the situation would be controlling visibility/editability of the take that gets left behind.
FnA is offline   Reply With Quote
Old 06-06-2017, 03:24 AM   #6
RobU
Human being with feelings
 
RobU's Avatar
 
Join Date: Sep 2009
Posts: 863
Default

Quote:
Originally Posted by tack View Post
Hi kawa,


Your example will change the take of the currently active item. I should clarify: I'd like to be able to set the active take in the MIDI editor of any item, even if the item isn't currently the one with an active take in the editor.

I ended up doing a silly kludge, which was to keep triggering the "Activate next MIDI item" action in a loop, and after each call, checking to see if the new MIDI item in the editor is the one I wanted to set.

It works well enough, but I expect this would perform poorly with a project with a large number of MIDI items. So much better would be reaper.MIDIEditor_SetTake(new_take), which is a function I imagine would exist if Reaper's API was designed rather than evolved.

Thanks!
I'd just like to bump this thread in case the Dev's drop by (thanks nofish for the pointer over here...)

I could also really use a reaper.MIDIEditor_SetTake() - currently banging my head off the table trying to figure a way to do this elegantly, but failing miserably :|

Thanks for the workaround Tack, I'll give this a go later.

Rob
__________________
Return of the Dub Cadet - https://open.spotify.com/album/2t98A...lQ&dl_branch=1
RobU is offline   Reply With Quote
Old 05-10-2023, 05:59 PM   #7
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 515
Default

MIDIEditor_SetTake()
+1

Is there a feature request on this?
Sid is offline   Reply With Quote
Old 05-10-2023, 06:25 PM   #8
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 654
Default

MIDIEditor_SetActiveTake()
+1
dangguidan is offline   Reply With Quote
Old 07-04-2023, 05:11 AM   #9
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 147
Default

+1 I am also trying to figure out how to set the active take. Actually, it makes sense to be able to control all parameters of the `Track List` in the MIDI Editor via the API.
dimtok is offline   Reply With Quote
Old 07-04-2023, 05:32 AM   #10
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 147
Default

Maybe it would be possible unselect and then re-select the item take which you wish to make active?
dimtok is offline   Reply With Quote
Old 07-05-2023, 07:59 AM   #11
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 147
Default

I created an official FR for this.

https://forum.cockos.com/showthread.php?t=280587
dimtok 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 07:07 PM.


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