summaryrefslogtreecommitdiff
path: root/src/nanolight.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nanolight.c')
-rw-r--r--src/nanolight.c141
1 files changed, 134 insertions, 7 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index 7767e94..16e3ac3 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -73,11 +73,11 @@ static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class
fix->pan = 0.0;
fix->tilt = 0.0;
fix->gobo = 0;
- fix->gobo_rotation = 0.5;
+ fix->gobo_rotate = 0.0;
fix->gobo_spin = 0.0;
fix->prism = 0;
- fix->prism_rotation = 0.5;
- fix->prism_spin = 0.5;
+ fix->prism_rotate = 0.0;
+ fix->prism_spin = 0.0;
fix->focus = 0.5;
fix->zoom = 0.5;
fix->frost = 0.0;
@@ -93,6 +93,99 @@ static gboolean scanout_cb(gpointer data)
}
+static void cap_value(float *val, float min, float max)
+{
+ if ( *val > max ) *val = max;
+ if ( *val < min ) *val = min;
+}
+
+
+void attr_movex(struct nanolight *nl, signed int d, int fine)
+{
+ int i;
+ float chg = fine ? d/60000.0 : d/10.0;
+ if ( nl->sel_attr != PANTILT ) return;
+ for ( i=0; i<nl->n_sel; i++ ) {
+ struct fixture *fix = &nl->fixtures[nl->selection[i]];
+ if ( !(fix->cls->attributes & PANTILT) ) continue;
+ fix->pan += chg;
+ cap_value(&fix->pan, -1.0, 1.0);
+ }
+}
+
+
+void attr_movey(struct nanolight *nl, signed int d, int fine)
+{
+ int i;
+ float chg = fine ? d/60000.0 : d/10.0;
+ for ( i=0; i<nl->n_sel; i++ ) {
+ struct fixture *fix = &nl->fixtures[nl->selection[i]];
+
+ switch ( nl->sel_attr ) {
+
+ case PANTILT :
+ fix->tilt += chg;
+ cap_value(&fix->tilt, -1.0, 1.0);
+ break;
+
+ case FOCUS :
+ fix->focus += chg;
+ cap_value(&fix->focus, 0.0, 1.0);
+ break;
+
+ case ZOOM :
+ fix->zoom += chg;
+ cap_value(&fix->zoom, 0.0, 1.0);
+ break;
+
+ case FROST :
+ fix->frost += chg;
+ cap_value(&fix->frost, 0.0, 1.0);
+ break;
+
+ case IRIS :
+ fix->iris += chg;
+ cap_value(&fix->iris, 0.0, 1.0);
+ break;
+
+ case GOBO :
+ if ( (fix->gobo == 0) && (d<0) ) continue;
+ if ( (fix->gobo == fix->cls->n_gobos-1) && (d>0) ) continue;
+ fix->gobo += d;
+ break;
+
+ case GOBO_ROTATE :
+ fix->gobo_rotate += chg;
+ cap_value(&fix->gobo_rotate, -1.0, 1.0);
+ break;
+
+ case GOBO_SPIN :
+ fix->gobo_spin += chg;
+ cap_value(&fix->gobo_spin, -1.0, 1.0);
+ break;
+
+ case PRISM :
+ if ( (fix->prism == 0) && (d<0) ) continue;
+ if ( (fix->prism == fix->cls->n_prisms-1) && (d>0) ) continue;
+ fix->prism += d;
+ break;
+
+ case PRISM_ROTATE :
+ fix->prism_rotate += chg;
+ cap_value(&fix->prism_rotate, -1.0, 1.0);
+ break;
+
+ case PRISM_SPIN :
+ fix->prism_spin += chg;
+ cap_value(&fix->prism_spin, -1.0, 1.0);
+ break;
+
+ }
+
+ }
+}
+
+
int main(int argc, char *argv[])
{
struct nanolight nl;
@@ -134,9 +227,9 @@ int main(int argc, char *argv[])
cls.name = "Robe Robin DL7S Profile Mode 1";
cls.properties = COL_CMY;
cls.attributes = INTENSITY | COLOUR | PANTILT | FOCUS | ZOOM
- | FROST | IRIS;
+ | FROST | IRIS | GOBO | PRISM;
cls.attributes16 = INTENSITY | COLOUR | PANTILT | FOCUS | ZOOM
- | FROST | IRIS;
+ | IRIS;
cls.intensity_offset = 49;
cls.pan_offset = 0;
@@ -148,6 +241,10 @@ int main(int argc, char *argv[])
cls.zoom_offset = 32;
cls.frost_offset = 29; /* FIXME 0..179 only */
cls.iris_offset = 30; /* FIXME: 0..179 only, but also fine @ offset 32 */
+ cls.gobo_rotate_offset = 25;
+ cls.gobo_spin_offset = 25;
+ cls.prism_rotate_offset = 0;
+ cls.prism_spin_offset = 28;
int magic_chans[] = {48};
int magic_vals[] = {32};
@@ -163,6 +260,12 @@ int main(int argc, char *argv[])
19, 0,
24, 0,
28, 0,
+ 33, 0,
+ 38, 0,
+ 42, 0,
+ 47, 0,
+ 52, 0,
+ 57, 0,
0, 67,
0, 73,
0, 78,
@@ -171,17 +274,41 @@ int main(int argc, char *argv[])
0, 95,
0, 100,
0, 106 };
- cls.n_gobos = 15;
+ int gobo_flags[] = { 0,
+ GOBO_ROTATE,
+ GOBO_ROTATE,
+ GOBO_ROTATE,
+ GOBO_ROTATE,
+ GOBO_ROTATE,
+ GOBO_ROTATE,
+ GOBO_SPIN,
+ GOBO_SPIN,
+ GOBO_SPIN,
+ GOBO_SPIN,
+ GOBO_SPIN,
+ GOBO_SPIN,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0 };
+ cls.n_gobos = 21;
cls.n_gobo_chans = 2;
cls.gobo_chans = gobo_chans;
cls.gobo_vals = gobo_vals;
+ cls.gobo_flags = gobo_flags;
int prism_chans[] = {27};
int prism_vals[] = {0, 50};
- cls.n_prisms = 15;
+ int prism_flags [] = {0, PRISM_SPIN};
+ cls.n_prisms = 2;
cls.n_prism_chans = 1;
cls.prism_chans = prism_chans;
cls.prism_vals = prism_vals;
+ cls.prism_flags = prism_flags;
nl.fixture_width = 80.0;
nl.fixtures = NULL;