Old 04-17-2019, 06:16 PM   #1
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default How to remove redundant "All note-offs" from item?

As we know in the end of item there is "All notes off" event (CC123 0)

My script inserts notes into the item, and if it inserts it after this event - item length grows, automatically, and inserts new "All notes off" in the end of extended item, but... old "All notes off" events stays at the same position

https://forum.cockos.com/attachment....1&d=1555549755

I tried to remove it by using this code:
Code:
   retval, notecnt, ccevtcnt, textsyxevtcnt = reaper.MIDI_CountEvts( take )

    for i=ccevtcnt, 1,-1 do
         retval, selected, muted, ppqpos, chanmsg, chan, msg2, msg3 = reaper.MIDI_GetCC( take, i )
         Msg(chanmsg.."    "..chan.."   "..msg2.."   "..msg3)
         if msg2==123 and msg3==0 then
            reaper.MIDI_DeleteCC( take, i-1 )
         end
         
    end
but it doesn't do anything to this CC event.

So.. question: How to remove it?

Here is how this MIDI Item looks in Track Chunk:

Code:
<SOURCE MIDI
HASDATA 1 960 QN
POOLEDEVTS {16E3CA0F-5021-4AD6-A120-CE65880A7E14}
E 0 90 30 64
E 0 90 33 64
E 480 90 37 64
E 240 90 40 64
E 240 90 3c 64
E 480 90 3e 64
E 1440 90 43 64
E 217 80 33 00
E 2 80 30 00
E 479 80 37 00
E 239 80 40 00
E 23 90 41 64
E 0 b0 7b 00
E 218 80 3c 00
E 262 90 3c 64
E 218 80 3e 00
E 262 90 38 64
E 480 90 35 64
E 698 80 43 00
E 960 80 41 00
E 480 80 3c 00
E 480 80 38 00
E 480 80 35 00
E 0 b0 7b 00
CHASE_CC_TAKEOFFS 1
GUID {0A69ADDC-E923-4C36-B4B0-D93644D54270}
IGNTEMPO 0 120 4 4
SRCCOLOR 32
VELLANE -1 190 0
CFGEDITVIEW 0 0.081642 60 12 0 -1 0 0 0 0.5
KEYSNAP 0
TRACKSEL 209
EVTFILTER 0 -1 -1 -1 -1 0 0 0 0 -1 -1 -1 -1 0 -1 0 -1 -1
CFGEDIT 1 1 0 1 0 4 1 1 1 1 1 0.25 45 84 791 795 0 0 0 0 0 0 0 0 0 0.49 0 0 1 64
>
Attached Images
File Type: jpg Screenshot_1.jpg (36.4 KB, 200 views)

Last edited by kartalex; 04-17-2019 at 06:28 PM.
kartalex is offline   Reply With Quote
Old 04-17-2019, 06:31 PM   #2
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Sorry guys


I should do

reaper.MIDI_GetCC( take, i-1 )

instead of

reaper.MIDI_GetCC( take, i )

stupid))))


I have been racking my brains for several hours
kartalex is offline   Reply With Quote
Old 04-17-2019, 08:04 PM   #3
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
Default

You can avoid those CC123, if you extend the item with
Code:
reaper.MIDI_SetItemExtents( item, startQN, endQN )
BEFORE, the notes cross the item boundaries.
__________________
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 offline   Reply With Quote
Old 04-18-2019, 07:44 AM   #4
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Quote:
Originally Posted by _Stevie_ View Post
You can avoid those CC123, if you extend the item with
Code:
reaper.MIDI_SetItemExtents( item, startQN, endQN )
BEFORE, the notes cross the item boundaries.
Yes!! That's better solution, I was trying to set item's length, but it was too complicated to compute ppq from time, as tempo can be variant...

Thanks!
kartalex 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:29 PM.


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