Quote:
Originally Posted by Meo-Ada Mespotine
Could you post an example of code, that shows this behavior?
|
I knew this would happen. Well this is embarrassing. I did some more tests and this time all the items aligned to the grid. It surely can't be random. But as an example this code would be replicating what I was doing. It takes a set of items, selected in this case, and aligns each to the grid. This uses a pre set tempo of 120, starts at time 0 and assumes each item is one measure each in length. I've also tested with BPM of 115, 130, and going down to the beat. Now it all matches up. I don't know what is going on.
Code:
function main()
(
Time = 0;
BPM = 120;
BeatsPerBar = 4;
Seconds = BeatsPerBar * 60;
BPMTime = Seconds / BPM;
i = 0;
while(i < CountSelectedMediaItems(0))
(
Item = GetSelectedMediaItem(0, i);
SetMediaItemPosition(Item, Time, 0);
Time += BPMTime;
i += 1;
);
);
main();