smeighan / nutcracker

RGB Effects builder for Chistmas Animations
15 stars 15 forks source link

Single Strand Count #48

Open Materdaddy opened 11 years ago

Materdaddy commented 11 years ago

I have never dug into your code beyond the installer, but may soon. I've noticed two errors with single strand effects (the only ones I'm using this year).

First, the pixel count per column is incorrect sometimes. I had a chase with all segments having 5 pixels per segment and a section scrolls by with what appears to be 7 pixels. This creates a problem that I cannot simply copy/paste the output in vixen since it isn't actually outputting a repeating pattern. I have noticed an increase in errors with the pixel count with very long sequence durations (on a local install) I notice more errors. For example, since I noticed this and couldn't simply copy/paste the chase I attempted a 60 second effect and there were many sections of the chase that were 10 pixels/1 pixel instead of the 5/5 I requested.

The second issue is an "off-by-one" with the number of frames of sequence data required. If I put 50ms timing and a 2 second clip, I don't get 40 time slices in my vixen routine, I get 39.

My username on your site is "Materdaddy", the model is "ROOFLINE" and the effect is called "TEST".

Materdaddy commented 11 years ago

I just changed values (on my local install) to 5/3 for the color grouping and it seems the first issue is not there. Either there's something magic about 5 and 5, or both numbers being equal.

Materdaddy commented 11 years ago

I can't figure out what exactly your code is doing to determine "off" and "on" for the pixels, but the problem is in the addition of the pixel count before the modulo on "new_p":

I added a bunch of logging, and with settings of frame_delay 50, speed .4, cnt1 5, cnt2 5 and 192 pixels in my target I see the following results which in the very first frame calculation shows 7 pixels on, then 5 pixels off. This error of 7 pixels moves through the main loop and is the count I noticed that makes the output non-repeating. That means I cannot simply make a 2 second chase and copy/paste it in Vixen because it "glitches" since the 7-segment of "on" doesn't make it's way through all of my pixels in 2 seconds.

Here's some of the debugging I added to the loop in effects/f_single_strand.php in my failed attempt at figuring out what the code does:

In loop: 1 of 101 dealing with segment 1 cycle is 10 delta is 0.4 new_p is 191.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 1 = 191.6 % 10 pixel 1 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 192.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 2 = 192.6 % 10 pixel 2 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 1.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 1 = 1.6 % 10 pixel 3 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 2.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 2 = 2.6 % 10 pixel 4 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 3.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 3 = 3.6 % 10 pixel 5 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 4.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 4 = 4.6 % 10 pixel 6 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 5.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 5 = 5.6 % 10 pixel 7 is on dealing with segment 1 cycle is 10 delta is 0.4 new_p is 6.6 cnt1 is 5 and cnt2 is 5 mod=new_p%cycle ==> 6 = 6.6 % 10 pixel 8 is off