commit b45154c69b6cce7fe9831293c42e0dd81379f8f6
parent 0f5b171a448a2133556ba7318e1fddcfba6510a0
Author: Adam M <aemalone@gmail.com>
Date: Fri, 25 Dec 2020 23:47:56 -0600
max 128 frames, 1/x scaling for speed
Diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp
@@ -55,7 +55,7 @@ struct ComputerscareBlank : Module {
ComputerscareBlank() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
- configParam(ANIMATION_SPEED, -2.f, 2.f, 1.0, "Animation Speed");
+ configParam(ANIMATION_SPEED, -10.f, 10.f, 1.0, "Animation Speed");
configParam(ANIMATION_ENABLED, 0.f, 1.f, 1.f, "Animation Enabled");
configParam(CONSTANT_FRAME_DELAY, 0.f, 1.f, 0.f, "Constant Frame Delay");
configParam(ANIMATION_MODE, 0.f, 3.f, 0.f, "Animation Mode");
@@ -68,8 +68,15 @@ struct ComputerscareBlank : Module {
if (stepCounter > samplesDelay) {
stepCounter = 0;
if (params[ANIMATION_ENABLED].getValue()) {
+
if (numFrames > 1) {
- currentFrame ++;
+ if(params[ANIMATION_SPEED].getValue() >=0 ) {
+ currentFrame++;
+ }
+ else {
+ currentFrame--;
+ }
+ currentFrame+=numFrames;
currentFrame %= numFrames;
}
}
@@ -119,10 +126,10 @@ struct ComputerscareBlank : Module {
}
else {
if (params[CONSTANT_FRAME_DELAY].getValue()) {
- frameDelay = base/speedKnob;
+ frameDelay = .04/speedKnob;
}
else {
- frameDelay = frameDelaySeconds/speedKnob;
+ frameDelay = base/speedKnob;
}
}
}
diff --git a/src/animatedGif.hpp b/src/animatedGif.hpp
@@ -105,7 +105,7 @@ STBIDEF unsigned char *stbi_xload(char const *filename, int *x, int *y, int *fra
gr = &head;
p = result;
int counter = 0;
- while (gr)
+ while (gr && counter < 128)
{
prev = gr;
//printf("p:%i, &p:%i, *p:%i\n", p, &p, *p);