methods to fill Cache TOP with movie frames

I’m trying to fill a Cache TOP as fast as possible with 200 frames from a Movie File In TOP, and I haven’t found the best way yet.

option 1)
I set Movie File In TOP play mode to index, and set index to me.time.frame
I can use the prefill button on the Cache TOP. All frames are cached, but this freezes TD for several seconds.

option 2)
I set Movie File In TOP play mode to index, and set index to me.time.frame
I set Cache TOP parameters replacesingle=1 and replaceindex=me.time.frame
This fills the cache top with the speed of the framerate, but not all frames are cached.
Several frames in the Cache TOP are black, and they will (most likely) be filled the second (or third) round the framecounter goes by.

any other options you guys can recommend?

If you want to slowly fill the cache, then use an Execute DAT that is executing once per frame, and instead of using me.time.frame for the replace index, instead use your own counter so that way it always increases by 1 each time the script executes.

ha, good point, my question should have been: I want it to be filled a bit more slowly so my computer can handle it :wink:

Thanks!

You can slowly fill the Cache TOP using the Timer CHOP and no scripting or expressions.

Set Timer’s Length parameter to the interval between image fills, say 1 second. Turn on Cycle and set Maximum Cycles to the number of images in your cache. On the Outputs page enable Cycle Pulse, which exposes the cycles_pulse channel. Export that channel to the Pulse parameter of Active in the Cache TOP, and turn the On/Off toggle of the Active parameter to Off.

To get more control, instead of exporting, you can put a pulse() command in the callbacks of the Timer CHOP - in the onCycle() callback, something like:
op(‘cacle1’).par.activepulse.pulse()

To balance things out, you can also pre-cook some operators in the onCycleEndAlert() callback, which you can set to run .5 seconds before the end of each cycle.

1 Like