Trying to create an anim sequence from code but can't control number of frames

Solved thanks to this answer Is there any way to modify bone tracks with C++? - #6 by YuriNK