View Single Post
Old 09-12-2019, 04:40 AM   #10
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Edgemeal View Post
v5.983+dev0910 - September 10 2019
+ API: add support for CC shapes to MIDI_Get(Set)AllEvts
# API: add support for bezier tension to MIDI_GetAllEvts/MIDI_SetAllEvts
Yay!

The API help refers to "msg" starting with "version2:". This should probably be "buf" instead:
Code:
Lua: boolean reaper.MIDI_SetAllEvts(MediaItem_Take take, string buf)

If msg begins with 'version2:', the buffer must be a list of { int offset, char flag, int msglen, int extramsglen, unsigned char msg[] }.

Which string.pack/unpack formula can be used to pack/unpack the new format of "int offset, char flag, int msglen, int extramsglen, unsigned char msg[]"?


Quote:
The only extra data currently supported are:
3 bytes for bezier type: 1'b'0 for normal or 1'b'1 for locked
6 bytes for bezier tension: 4't' plus 4 bytes representing a float
What is a locked bezier type?


Existing scripts don't use the new "version2:" option, which means that the Get/SetAllEvts functions will not throw an error, but will work as before, without shape information, even in new versions of REAPER. I am not sure that is a good idea, since neither the script nor the user may not realize that subtle changes are being made to the CC shapes -- until it is too late and lots of undoing have to be done. If a function doesn't work properly, I prefer it to fail spectacularly, so that the user immediately knows that something is wrong. Perhaps the Get/SetAllEvts functions can either be deprecated, or they should be changed in such a way that older scripts won't work any more (but can easily be adapted by the author).
juliansader is offline   Reply With Quote