http://www.elanhickler.com/transfer/...render_bug.rar
select the second item: render fx as midi -> GOOD
undo
select both items: render fx as midi -> BAD (first note fails to be printed to midi)
undo
change retune setting to 100ms
select both items: render fx as midi -> GOOD
when working with thousands of items, I get intermittent notes not being printed when using 200ms. It seems to always be the first note.
Edit: Also affects 100ms and possibly all others under the right circumstances, I'm guessing some variable in REAPER code is not being reset between items
confirmed in REAPER 5
Edit: Also very important: midi notes at the left edge of a media item will have no note-off point. This causes problems that are associated with a lack of note-off, including including MIDI_GetNote function of Reascript and midi editing in REAPER.
Edit: I made a script that does the render midi fx action one item at a time, this solves the problem, but it's 2x slower.
Code:
// Apply fx (MIDI Output) one item at a time
/* by Elan Hickler
www.Soundemote.com
www.elanhickler.com */
function SELECT(item) (SetMediaItemSelected(item, 1);item);
function UNSELECT_ITEMS() (Main_OnCommand(40289,0));
Undo_BeginBlock();
GetSet_LoopTimeRange(0, 0, timeStart, timeEnd, 0);
GetSet_LoopTimeRange(1, 0, 0, 0, 0);
items = CountSelectedMediaItems();
i=0;
loop(items,
itemList[i] = GetSelectedMediaItem(0, i);
i+=1;
);
UNSELECT_ITEMS();
i=0;
loop(items,
item = SELECT(itemList[i]);
Main_OnCommand(40436, 0); // render fx midi
UNSELECT_ITEMS();
i+=1;
);
Undo_EndBlock("Apply fx (MIDI Output) one item at a time", -1);
GetSet_LoopTimeRange(1, 0, timeStart, timeEnd, 0);
Script didn't solve the problem, but maybe this does, added some extra functions inbetween rendering items to attempt to force REAPER to restart whatever internal stuff is going on when rendering midi:
Code:
// Apply fx (MIDI Output) one item at a time
/* by Elan Hickler
www.Soundemote.com
www.elanhickler.com */
function SELECT(item) (SetMediaItemSelected(item, 1);item);
function UNSELECT_ITEMS() (Main_OnCommand(40289,0));
function GLUE() (Main_OnCommand(41588,0));
function SetTakeName(name, take) (GetSetMediaItemTakeInfo_String(take, "P_NAME", name, 1));
Undo_BeginBlock();
items = CountSelectedMediaItems();
i=0;
loop(items,
itemList[i] = GetSelectedMediaItem(0, i);
i+=1;
);
UNSELECT_ITEMS();
i=0;
loop(items,
item = SELECT(itemList[i]);
take = GetActiveTake(item);
GetTakeName(#name, take);
color = GetMediaItemInfo_Value(item, "I_CUSTOMCOLOR");
Main_OnCommand(40436, 0); // render fx midi
Main_OnCommand(40125, 0); // next active take
Main_OnCommand(40129, 0); // delete active take
GLUE();
SetTakeName(#name, take);
SetMediaItemInfo_Value(item, "I_CUSTOMCOLOR", color);
UNSELECT_ITEMS();
i+=1;
);
Undo_EndBlock("Apply fx (MIDI Output) one item at a time", -1);
GetSet_LoopTimeRange(1, 0, timeStart, timeEnd, 0);
Script seems to fail to rename items and intermittently fails to re-color items.