public override IEnumerable <GloCommand> ToGloCommands(GloSequenceContext context) { // TO_DO handle repetitions of more than 255 var loop = new GloLoopCommand(_repetitions); GloSequenceContext subContext = new GloSequenceContext(context.Track, loop); subContext.Append(Children.Where(child => child.Tracks.Contains(context.Track))); if (Duration > subContext.CurrentTime) { loop.Commands.Add(subContext.Advance(Duration - subContext.CurrentTime).AsCommand()); } subContext.Advance(subContext.CurrentTime * (_repetitions - 1)); // fix internal time subContext.Postprocess(); // advance main context context.Advance(subContext.CurrentTime); // TO_DO split loop when fractions are involved yield return(loop); }