video loop pedal

Hi,
I’m trying to make something like an audio loop pedal, but for video.
when you press a button, a cache TOP starts recording video off a camera, when you release the button, the cached video starts playing in a loop.
I’m struggling with how to let the cache TOP know how big the cache needs to be- could you get the cache size to increase by one every time it captures a frame?
is there a better way to go about this?
thanks

If you haven’t checked it out already, I’d recommend looking at this looper example:
viewtopic.php?f=22&t=10207&p=39148&hilit=looper#p38897

I’d personally set a fixed cache size and know ahead of time that the loop can be up to a certain pre-determined length. This seems like a simpler solution, and I tend to favor simplicity as it often correlates to stability. That said, you may want to try something like the TOX I’ve attached to set a variable cache buffer size according to the record length. I haven’t stress tested it at various framerates, but hopefully it’ll help you get started thinking about how to approach this design challenge.
variable_cache_loop_example.tox (6.58 KB)

awesome. thanks