Hi,
I am trying to create multiple takes with multiple midi sources in a track with C++ codes, like this:
Code:
// add a media item
MediaItem* newMediaItem = AddMediaItemToTrack(newReaperTrack);
GetSetMediaItemInfo(newMediaItem, "D_POSITION", &startTime);
GetSetMediaItemInfo(newMediaItem, "D_LENGTH", &length);
PCM_source* newSource = PCM_Source_CreateFromType("MIDI");
// add a take
MediaItem_Take* newTake = AddTakeToMediaItem(newMediaItem);
GetSetMediaItemTakeInfo(newTake, "P_NAME", (void*)name);
GetSetMediaItemTakeInfo(newTake, "P_SOURCE", (void*)newSource);
GetSetMediaItemTakeInfo(newTake, "D_STARTOFFS", &startTime);
After I compiled the codes and put the plugin in reaper, it did create a new media item. However, there is a weird string of "offline" in the middle of that media item, and I cannot open it with the midi editor.
What does that mean? How do I fix it?
Also, when I search in SWS codes, there is only one place that use PCM_Source_CreateFromType(), and it's commented out. The comment says, "JFB!!! commented: generating evts from scratch does not work, unfortunately.. nailed it down to PCM_Source_CreateFromType("MIDI") which seems to be KO (?)". Does that mean this API function is not even working properly?
Thank you.