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

Reply
 
Thread Tools Display Modes
Old 06-21-2018, 10:21 PM   #1
TheSoundDefense
Human being with feelings
 
Join Date: Jun 2018
Posts: 2
Default [5.62 x64] MIDI_SetTextSysexEvt adds additional null character to message

Whenever I use MIDI_SetTextSysexEvt to update a text event, ReaScript adds an additional null character to the end of the string (on top of the one that's already used to terminate the string). This seems like a really minor detail, but it is preventing us from achieving our ideal workflow. Oddly enough, opening the "Edit text event" window removes this additional null character, but this is a bit cumbersome to do for every text event.

To reproduce:
- Open up any MIDI track.
- Add a text event with some non-empty message.
- Select the text event.
- Run the EEL script below in the debugger.

Code:
// Get the first selected event.
take = MIDIEditor_GetTake(MIDIEditor_GetActive());
sel_event = MIDI_EnumSelTextSysexEvts(take, -1);

// Measure the length of the message.
retval = MIDI_GetTextSysexEvt(take, sel_event, selected, muted, ppqpos, event_type, #msg);
before_length = strlen(#msg);

// Place the event again exactly as it is.
MIDI_SetTextSysexEvt(take, sel_event, selected, muted, ppqpos, event_type, #msg);

// Measure the length of the message again.
retval = MIDI_GetTextSysexEvt(take, sel_event, selected, muted, ppqpos, event_type, #msg);
after_length = strlen(#msg);
last_char = str_getchar(#msg, strlen(#msg) - 1, 'c');
The before_length and the after_length should be the same, but the after_length is greater by one; the last_char confirms that a null character was added to the end of the string. Oddly, if you run the script again, it won't continue to tack on additional null characters; it only adds the one.

This also happens with Lua; I haven't tried it with Python. I'm running Windows 10 Pro, but it occurs on other machines as well. This bug also occurs on REAPER 4.78.

Last edited by TheSoundDefense; 06-21-2018 at 10:24 PM. Reason: Doesn't exactly work
TheSoundDefense is offline   Reply With Quote
Old 08-12-2018, 11:18 PM   #2
TheSoundDefense
Human being with feelings
 
Join Date: Jun 2018
Posts: 2
Default

Interesting update: we discovered that using any sort of undo action will fix all lyrics in the given track, so there is no longer an additional null character.
TheSoundDefense 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 09:15 AM.


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