Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 09-27-2014, 06:05 AM   #1
skirsdeda
Human being with feelings
 
Join Date: Jun 2014
Location: Vilnius, Lithuania
Posts: 2
Default Reascript has wrong marshalling for byte strings

Some functions have arguments which need byte strings as opposed to strings containing text,e.g.:
MIDI_InsertEvt - msg
MIDI_InsertTextSysexEvt - msg
I guess there are some other functions like that.

In reaper_python.py msg argument of these functions is treated like all other strings:
rpr_packsc(p4)
which in turn does this:
str(v).encode()

The sane way to pass msg to InsertEvt from Python would be:
msg = '\xFF\x2F\x00' # byte string containing end of track event
RPR_MIDI_InsertEvt(take_id, False, False, ppq1, msg, len(msg))

This doesn't work with str(v).encode().
So instead of rpr_packsc(p<smth>)
c_char_p(p<smth>) should be used.

MIDI_InsertEvt definition in reaper_python.py would be:
def RPR_MIDI_InsertEvt(p0,p1,p2,p3,p4,p5):
a=_ft['MIDI_InsertEvt']
f=CFUNCTYPE(c_byte,c_uint64,c_byte,c_byte,c_double ,c_char_p,c_int)(a)
t=(rpr_packp('MediaItem_Take*',p0),c_byte(p1),c_by te(p2),c_double(p3),c_char_p(p4),c_int(p5))
r=f(t[0],t[1],t[2],t[3],t[4],t[5])
return r
skirsdeda 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:36 PM.


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