Old 01-23-2019, 11:26 AM   #1
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 33
Default MIDI_Sort logic

What is the logic used in MIDI_Sort? For example, if I have multiple CC events or notes at the same position, how will they be indexed after the sort?

I will spend some time experimenting and trying to figure it out for myself but would appreciate if one of the devs could clarify this.
meta is offline   Reply With Quote
Old 01-29-2019, 10:58 PM   #2
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 33
Default

After doing a bit of experimenting and seeing how the internal midi sorting logic works I've come to conclude that an external representation is not adequate enough to track note/cc indexes. There doesn't seem to be a consistent logic to the sort when notes/cc are at the same position and therefore become impossible to track.

Without this feature, it's impossible to write scripts that require continued granular control over individual notes/cc events. Unless I can tackle this problem my current utility is dead in the water. Does anyone have any other ideas about how to go about this?

https://forum.cockos.com/showthread.php?p=2086022 - I've also made a feature request for persistent references to notes and cc events and would appreciate a +1 to get the devs' attention
meta is offline   Reply With Quote
Old 01-29-2019, 11:12 PM   #3
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

I`m afraid this is impossible while REAPER follow MIDI standart mostly (rather than FL Studio customized MIDI implementation, for example).

The only thing came into my mind is a possibility to set flags with MIDI data (currently &1 seleced &2 muted), but i tis not possible at the moment (REAPER does not handle modified flags, probably they left it for the future possible improvents like glide note or something).
mpl is offline   Reply With Quote
Old 01-30-2019, 08:30 AM   #4
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
Default

@meta: what exactly are you trying to do? Maybe I can point you to a script that does a similar task and you can check the code.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 01-30-2019, 12:01 PM   #5
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

According to the thread Changing channel of a few notes deletes one (random, not always happening):

Quote:
Originally Posted by schwa View Post
The order should just be the order the events were added, in other words the order the notes were created.

juliansader is offline   Reply With Quote
Old 02-13-2019, 07:25 PM   #6
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 33
Default

Thanks for your replies guys.

Quote:
Originally Posted by mpl View Post
I`m afraid this is impossible while REAPER follow MIDI standart mostly (rather than FL Studio customized MIDI implementation, for example).

The only thing came into my mind is a possibility to set flags with MIDI data (currently &1 seleced &2 muted), but i tis not possible at the moment (REAPER does not handle modified flags, probably they left it for the future possible improvents like glide note or something).
As far as I can understand, there are internal data structures already representing individual notes/cc events, these just need to be exposed to the API. While this won't be completely persistent between different sessions, it'll still be more than adequate for my needs.


Quote:
Originally Posted by _Stevie_ View Post
@meta: what exactly are you trying to do? Maybe I can point you to a script that does a similar task and you can check the code.
I'm making a MIDI step sequencer where each step is associated with a single MIDI note. This necessitates keeping track of the individual note itself, regardless of changes to its index in the item.

Quote:
Originally Posted by juliansader View Post
Thanks for this, it should solve my problem. There is a complication though. When two notes/CCs are at the same position, and the note which was inserted first is moved away then moved back, its index becomes the highest of all at the same position. I'll spend some time figuring out the best way to factor this into my tracking.

Last edited by meta; 02-13-2019 at 07:37 PM.
meta 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 08:37 AM.


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