diff options
-rw-r--r-- | src/scanout.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/scanout.c b/src/scanout.c index 8a8b2d0..57a03da 100644 --- a/src/scanout.c +++ b/src/scanout.c @@ -34,11 +34,14 @@ static void set_val(int *dmx, int base_addr, int attr_offset, float value, int s int pos = base_addr + attr_offset - 1; if ( sixteenbit ) { - int val = value * 65535; + int val = value * 65536; + if ( val >= 65536 ) val = 65535; dmx[pos] = (val & 0xff00) >> 8; dmx[pos+1] = val & 0xff; } else { - dmx[pos] = value * 255; + int val = value * 255; + if ( val >= 255 ) val = 255; + dmx[pos] = value * 256; } } |