From 6bc2911f1fa3a2be98512186538bdaa8ba5b6850 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 30 Jun 2019 17:57:52 +0200 Subject: Gobo selection and rotation --- src/scanout.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/scanout.c') 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; icls->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; icls->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); + } } -- cgit v1.2.3