summaryrefslogtreecommitdiff
path: root/src/scanout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scanout.c')
-rw-r--r--src/scanout.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/scanout.c b/src/scanout.c
index f0e6de3..1b0229c 100644
--- a/src/scanout.c
+++ b/src/scanout.c
@@ -43,6 +43,58 @@ static void set_val(int *dmx, int base_addr, int attr_offset, float value, int s
}
+static void set_prism(int *dmx, struct fixture *fix, int prism)
+{
+ int i;
+
+ if ( prism > fix->cls->n_prisms ) return;
+
+ for ( i=0; i<fix->cls->n_prism_chans; i++ ) {
+ int idx = fix->cls->n_prism_chans * prism + i;
+ int chan = fix->cls->prism_chans[i];
+ dmx[fix->base_addr+chan-1] = fix->cls->prism_vals[idx] & 0xff;
+ }
+
+ if ( fix->cls->prism_flags[prism] & PRISM_ROTATE ) {
+ float rotate_val;
+ rotate_val = (fix->prism_rotate + 1.0)/2.0;
+ set_val(dmx, fix->base_addr, fix->cls->prism_rotate_offset, rotate_val, 0);
+ }
+
+ if ( fix->cls->prism_flags[prism] & PRISM_SPIN ) {
+ float rotate_val;
+ rotate_val = (fix->prism_spin + 1.0)/2.0;
+ set_val(dmx, fix->base_addr, fix->cls->prism_spin_offset, rotate_val, 0);
+ }
+}
+
+
+static void set_gobo(int *dmx, struct fixture *fix, int gobo)
+{
+ int i;
+
+ if ( gobo > fix->cls->n_gobos ) return;
+
+ for ( i=0; i<fix->cls->n_gobo_chans; i++ ) {
+ int idx = fix->cls->n_gobo_chans * gobo + i;
+ int chan = fix->cls->gobo_chans[i];
+ dmx[fix->base_addr+chan-1] = fix->cls->gobo_vals[idx] & 0xff;
+ }
+
+ if ( fix->cls->gobo_flags[gobo] & GOBO_ROTATE ) {
+ float rotate_val;
+ rotate_val = (fix->gobo_rotate + 1.0)/2.0;
+ set_val(dmx, fix->base_addr, fix->cls->gobo_rotate_offset, rotate_val, 0);
+ }
+
+ if ( fix->cls->gobo_flags[gobo] & GOBO_SPIN ) {
+ float rotate_val;
+ rotate_val = (fix->gobo_spin + 1.0)/2.0;
+ set_val(dmx, fix->base_addr, fix->cls->gobo_spin_offset, rotate_val, 0);
+ }
+}
+
+
int scanout_all(struct nanolight *nl)
{
SoupSession *sess;
@@ -125,6 +177,13 @@ int scanout_all(struct nanolight *nl)
cls->attributes16 & IRIS);
}
+ if ( cls->attributes & GOBO ) {
+ set_gobo(dmx, fix, fix->gobo);
+ }
+
+ if ( cls->attributes & PRISM ) {
+ set_prism(dmx, fix, fix->prism);
+ }
}