Lua boolean reaper.MIDI_SetCCShape(MediaItem_Take take, integer ccidx, integer shape, number beztension, optional boolean noSortIn)
Set CC shape and bezier tension. set noSort if setting multiple events, then call MIDI_Sort when done. See MIDI_SetCC, MIDI_GetCCShape
Find a method. First count the number of CC. If the new CC is set to disable sort, then the newly added ccidx is the number of CC, and the newly added CC will be progressive on this number.