Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e729f0c
Choose a base ref
...
head repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: efcfe22
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Feb 15, 2012

  1. images: added image selection with imageN_index

    For now, this is still constrained by the image list size being limited
    to 2 entries.
    wpwrak committed Feb 15, 2012
    Copy the full SHA
    99eda6d View commit details
  2. Copy the full SHA
    efcfe22 View commit details
Showing with 61 additions and 2 deletions.
  1. +45 −0 experimental/N.fnp
  2. +2 −0 src/compiler/compiler.c
  3. +2 −0 src/compiler/compiler.h
  4. +2 −0 src/compiler/fnp.ids
  5. +8 −2 src/renderer/eval.c
  6. +2 −0 src/renderer/framedescriptor.h
45 changes: 45 additions & 0 deletions experimental/N.fnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
imagefiles=pacman.jpg, ghost.jpg
decay=0.6
image1_a=0.6
image2_a=0.6

midi "Faderfox LV3" {
fad1 = fader(1, 7);
fad8 = fader(8, 7);

green1 = button(1, 16);
green8 = button(8, 16);

joy1x = pot(9, 1);
joy1y = pot(9, 2);
joy2x = pot(10, 1);
joy2y = pot(10, 2);
};

fad1 = range(fad1);
fad8 = range(fad8);

green1 = button(green1);
green8 = button(green8);

joy1x = range(joy1x);
joy1y = range(joy1y);
joy2x = range(joy2x);
joy2y = range(joy2y);

per_frame:
image1_zoom = fad1*5+0.1;
image2_zoom = fad8*6+0.1;
image1_index = green1;
image2_index = !green8;

sx = 1.06;
sy = 1.06;
cx = 0.5+0.1*sin(1.82*time);
cy = 0.5+0.1*sin(0.97*time);
rot = 0.05*sin(0.4*time);

image1_x = joy1x;
image1_y = 1-joy1y;
image2_x = joy2x;
image2_y = 1-joy2y;
2 changes: 2 additions & 0 deletions src/compiler/compiler.c
Original file line number Diff line number Diff line change
@@ -158,9 +158,11 @@ static void load_defaults(struct compiler_sc *sc)
sc->p->pfv_initial[pfv_image1_x] = 0.5;
sc->p->pfv_initial[pfv_image1_y] = 0.5;
sc->p->pfv_initial[pfv_image1_zoom] = 1.0;
sc->p->pfv_initial[pfv_image1_index] = 0;
sc->p->pfv_initial[pfv_image2_x] = 0.5;
sc->p->pfv_initial[pfv_image2_y] = 0.5;
sc->p->pfv_initial[pfv_image2_zoom] = 1.0;
sc->p->pfv_initial[pfv_image2_index] = 1;
}

static void set_initial(struct compiler_sc *sc, int pfv, float x)
2 changes: 2 additions & 0 deletions src/compiler/compiler.h
Original file line number Diff line number Diff line change
@@ -143,10 +143,12 @@ enum {
pfv_image1_x,
pfv_image1_y,
pfv_image1_zoom,
pfv_image1_index,
pfv_image2_a,
pfv_image2_x,
pfv_image2_y,
pfv_image2_zoom,
pfv_image2_index,

COMP_PFV_COUNT /* must be last */
};
2 changes: 2 additions & 0 deletions src/compiler/fnp.ids
Original file line number Diff line number Diff line change
@@ -123,10 +123,12 @@ image1_a pfv_image1_a -1
image1_x pfv_image1_x -1
image1_y pfv_image1_y -1
image1_zoom pfv_image1_zoom -1
image1_index pfv_image1_index -1
image2_a pfv_image2_a -1
image2_x pfv_image2_x -1
image2_y pfv_image2_y -1
image2_zoom pfv_image2_zoom -1
image2_index pfv_image2_index -1

#
# Aliases
10 changes: 8 additions & 2 deletions src/renderer/eval.c
Original file line number Diff line number Diff line change
@@ -230,10 +230,12 @@ static void set_frd_from_pfv(struct patch *p, struct frame_descriptor *frd)
frd->image_x[0] = read_pfv(p, pfv_image1_x);
frd->image_y[0] = read_pfv(p, pfv_image1_y);
frd->image_zoom[0] = read_pfv(p, pfv_image1_zoom);
frd->image_index[0] = read_pfv(p, pfv_image1_index);
frd->image_a[1] = read_pfv(p, pfv_image2_a);
frd->image_x[1] = read_pfv(p, pfv_image2_x);
frd->image_y[1] = read_pfv(p, pfv_image2_y);
frd->image_zoom[1] = read_pfv(p, pfv_image2_zoom);
frd->image_index[1] = read_pfv(p, pfv_image2_index);
}

static unsigned int pfpudummy[2] __attribute__((aligned(sizeof(struct tmu_vertex))));
@@ -312,8 +314,12 @@ static rtems_task eval_task(rtems_task_argument argument)
/* NB: we do not increment reference count and assume pixbufs
* will be valid until the renderer has fully stopped.
*/
for(i=0;i<IMAGE_COUNT;i++)
frd->images[i] = p->images[i].pixbuf;
for(i=0;i<IMAGE_COUNT;i++) {
int n = frd->image_index[i];

frd->images[i] = n >= 0 && n < IMAGE_COUNT ?
p->images[n].pixbuf : NULL;
}

reinit_all_pfv(p);
set_pfv_from_frd(p, frd);
2 changes: 2 additions & 0 deletions src/renderer/framedescriptor.h
Original file line number Diff line number Diff line change
@@ -84,6 +84,8 @@ struct frame_descriptor {
float image_a[IMAGE_COUNT];
float image_x[IMAGE_COUNT], image_y[IMAGE_COUNT];
float image_zoom[IMAGE_COUNT];
int image_index[IMAGE_COUNT];

struct tmu_vertex *vertices;
};