[PD] pix_buffer question

Mathieu Bouchard matju at artengine.ca
Fri Apr 2 03:07:14 CEST 2010

Jim Ruxton a écrit :

> I wanted to create a fixed size pix_buffer which is continually fed, so for 
> example if I have an index from 0 to 1000 once it is filled the most recent 
> image always has the index 1000 and the oldest 0 indexed image is discarded 
> and replaced by the second oldest image ie image with index 1. Is there a 
> simple way to do this or do I have to do a pix_buffer_read and 
> pix_buffer_write on all 1000 images stored to re-index them each time a new 
> image is stored in the buffer? Thanks . I am assuming this is more or less 
> how pix_delay works.

instead of that, once it goes beyond 1000, start over at 0. then whenever you 
want to have a certain previous image, such as 666 frames ago, instead of 
saying that you want frame 1000-666=334, say you want frame N-666 mod 1001, 
that is,

  current frame number
  [- 666]
  [mod 1001]

i say 1001 just because you say that the first index is 0 and the last index is 
1000, which means 1001 different indices, not 1000.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801

More information about the Pd-list mailing list