├── .gitignore ├── Classes ├── SimpleDMX.sc ├── SimpleDMXFixture.sc ├── SimpleDMXFixturesGui.sc ├── SimpleDMXUniverse.sc ├── SimpleEnttecDMXPro.sc └── SimpleEnttecDMXProMk2.sc ├── HelpSource └── Classes │ ├── SimpleAbstractSerialDMX.schelp │ ├── SimpleDMX.schelp │ ├── SimpleDMXFixture.schelp │ ├── SimpleDMXUniverse.schelp │ ├── SimpleEnttecDMXPro.schelp │ └── SimpleEnttecDMXProMk2.schelp ├── LICENSE ├── README.md └── SimpleDMXControl.quark /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Classes/SimpleDMX.sc: -------------------------------------------------------------------------------- 1 | SimpleDMX { 2 | var <>universes; 3 | var <>trace = false; 4 | var <>latency = nil; 5 | var gui = nil; 6 | 7 | 8 | *basicNew {|cmdperiod = true| 9 | // SimpleDMX.basicNew.states; // does not have any states 10 | ^super.new.initSimpleDMX(cmdperiod); 11 | } 12 | 13 | *new {|universeSizes([512]), cmdperiod = true| 14 | ^this.basicNew(cmdperiod).initUniverses(universeSizes); 15 | } 16 | 17 | initSimpleDMX {|cmdperiod| 18 | if(cmdperiod) { 19 | CmdPeriod.add({ 20 | this.close; 21 | }); 22 | }; 23 | } 24 | initUniverses {|universeSizes| 25 | universes = universeSizes.collect({|size| 26 | SimpleDMXUniverse.new(size); 27 | }); 28 | } 29 | 30 | open { 31 | // this.subclassResponsibility(thisMethod); 32 | } 33 | 34 | close { 35 | // this.subclassResponsibility(thisMethod); 36 | } 37 | 38 | ////////////////////// state handling ////////////////////// 39 | setState {|state, universeId| 40 | var universe; 41 | // if no universeId is given, set all universes 42 | universeId.isNil.if{ 43 | // make sure there are as many states as universes 44 | var states = [state.asArray, universes].flop.flop.first; 45 | universes.do({|universe, i| 46 | this.setState(states[i], universe.id); 47 | }); 48 | ^this; 49 | }; 50 | 51 | // fail silently to be compatible with multi-universe DMX devices 52 | universe = this.getUniverse(universeId); 53 | universe.notNil.if{ 54 | universe.state = state; 55 | }; 56 | } 57 | 58 | states { 59 | ^this.getState; 60 | } 61 | 62 | getState {|universeId| 63 | var universe; 64 | 65 | universeId.isNil.if{ 66 | ^universes.collect(_.state); 67 | }; 68 | 69 | universe = this.getUniverse(universeId); 70 | ^universe.notNil.if({universe.state}, {nil}); 71 | } 72 | 73 | 74 | add {|fixture| 75 | // fixture knows its universe, so we can just add it there 76 | var universe; 77 | 78 | // if universeId is set, we use it 79 | fixture.universeId.notNil.if({ 80 | universe = this.getUniverse(fixture.universeId); 81 | universe.notNil.if({ 82 | universe.add(fixture) 83 | }) 84 | }, { 85 | // if universe is not set, we send to all universes 86 | universes.do{|universe| 87 | universe.add(fixture) 88 | } 89 | }); 90 | } 91 | 92 | addChannelVals {|channel = 0, vals = 0, universeId = 0| 93 | // if universe is not 0, we ignore it 94 | var universe = this.getUniverse(universeId); 95 | universe.notNil.if({ 96 | universe.addChannelVals(channel, vals) 97 | }, { 98 | universes.do{|universe| 99 | universe.addChannelVals(channel, vals) 100 | } 101 | }) 102 | } 103 | 104 | blackout {|universeId = 0| 105 | this.flush(universeId); 106 | } 107 | 108 | blackoutAll { 109 | this.flushAll; 110 | } 111 | 112 | flush {|universeId = 0| 113 | var universe = this.getUniverse(universeId); 114 | universe.notNil.if{ 115 | universe.flush; 116 | }; 117 | } 118 | 119 | flushAll { 120 | this.universes.do(_.flush); 121 | } 122 | 123 | getUniverse {|id = 0| 124 | id.notNil.if({ 125 | ^universes[id] 126 | }, { 127 | ^nil 128 | }) 129 | } 130 | 131 | 132 | 133 | ////////////////////// sending ////////////////////// 134 | sendDMX {|universeId, flush = false| 135 | var universe; 136 | 137 | // if no universeId is given, send all universes 138 | universeId.isNil.if{ 139 | universes.do({|universe, id| 140 | this.sendDMX(id, flush); 141 | }); 142 | ^this; 143 | }; 144 | 145 | universe = this.getUniverse(universeId); 146 | 147 | // fail silently to be compatible with multi-universe DMX devices 148 | universe.notNil.if{ 149 | var array = universe.asInt8Array; 150 | 151 | this.pr_sendDMX(array); 152 | trace.if({ 153 | array.postcs; 154 | }); 155 | flush.if{ 156 | this.flush; 157 | }; 158 | }; 159 | 160 | } 161 | 162 | 163 | // the acutal sending is done by subclasses 164 | pr_sendDMX {|rawArray| 165 | // subclass responsibility 166 | } 167 | } 168 | 169 | SimpleAbstractSerialDMX : SimpleDMX { 170 | var portid, universeId; 6 | var device; 11 | 12 | *initClass { 13 | models = ( 14 | ax3: ( 15 | '13': ( 16 | name: "Astera AX3 Lightdrop", 17 | functionality: "DRGBAWS", 18 | type: "LEDPar", 19 | channelTypes: #[dim, r, g, b, amber, white, strobe] 20 | ) 21 | ), 22 | thunderwash: ( 23 | '7CH_2': ( 24 | name: "cameo THUNDERWASH 600 RGBW", 25 | functionality: "DSdRGBW", 26 | type: "LEDWash", 27 | channelTypes: #[dim, strobe, dur, r, g, b, white], 28 | manual: "https://www.cameolight.com/en/downloads/file/id/-1911810176", 29 | typeRanges: ( 30 | strobe: ( 31 | on: (0..5) ++ (251..255), 32 | off: (6..10), 33 | strobe: (11..250), 34 | ), 35 | dur: ( 36 | relOffOn: (0..255) 37 | ) 38 | ), 39 | \drawFunc: {|fixture, bounds| 40 | 41 | var extentHalf = bounds.extent * 0.5; 42 | 43 | var dim = fixture.get(\dim); 44 | 45 | var color = Color.black.blend(fixture.getColor, dim); 46 | var colorBounds = Rect( 47 | 0, 0, 48 | *extentHalf.asArray 49 | ); 50 | var dimString = "\tdim: %" 51 | .format(fixture.getRaw(\dim)); 52 | var dimStringBounds = Rect( 53 | 0, 0, 54 | extentHalf.x * 2, extentHalf.y 55 | ); 56 | 57 | var white = Color.gray(fixture.get(\white) * dim); 58 | var whiteBounds = Rect( 59 | extentHalf.x, 0, 60 | *extentHalf.asArray 61 | ); 62 | 63 | var strobeDurString = " s:\t%\n d:\t%" 64 | .format(*fixture.getRaw(\strobe, 2).collect(_.asStringToBase(10, 3))); 65 | var strobeDurBounds = Rect( 66 | 0, extentHalf.y, 67 | *extentHalf.asArray 68 | ); 69 | 70 | var fixtureString = "%".format(fixture.dmxAddr); 71 | var fixtureBounds = Rect( 72 | extentHalf.x, extentHalf.y, 73 | *extentHalf.asArray 74 | ); 75 | 76 | Pen.use{ 77 | Pen.color = Color.black; 78 | Pen.fillRect(bounds); 79 | 80 | 81 | // color 82 | Pen.color = color; 83 | Pen.fillRect(colorBounds); 84 | 85 | 86 | // white 87 | Pen.color = white; 88 | Pen.fillRect(whiteBounds); 89 | 90 | // dim string 91 | Pen.color = Color.gray(0.5); 92 | Pen.stringLeftJustIn(dimString, dimStringBounds, Font.monospace(10)); 93 | 94 | 95 | // strobeDur 96 | Pen.color = Color.white; 97 | Pen.stringLeftJustIn(strobeDurString, strobeDurBounds, Font.monospace(10)); 98 | 99 | 100 | Pen.color = Color.grey(1, 0.5); 101 | Pen.stringCenteredIn(fixture.dmxAddr.asString, fixtureBounds, Font.monospace(30)); 102 | 103 | }; 104 | } 105 | ) 106 | ) 107 | ); 108 | dmxSpec = ControlSpec(0, 255, \lin, 1); 109 | } 110 | 111 | *new {|dmxAddr = 0, numChannels = 1, universeId = 0, desc, device| 112 | ^super.new.init(dmxAddr, numChannels, universeId, desc, device) 113 | } 114 | 115 | *newFor {|model, mode, dmxAddr, universeId = 0, device| 116 | var desc = models[model][mode]; 117 | var numChannels = desc[\channelTypes].size; 118 | var obj; 119 | 120 | desc[\model] = model; 121 | obj = this.new(dmxAddr, numChannels, universeId, desc, device); 122 | 123 | ^obj 124 | } 125 | 126 | *printKnownModels { 127 | models.keys.asArray.sort.do{|model| 128 | models[model].keys.asArray.sort.do{|mode| 129 | "SimpleDMXFixture.newFor(%, %, )".format( 130 | model.asCompileString, 131 | mode.asCompileString 132 | ).postln 133 | } 134 | } 135 | } 136 | 137 | init {|argDmxAddr, argNumChannels, argUniverseId, argDesc, argDevice| 138 | dmxAddr = argDmxAddr; 139 | desc = argDesc ?? {()}; 140 | universeId = argUniverseId; 141 | device = argDevice; 142 | 143 | idxKeys = desc[\channelTypes].collectAs({|key, i| 144 | key -> i 145 | }, Event); 146 | numChannels = argNumChannels; 147 | this.flush; 148 | } 149 | 150 | flush { 151 | state = Array.fill(numChannels, 0); 152 | } 153 | 154 | // expects int values between 0..255 155 | setRaw {|key, rawVal, send = false| 156 | var idx; 157 | 158 | key.isKindOf(Integer).if({ 159 | idx = key; 160 | }, { 161 | idx = idxKeys[key] 162 | }); 163 | 164 | idx.notNil.if{ 165 | state.overWrite(rawVal.asArray, idx); 166 | send.if{ 167 | this.send 168 | }; 169 | }; 170 | } 171 | 172 | getRaw {|key, numVals = 1| 173 | var idx; 174 | 175 | key.isKindOf(Integer).if({ 176 | idx = key; 177 | }, { 178 | idx = idxKeys[key] 179 | }); 180 | 181 | idx.notNil.if{ 182 | (numVals > 1).if({ 183 | ^state.copyRange(idx, idx+numVals-1); 184 | }, { 185 | ^state[idx]; 186 | }) 187 | }; 188 | ^nil; 189 | } 190 | 191 | 192 | // expects values between 0..1.0 193 | set {|key, val, send = false| 194 | this.setRaw(key, dmxSpec.map(val).asInteger, send) 195 | } 196 | 197 | get {|key, numVals = 1| 198 | ^dmxSpec.unmap(this.getRaw(key, numVals)); 199 | } 200 | 201 | 202 | // a color's alpha is ignored 203 | setColor {|color, send = false| 204 | var rgbw = color.asArray; 205 | // this.set(\dim, rgbw.last); 206 | this.set(\r, rgbw[0..2], send); 207 | } 208 | 209 | setColorDim {|color, dim = 1, send = false| 210 | var rgbw = color.asArray; 211 | // this.set(\dim, rgbw.last); 212 | this.set(\r, rgbw[0..2]); 213 | this.set(\dim, dim, send); 214 | } 215 | 216 | rgbwDim {|r = 1, g = 1, b = 1, w = 1, dim = 1, send = false| 217 | this.set(\r, [r, g, b]); 218 | this.set(\white, w); 219 | this.set(\dim, dim, send); 220 | } 221 | 222 | rgbwDimRaw {|r = 255, g = 255, b = 255, w = 255, dim = 255, send = false| 223 | this.setRaw(\r, [r, g, b]); 224 | this.setRaw(\white, w); 225 | this.setRaw(\dim, dim, send); 226 | } 227 | 228 | 229 | getColor { 230 | var arr = this.get(\r, 3); 231 | 232 | ^Color.fromArray(arr); 233 | } 234 | 235 | state_ {|val| 236 | // restrict to numChannels 237 | val = val.asArray; 238 | (val.size < numChannels).if{ 239 | val = val ++ Array.fill(numChannels-val.size, 0); 240 | }; 241 | state = val[0..numChannels-1]; 242 | } 243 | 244 | send {|flushDevice = false| 245 | device.notNil.if{ 246 | device.add(this); 247 | device.sendDMX(this.universeId, flushDevice); 248 | } 249 | 250 | } 251 | 252 | printOn { arg stream; 253 | if (stream.atLimit, { ^this }); 254 | stream << this.class.asCompileString << "(" << dmxAddr.asCompileString << ", " << numChannels.asCompileString << ", " << universeId.asCompileString << ")"; 255 | } 256 | 257 | storeOn { arg stream; 258 | if (stream.atLimit, { ^this }); 259 | stream << this.class.asCompileString << "(" << dmxAddr.asCompileString << ", " << numChannels.asCompileString << ", " << universeId.asCompileString << ")"; 260 | } 261 | } 262 | 263 | 264 | -------------------------------------------------------------------------------- /Classes/SimpleDMXFixturesGui.sc: -------------------------------------------------------------------------------- 1 | SimpleDMXFixturesGui { 2 | var header, <>footer; 3 | var size).if{ 42 | "%: Attempt to write outside of universe size, ingoring (%, %).".format(this.class, channel, vals).warn; 43 | ^this 44 | }; 45 | state = state.overWrite(vals.asArray, channel); 46 | } 47 | 48 | size_ {|newSize| 49 | size = newSize; 50 | this.flush; 51 | } 52 | 53 | state_{|vals| 54 | // make sure we have enough values 55 | state = vals[0..(size-1)] ++ (0!(max(size - vals.size, 0))) 56 | } 57 | 58 | getChannelVals {|channel = 0, range = 1| 59 | ^state[(channel) .. (channel - 1 + range)] 60 | } 61 | 62 | } 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Classes/SimpleEnttecDMXPro.sc: -------------------------------------------------------------------------------- 1 | SimpleEnttecDMXPro : SimpleAbstractSerialDMX { 2 | // EnttecDMX Pro Interface 3 | // initial implementation by Till Bovermann, Bruno Gola, 2022 4 | // reworked by Till Bovermann, 2023 5 | // inspired by EnttecDMX by Jonathan Reus, 2016 and Marije Baalmans dmx quark. 6 | 7 | *new {|portid, baudrate = 57600, universeSize = 512, cmdperiod = true| 8 | ^super.basicNew(cmdperiod) 9 | .initSerialInterface(portid, baudrate) 10 | .initSimpleEnttecDMXPro(universeSize); 11 | } 12 | 13 | // ENTTEC serial protocol 14 | // 126 6 nb 0 0 b1 b2 b3 ... bn 231 15 | // 126 - start byte 0x7E 6 16 | // 6 - send DMX op code 17 | // nb - number of bytes (channels) to send + 1 (first byte) 18 | // 0 or 1 - if number of bytes greater than 256 19 | // 0 - start code 20 | // b1 ... bn channel values (each 1 byte) 21 | // 231 - end byte 0xE7 22 | initSimpleEnttecDMXPro {|universeSize| 23 | universes = [ 24 | SimpleDMXUniverse( 25 | size: universeSize, 26 | header: [ 27 | 0x7E, 6, 28 | (universeSize+1) & 0xFF, 29 | ((universeSize+1) >> 8) & 0xFF, 0 30 | ], 31 | footer: [0xE7], 32 | ) 33 | ]; 34 | } 35 | } 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Classes/SimpleEnttecDMXProMk2.sc: -------------------------------------------------------------------------------- 1 | SimpleEnttecDMXProMk2 : SimpleAbstractSerialDMX { 2 | // EnttecDMX Pro Mk2 Interface 3 | 4 | *new {|portid, baudrate = 57600, universeSizes([512, 512]), cmdperiod = true| 5 | // make sure there are at least two universe sizes 6 | universeSizes = [#[1, 1], universeSizes].flop.flop.last; 7 | ^super.basicNew(cmdperiod) 8 | .initSerialInterface(portid, baudrate) 9 | .initSimpleEnttecDMXProMk2(universeSizes); 10 | } 11 | 12 | initSimpleEnttecDMXProMk2 {|universeSizes| 13 | universes = [ 14 | SimpleDMXUniverse( 15 | universeSizes[0], 16 | header: [0x7E, 6, (universeSizes[0]+1) & 0xFF, ((universeSizes[0]+1) >> 8) & 0xFF, 0], 17 | footer: [0xE7] 18 | ), 19 | SimpleDMXUniverse( 20 | universeSizes[1], 21 | header: [0x7E, 202, (universeSizes[1]+1) & 0xFF, ((universeSizes[1]+1) >> 8) & 0xFF, 0], 22 | footer: [0xE7] 23 | ) 24 | ]; 25 | } 26 | 27 | pr_initDevice { 28 | var packet; 29 | // Activates the PRO MK2; Sets both Ports for DMX (adapted from cpp example code) 30 | // 13 means Set API key, API key in our case is {0xC9, 0xA4, 0x03, 0xE4} 31 | packet = Int8Array.with(0x7E, 13, 4, 0, 0xC9, 0xA4, 0x03, 0xE4, 0xE7); 32 | fork { 33 | port.putAll(packet); 34 | 0.3.wait; // Not sure if this wait is necessary 35 | 36 | // 147 is to set the port assignment (from Python code + cpp code) 37 | packet = Int8Array.with(0x7E, 147, 2, 0, 1, 1, 0xE7); 38 | port.putAll(packet); 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleAbstractSerialDMX.schelp: -------------------------------------------------------------------------------- 1 | TITLE:: SimpleAbstractSerialDMX 2 | summary:: an abstract Serial-based DMX interface 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleEnttecDMXPro, Classes/SimpleEnttecDMXProMk2, Classes/SimpleDMXUniverse, Classes/SimpleDMXFixture, Classes/SerialPort 5 | 6 | DESCRIPTION:: 7 | Abstract barebones DMX interface. Not intended to be used directly, but rather to be subclassed by a class that implements the actual DMX interface. link::Classes/SerialPort:: edition. 8 | 9 | note::Although DMX addresses are typically documented 1-based, all SimpleDMX data structures are 0-based.:: 10 | 11 | METHOD:: new 12 | create a new instance 13 | 14 | ARGUMENT:: portid 15 | port id of the serial port. If code::nil::, the first available port will be used. 16 | 17 | ARGUMENT:: baudrate 18 | desired baud rate 19 | 20 | ARGUMENT:: universeSizes 21 | An array of integers, one for each universe, specifying the number of channels in each universe. If not specified, defaults to 512 channels per universe. 22 | 23 | ARGUMENT:: cmdperiod 24 | if code::true::, the serial port will be closed on command-period. 25 | 26 | 27 | INSTANCEMETHODS:: 28 | 29 | PRIVATE:: pr_sendDMX, initSerialInterface, pr_initDevice 30 | 31 | 32 | METHOD:: baudrate 33 | desired baud rate 34 | 35 | METHOD:: portid 36 | port id of the serial port 37 | 38 | METHOD:: port 39 | serial port object 40 | 41 | 42 | METHOD:: open 43 | open the serial port and initialize the device 44 | 45 | 46 | METHOD:: close 47 | close the serial port 48 | 49 | -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleDMX.schelp: -------------------------------------------------------------------------------- 1 | class:: SimpleDMX 2 | summary:: an abstract DMX interface 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleEnttecDMXPro, Classes/SimpleEnttecDMXProMk2, Classes/SimpleDMXUniverse, Classes/SimpleDMXFixture 5 | 6 | DESCRIPTION:: 7 | barebones DMX interface. Not intended to be used directly, but rather to be subclassed by a class that implements the actual DMX interface. For serial-based hardware, see link::Classes/SimpleAbstractSerialDMX::. 8 | 9 | note::Although DMX addresses are typically documented 1-based, all SimpleDMX data structures are 0-based.:: 10 | 11 | 12 | CLASSMETHODS:: 13 | 14 | METHOD:: new 15 | create a new SimpleDMX object 16 | 17 | ARGUMENT:: universeSizes 18 | An array of integers, one for each universe, specifying the number of channels in each universe. If not specified, defaults to 512 channels per universe. 19 | 20 | ARGUMENT:: cmdperiod 21 | if code::true::, the serial port will be closed on command-period. 22 | 23 | 24 | PRIVATE:: basicNew 25 | 26 | INSTANCEMETHODS:: 27 | 28 | PRIVATE:: initUniverses, open, close 29 | 30 | METHOD:: latency 31 | amount of time to wait before sending DMX data, in seconds. Defaults to code::nil::. 32 | 33 | 34 | SUBSECTION:: State handling 35 | 36 | METHOD:: add 37 | add the current state of a code::SimpleDMXFixture:: to the internal DMX state. 38 | Since the fixture knows its universe, it is added to the respective universe. Fails silently if the fixture does not have known code::universeId::. See code::getUniverse:: for details. 39 | 40 | ARGUMENT:: fixture 41 | the code::SimpleDMXFixture:: to add. 42 | 43 | METHOD:: addChannelVals 44 | add values to the internal DMX state. The values are added to the respective universe. 45 | 46 | ARGUMENT:: channel 47 | the index where to start inserting values. 48 | 49 | ARGUMENT:: vals 50 | an array of values to add. 51 | 52 | ARGUMENT:: universeId 53 | the code::universeId:: of the universe to add values to. 54 | Fails silently if the universe corresponding to code::universeId:: does not exist. 55 | 56 | METHOD:: setState 57 | set state(s) of the specified universe. 58 | See link::Classes/SimpleDMXUniverse#state:: for details. 59 | 60 | ARGUMENT:: state 61 | an array of values to set. If an array, it is assumed to be an array of values to set. 62 | 63 | ARGUMENT:: universeId 64 | the code::universeId:: of the universe to set the state of. 65 | If not specified, all universes will be set. 66 | Fails silently if the universe corresponding to code::universeId:: does not exist. 67 | 68 | METHOD:: blackout, flush 69 | set all channels in a universe to 0. 70 | 71 | ARGUMENT:: universeId 72 | the code::universeId:: of the universe to blackout. 73 | Fails silently if the universe corresponding to code::universeId:: does not exist. 74 | 75 | METHOD:: blackoutAll, flushAll 76 | set all channels in all universes to 0. 77 | 78 | SUBSECTION:: Introspection 79 | 80 | METHOD:: universes 81 | an array of link::Classes/SimpleDMXUniverse:: objects. 82 | 83 | METHOD:: getUniverse 84 | returns the code::SimpleDMXUniverse:: with the given code::universeId::. If no such universe exists, returns code::nil::. 85 | 86 | ARGUMENT:: id 87 | the code::universeId:: of the universe to return. 88 | 89 | METHOD:: trace 90 | if code::true::, debugging information will be printed to the console. 91 | 92 | 93 | SUBSECTION:: Sending DMX data 94 | 95 | METHOD:: sendDMX 96 | send the current DMX state to the hardware. 97 | 98 | ARGUMENT:: universeId 99 | the code::universeId:: of the universe to send. If not specified, all universes will be sent. 100 | Fails silently if the universe corresponding to code::universeId:: does not exist. 101 | 102 | EXAMPLES:: 103 | 104 | code:: 105 | // create a DMX object, default to a single universe of 512 channels 106 | d = SimpleDMX(); 107 | 108 | // get a fixture and set its color 109 | f = SimpleDMXFixture(0, 5, universeId: 0, desc: (\channelTypes: #[dim, r, g, b, white])); 110 | f.setColor(Color.white); 111 | 112 | // add the fixture to the DMX state 113 | d.add(f); 114 | 115 | // get state 116 | d.getState 117 | :: 118 | -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleDMXFixture.schelp: -------------------------------------------------------------------------------- 1 | TITLE:: SimpleDMXFixture 2 | summary:: a DMX fixture 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleEnttecDMXPro, Classes/SimpleEnttecDMXProMk2, Classes/SimpleDMXUniverse 5 | 6 | DESCRIPTION:: 7 | A class to represent a DMX fixture. A fixture is e.g. an LED par or a moving light. It has a number of channels, a DMX address, and a description. It can be set to a color, or to a raw value. 8 | 9 | note::Although DMX addresses are typically documented 1-based, all SimpleDMX data structures are 0-based.:: 10 | 11 | 12 | CLASSMETHODS:: 13 | 14 | METHOD:: new 15 | create a new non-descript fixture. 16 | 17 | code:: 18 | // a non-descript LED Par with rgbw-Control and global dim 19 | f = SimpleDMXFixture(0, 4, desc: (\channelTypes: #[dim, r, g, b, white])); 20 | f.setColor(Color.red); 21 | f.state; // -> [ 255, 255, 0, 0 ] 22 | :: 23 | 24 | 25 | ARGUMENT:: dmxAddr 26 | the starting address of the fixture (0-based). 27 | 28 | ARGUMENT:: numChannels 29 | number of channels the fixture uses. 30 | 31 | ARGUMENT:: universeId 32 | the id of the universe the fixture is in. This is useful for SimpleDMX devices that support multiple universes. If you are using a single universe, you should keep it at its default value (0). 33 | 34 | ARGUMENT:: desc 35 | a code::Dictionary:: containing the description of this fixture. It may contain the following keys: 36 | 37 | definitionlist:: 38 | ## code::name:: (optional) 39 | || The name of the fixture. 40 | ## code::type:: (optional) 41 | || The type of the fixture. 42 | ## code::model:: (optional) 43 | || The model of the fixture. 44 | ## code::functionality:: (optional) 45 | || A short description of the functionality of the fixture, e.g. code::"DRGBAWS"::. 46 | ## code::channelTypes:: (recommended) 47 | || An code::Array:: of code::Symbols::s describing the semantic of each channel. The symbols are typically one of code:: #[r, g, b, a, white, dim, strobe, dur, x, y, z]::. 48 | ## code::description:: (recommended) 49 | || A code::String:: explaning the functionality of the fixture in detail. 50 | ## code::manual:: (recommended) 51 | || URL of the manual. 52 | ## code::typeRanges:: (recommended) 53 | || A code::Dictionary:: with ranges for some channel types. 54 | :: 55 | 56 | ARGUMENT:: device 57 | a code::SimpleDMX:: device (optional). 58 | 59 | 60 | METHOD:: newFor 61 | create a new fixture for a given model. 62 | 63 | code:: 64 | SimpleDMXFixture.printKnownModels; // prints all known models to the console 65 | 66 | // an Astera AX3 in mode 13 with address 20 (0-based) 67 | f = SimpleDMXFixture.newFor(\ax3, \13, dmxAddr: 20); 68 | f.setColor(Color.red); 69 | f.state; // -> [ 255, 255, 0, 0, 0, 0, 0 ] 70 | :: 71 | 72 | ARGUMENT:: model 73 | the model of the fixture. This is a code::Symbol::, e.g. code:::ax3::. 74 | 75 | ARGUMENT:: mode 76 | the mode the fixture is configured to. This is a code::Symbol::, e.g. code:::'13'::. 77 | 78 | ARGUMENT:: dmxAddr 79 | the starting address of the fixture (0-based). 80 | 81 | ARGUMENT:: universeId 82 | the id of the universe the fixture is in. This is useful for SimpleDMX devices that support multiple universes. If you are using a single universe, you should keep it at its default value (0). 83 | 84 | ARGUMENT:: device 85 | a code::SimpleDMX:: device (optional). 86 | 87 | 88 | METHOD:: models 89 | a dictionary containing all known models. The keys are the model names, the values are dictionaries of modes. See code::newFor:: for more details. 90 | 91 | METHOD:: printKnownModels 92 | print all known models to the console. See code::newFor:: for more a usage example. 93 | 94 | 95 | PRIVATE:: initClass, dmxSpec 96 | 97 | 98 | INSTANCEMETHODS:: 99 | 100 | PRIVATE:: init, idxKeys 101 | 102 | SUBSECTION:: Setting values 103 | 104 | METHOD:: set 105 | set the value(s) of a channel (normalised). 106 | 107 | code:: 108 | // a non-descript LED Par with rgbw-Control and global dim 109 | f = SimpleDMXFixture(0, 5, desc: (\channelTypes: #[dim, r, g, b, white])); 110 | f.set(0, 0.5); // set dim to 0.5 111 | f.set(1, 0.5); // set r to 0.5 112 | f.set(\g, [0.89, 0.4]); // set g/b to 0.89, and 0.4 resp. 113 | f.state; // -> [ 128, 128, 227, 102, 0 ] 114 | :: 115 | 116 | ARGUMENT:: key 117 | the key of the channel to set. Either an index (Int), or one of the keys in code::channelTypes::. 118 | 119 | ARGUMENT:: val 120 | either a numeric normalised value or an array of normalised values. 121 | The values will be assigned to the channels subsequent to the channel specified by code::key::. 122 | 123 | ARGUMENT:: send 124 | if code::true::, commits the fixture's state to its device. 125 | 126 | 127 | METHOD:: setColor 128 | A convenience method that sets the values of the channels code::r::, code::g::, code::b:: and code::dim::. 129 | 130 | note::This method works only if the fixture has a code::channelTypes:: description that contains code::r::, code::g::, code::b::, and code::dim::. The values for code::r::, code::g::, and code::b:: need to be next to each other and in this order.:: 131 | 132 | code:: 133 | // an Astera AX3 in mode 13 with address 20 (0-based) 134 | f = SimpleDMXFixture.newFor(\ax3, \13, dmxAddr: 20); 135 | f.setColor(Color.red); 136 | f.state; // -> [ 255, 255, 0, 0, 0, 0, 0 ] 137 | :: 138 | 139 | ARGUMENT:: color 140 | A link::Classes/Color:: object. 141 | 142 | ARGUMENT:: send 143 | if code::true::, commits the fixture's state to its device. 144 | 145 | 146 | METHOD:: setRaw 147 | set the value of a channel as raw Integers. 148 | 149 | 150 | ARGUMENT:: key 151 | the key of the channel to set. Either an index (Int), or one of the keys in code::channelTypes::. 152 | 153 | 154 | ARGUMENT:: rawVal 155 | an integer or an array of integers. The values will be assigned to the channels subsequent to the channel specified by code::key::. 156 | 157 | ARGUMENT:: send 158 | if code::true::, commits the fixture's state to its device. 159 | 160 | 161 | METHOD:: send 162 | commits the fixture's state to its device. 163 | 164 | ARGUMENT:: flushDevice 165 | if code::true::, flush the device after sending. 166 | 167 | 168 | METHOD:: flush 169 | flush (clear) the current state of the fixture to the DMX device. 170 | 171 | SUBSECTION:: Introspection 172 | 173 | METHOD:: dmxAddr 174 | the DMX address of the fixture. This is a 0-based value. 175 | 176 | 177 | METHOD:: universeId 178 | the universe Id of the fixture. This is a 0-based value. 179 | This is useful for SimpleDMX devices that support multiple universes. If you are using a single universe, you should keep it at its default value (0). 180 | 181 | METHOD:: numChannels 182 | the number of channels the fixture uses. 183 | 184 | METHOD:: desc 185 | a code::Dictionary:: containing the description of this fixture. See code::new:: for more details. 186 | 187 | METHOD:: state 188 | the current state of the fixture. This is an array of integer values. The values are ordered according to the code::channelTypes:: description of the fixture. The size of the array is restricted to code::numChannels::. 189 | 190 | 191 | EXAMPLES:: 192 | 193 | code:: 194 | // a non-descript LED Par with rgbw-Control and global dim 195 | f = SimpleDMXFixture(0, 5, desc: (\channelTypes: #[dim, r, g, b, white])); 196 | f.set(0, 0.5); // set dim to 0.5 197 | f.set(1, 0.5); // set r to 0.5 198 | f.set(\g, [0.89, 0.4]); // set g/b to 0.89, and 0.4 resp. 199 | f.state; // -> [ 128, 128, 227, 102, 0 ] 200 | 201 | 202 | 203 | // an Astera AX3 in mode 13 with address 20 (0-based) 204 | f = SimpleDMXFixture.newFor(\ax3, \13, dmxAddr: 20); 205 | f.setColor(Color.red); 206 | f.state; // -> [ 255, 255, 0, 0, 0, 0, 0 ] 207 | :: 208 | -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleDMXUniverse.schelp: -------------------------------------------------------------------------------- 1 | TITLE:: SimpleDMXUniverse 2 | summary:: a DMX universe data structure 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleEnttecDMXPro, Classes/SimpleEnttecDMXProMk2, Classes/SimpleDMXFixture 5 | 6 | DESCRIPTION:: 7 | A barebones data structure for holding a DMX universe. 8 | See link::Classes/SimpleEnttecDMXPro:: for usage example. 9 | 10 | 11 | CLASSMETHODS:: 12 | 13 | METHOD:: new 14 | argument:: size 15 | Size of universe. default (and max) is 512. 16 | Resizing flushes the universe. 17 | 18 | argument:: header 19 | prepend universe by this. will be converted into 8-bit int. 20 | 21 | argument:: footer 22 | append universe by this. will be converted into 8-bit int. 23 | 24 | 25 | 26 | 27 | INSTANCEMETHODS:: 28 | 29 | METHOD:: asInt8Array 30 | returns 8-bit raw array ready to send over via DMX device. 31 | 32 | 33 | 34 | METHOD:: header, footer 35 | header resp. footer to be integrated into raw data structure. Needs to be an array of integers. 36 | 37 | METHOD:: flush, clear, blackout 38 | empty internal state. 39 | 40 | METHOD:: add 41 | adds current state of a link::Classes/SimpleDMXFixture:: to the universe. 42 | 43 | argument:: fixture 44 | instance to be added. 45 | 46 | 47 | 48 | METHOD:: addChannelVals 49 | add values to the universe. 50 | 51 | argument:: channel 52 | start channel 53 | argument:: vals 54 | values to be written. Will be cropped to size. 55 | 56 | METHOD:: getChannelVals 57 | get current values from the universe. 58 | 59 | argument:: channel 60 | argument:: range 61 | 62 | METHOD:: state 63 | set complete state. 64 | argument:: vals 65 | an array of values. Will be cropped to size. 66 | 67 | 68 | PRIVATE:: init 69 | 70 | EXAMPLES:: 71 | 72 | SUBSECTION:: Basic usage 73 | 74 | code:: 75 | // create an instance of a specific size and add some values 76 | d = SimpleDMXUniverse(64); 77 | d.addChannelVals(12, [15, 14]); 78 | 79 | // get values of 10 channels starting at channel 11 80 | d.getChannelVals(11, 10); // indexing starts at 0 81 | 82 | d.state; // return current state (omitting header and footer) 83 | 84 | // return Int8Array. 85 | // This is what you want to send over to your DMX device. 86 | d.asInt8Array; 87 | 88 | // header is empty 89 | d.header; 90 | 91 | // set header and footer 92 | d.header = [1, 2, 3, 4]; 93 | d.footer = [10, 20, 30, 40]; 94 | 95 | // state is still the same 96 | d.state; 97 | d.state.size; // -> 64 98 | 99 | // but asInt8Array includes header and footer elements now 100 | d.asInt8Array; 101 | d.asInt8Array.size; // -> 72 (4 + 64 + 4) 102 | 103 | // flush (zero-out) state 104 | d.flush; 105 | 106 | // state is empty 107 | d.state; 108 | 109 | // add some content 110 | d.addChannelVals(1, {256}!20); 111 | d.state; 112 | 113 | 114 | // resizing flushes array 115 | d.size = 8; 116 | d.state; 117 | :: 118 | 119 | SUBSECTION:: Working with SimpleDMXFixtures 120 | 121 | code:: 122 | d = SimpleDMXUniverse(32); 123 | 124 | // a nondescript 10dim fixture 125 | f = SimpleDMXFixture(0, 10).setRaw(2, [25, 26, 27, 28]); 126 | 127 | d.add(f); 128 | d.state; 129 | 130 | f.set(0, {1.0.rand}!10); // set random values 131 | d.add(f); 132 | d.state; 133 | 134 | d.flush; 135 | 136 | // an Astera LED Par at dmx address 20 137 | g = SimpleDMXFixture.newFor(\ax3, \13, 20); 138 | g.setColor(Color.green); 139 | d.add(g); 140 | d.state; 141 | // sets green and dim value accordingly1 142 | // -> [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] 143 | :: -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleEnttecDMXPro.schelp: -------------------------------------------------------------------------------- 1 | CLASS:: SimpleEnttecDMXPro 2 | summary:: interface for communication with the Enttec DMX pro device 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleEnttecDMXProMk2, Classes/SimpleDMXUniverse, Classes/SimpleDMXFixture 5 | 6 | DESCRIPTION:: 7 | barebones and low-level implementation to handle DMX communication (send only) with the Enttec DMX Pro. 8 | 9 | 10 | CLASSMETHODS:: 11 | 12 | METHOD:: new 13 | create a new instance. 14 | 15 | argument:: portid 16 | one listed in code::SerialPort.devices::. 17 | argument:: baudrate 18 | baudrate of the serial port. 19 | argument:: universeSize 20 | size of the initial DMX universe. 21 | argument:: cmdperiod 22 | if code::true::, the serial port will be closed on command-period. 23 | 24 | 25 | INSTANCEMETHODS:: 26 | 27 | PRIVATE:: initSimpleEnttecDMXPro 28 | 29 | 30 | EXAMPLES:: 31 | 32 | code:: 33 | q = q ? (); 34 | 35 | SerialPort.devicePattern = "/dev/tty.usbserial-EN*"; 36 | if(thisProcess.platform.name == \linux) { SerialPort.devicePattern = "/dev/ttyU*" }; 37 | q.dmxPort = SerialPort.devices[0]; 38 | q.enttec = SimpleEnttecDMXPro(q.dmxPort); 39 | // q.enttec.latency = q.nodeLatency; 40 | 41 | q.enttec.open; 42 | // q.enttec.trace = true; 43 | 44 | 45 | // cameo THUNDERWASH 600 RGBW 46 | // DMX Mode = 7CH_2 47 | // DMX Adress = 477 48 | q.light = {|env, r = 255, g = 255, b = 255, w = 255, dim = 255, flush = true, channel = 477| 49 | q.enttec.addChannelVals(channel, [dim, 0, 10, r, g, b, w]); 50 | q.enttec.sendDMX(1, flush); 51 | }; 52 | 53 | q.lightOff = {|env, flush = true, channel = 477| 54 | q.light(0, 0, 0, 0, 0, flush, channel) 55 | }; 56 | 57 | q.light(*(({255.rand}!3) ++ [0, 128])) 58 | q.lightOff 59 | :: -------------------------------------------------------------------------------- /HelpSource/Classes/SimpleEnttecDMXProMk2.schelp: -------------------------------------------------------------------------------- 1 | CLASS:: SimpleEnttecDMXProMk2 2 | summary:: Interface for communication with the Enttec DMX pro Mk2 device 3 | categories:: External Control>DMX 4 | related:: Classes/SimpleDMXUniverse, Classes/SimpleDMXFixture 5 | 6 | DESCRIPTION:: 7 | barebones and low-level implementation to handle DMX communication (send only) with the Enttec DMX Pro Mk2 (two universes). 8 | 9 | note::Although DMX addresses are typically documented 1-based, all SimpleDMX data structures are 0-based.:: 10 | 11 | 12 | CLASSMETHODS:: 13 | 14 | METHOD:: new 15 | create a new instance. 16 | 17 | argument:: portid 18 | one listed in code::SerialPort.devices::. 19 | argument:: baudrate 20 | baudrate of the serial port. 21 | argument:: universeSize 22 | size of the initial DMX universes. 23 | argument:: cmdperiod 24 | if code::true::, the serial port will be closed on command-period. 25 | 26 | 27 | INSTANCEMETHODS:: 28 | 29 | PRIVATE::initSimpleEnttecDMXProMk2, pr_initDevice 30 | 31 | 32 | EXAMPLES:: 33 | 34 | SUBSECTION::Instantiation 35 | 36 | code:: 37 | q = q ? (); 38 | 39 | SerialPort.devicePattern = "/dev/tty.usbserial-EN*"; 40 | if(thisProcess.platform.name == \linux) { SerialPort.devicePattern = "/dev/ttyU*" }; 41 | q.dmxPort = SerialPort.devices[0]; 42 | q.enttec = SimpleEnttecDMXProMk2s(q.dmxPort); 43 | // q.enttec.latency = q.nodeLatency; 44 | 45 | q.enttec.open; 46 | // q.enttec.trace = true; 47 | :: 48 | 49 | 50 | SUBSECTION::Controlling a fixture with SimpleDMXFixture 51 | 52 | // an Astera LED Par at dmx address 20 in universe 0 53 | q.ax3 = SimpleDMXFixture.newFor(\ax3, \13, 20, 0); 54 | 55 | // set to green 56 | q.ax3.setColor(Color.green); 57 | q.enttec.add(q.ax3); 58 | q.enttec.sendDMX(flush: false); 59 | 60 | 61 | // set to red 62 | q.ax3.setColor(Color.red); 63 | q.enttec.add(q.ax3); 64 | q.enttec.sendDMX(flush: false); 65 | 66 | 67 | SUBSECTION::Controlling a fixture without SimpleDMXFixture 68 | 69 | A teletype::cameo THUNDERWASH 600 RGBW:: at dmx address 477 in universe 1: 70 | 71 | code:: 72 | // DMX Mode = 7CH_2 73 | q.light = {|env, r = 255, g = 255, b = 255, w = 255, dim = 255, flush = true, channel = 477| 74 | q.enttec.addChannelVals(channel, [dim, 0, 10, r, g, b, w]); 75 | q.enttec.sendDMX(1, flush); 76 | }; 77 | 78 | q.lightOff = {|env, flush = true, channel = 477| 79 | q.light(0, 0, 0, 0, 0, flush, channel) 80 | }; 81 | 82 | q.light(*(({255.rand}!3) ++ [0, 128])) 83 | q.lightOff 84 | :: 85 | 86 | 87 | SUBSECTION::Closing the serial port 88 | 89 | code:: 90 | q.enttec.close; 91 | :: -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimpleDMXControl 2 | *Till Bovermann, 2022/2023 for [plonk](https://plonk.studio).* 3 | 4 | 5 | SuperCollider Quark to interface with Enttec DMX Pro (mk2). 6 | 7 | Implements 8 | 9 | + **SimpleDMX** — Base class for DMX interfaces 10 | + **SimpleAbstractSerialDMX** — Base class for serial port DMX interfaces 11 | + **SimpleEnttecDMXPro** — Class for Enttec DMX Pro interface 12 | + **SimpleEnttecDMXProMk2** — Class for Enttec DMX Pro mk2 interface 13 | + **SimpleDMXFixture** — Class for defining DMX fixtures to be used in **SimpleDMXUniverse** 14 | + **SimpleDMXUniverse** — Class implementing a DMX universe to be used in **SimpleDMX** 15 | 16 | 17 | See helpfiles for details. 18 | 19 | ## Thanks 20 | 21 | Inspired by [EnttecDMX](https://github.com/jreus/ENTTEC_USB_PRO) by Jonathan Reus, 2016 and [DMX](https://github.com/supercollider-quarks/DMX) by Marije Baalman. 22 | Implemented and tested with help from Bruno Gola and Constantin Engelmann. 23 | -------------------------------------------------------------------------------- /SimpleDMXControl.quark: -------------------------------------------------------------------------------- 1 | ( 2 | \name: "SimpleDMXControl", 3 | \path: "SimpleDMXControl", // path relative to the root Quarks folder 4 | \summary: "barebones DMX control. Currentl implements interfaces for Enttec DMX Pro and Enttec DMX Pro Mk2.", 5 | \author: "Till Bovermann, Bruno Gola. Inspired by EnttecDMX by Jonathan Reus, 2016 and DMX quark by Marije Baalman.", 6 | \organization: "plonk", 7 | \country: "Germany", 8 | \since: "2022", 9 | \url: "https://plonk.studio", 10 | \version: 0.3 11 | ) --------------------------------------------------------------------------------