├── .github └── FUNDING.yml ├── README.md ├── assets └── images │ └── usb-dmx.jpg ├── bin ├── resources │ └── code │ │ └── ExampleTaglet.class └── src │ └── com │ └── jaysonh │ └── dmx4artists │ ├── DMXControl.class │ ├── DMXFixture.class │ ├── DMXParam.class │ ├── DMXParamOsc.class │ ├── DMXParamStatic.class │ ├── FTDIDmx.class │ ├── FTDIException.class │ ├── FTDI_D2XX.class │ ├── FTDevice.class │ ├── HSBColor.class │ ├── LinuxValidator.class │ ├── MoveBehaviour.class │ ├── OSXCommand.class │ ├── OSXValidator.class │ ├── PathFinder.class │ ├── SystemValidator.class │ ├── Timeline.class │ ├── TimelineDisplay.class │ ├── TimelineEvent.class │ └── WINValidator.class ├── data └── README ├── dependencies ├── linux │ ├── libftd2xx.so │ └── libftd2xx.so.1.4.27 ├── osx │ └── libftd2xx.1.4.24.dylib └── win │ └── ftd2xx.dll ├── distribution ├── Dmx4Artists-2.0 │ ├── README.md │ ├── download │ │ ├── Dmx4Artists-2.0.txt │ │ ├── Dmx4Artists-2.0.zip │ │ ├── Dmx4Artists.txt │ │ └── Dmx4Artists.zip │ ├── examples │ │ ├── BasicControl │ │ │ └── BasicControl.pde │ │ ├── ConnectDevice │ │ │ └── ConnectDevice.pde │ │ ├── DmxVisualise │ │ │ ├── DmxVisualise.pde │ │ │ ├── FixtureDraw.pde │ │ │ ├── MovingHeadFixture.pde │ │ │ ├── ParCanFixture.pde │ │ │ └── Visualiser.pde │ │ ├── FadeIn │ │ │ └── FadeIn.pde │ │ ├── FadeUpDown │ │ │ └── FadeUpDown.pde │ │ ├── MultipleFixtures │ │ │ └── MultipleFixtures.pde │ │ ├── SingleFixture │ │ │ └── SingleFixture.pde │ │ ├── TimelineExample │ │ │ └── TimelineExample.pde │ │ └── TriggerParam │ │ │ └── TriggerParam.pde │ ├── index.html │ └── stylesheet.css └── Dmx4Artists-2.1 │ ├── README.md │ ├── download │ ├── Dmx4Artists-2.1.txt │ ├── Dmx4Artists-2.1.zip │ ├── Dmx4Artists.txt │ └── Dmx4Artists.zip │ ├── examples │ ├── BasicControl │ │ └── BasicControl.pde │ ├── ConnectDevice │ │ └── ConnectDevice.pde │ ├── DmxVisualise │ │ ├── DmxVisualise.pde │ │ ├── FixtureDraw.pde │ │ ├── MovingHeadFixture.pde │ │ ├── ParCanFixture.pde │ │ └── Visualiser.pde │ ├── FadeIn │ │ └── FadeIn.pde │ ├── FadeUpDown │ │ └── FadeUpDown.pde │ ├── MultipleFixtures │ │ └── MultipleFixtures.pde │ ├── SingleFixture │ │ └── SingleFixture.pde │ ├── TimelineExample │ │ └── TimelineExample.pde │ └── TriggerParam │ │ └── TriggerParam.pde │ ├── index.html │ └── stylesheet.css ├── examples ├── .DS_Store ├── BasicControl │ └── BasicControl.pde ├── ConnectDevice │ └── ConnectDevice.pde ├── DmxVisualise │ ├── DmxVisualise.pde │ ├── FixtureDraw.pde │ ├── MovingHeadFixture.pde │ ├── ParCanFixture.pde │ └── Visualiser.pde ├── FadeIn │ └── FadeIn.pde ├── FadeUpDown │ └── FadeUpDown.pde ├── MultipleFixtures │ └── MultipleFixtures.pde ├── README ├── SingleFixture │ └── SingleFixture.pde ├── TimelineExample │ └── TimelineExample.pde └── TriggerParam │ └── TriggerParam.pde ├── lib ├── README ├── jna-5.12.1.jar └── jna-platform-5.12.1.jar ├── library ├── Dmx4Artists.jar ├── README ├── jna-platform.jar └── jna.jar ├── license.txt ├── resources ├── README.md ├── build.properties ├── build.xml ├── code │ ├── ExampleTaglet.class │ ├── ExampleTaglet.java │ └── ant-contrib-1.0b3.jar ├── library.properties └── stylesheet.css ├── src ├── .DS_Store └── com │ ├── .DS_Store │ └── jaysonh │ ├── .DS_Store │ └── dmx4artists │ ├── DMXControl.java │ ├── DMXFixture.java │ ├── DMXParam.java │ ├── DMXParamOsc.java │ ├── DMXParamStatic.java │ ├── FTDIDmx.java │ ├── FTDIException.java │ ├── FTDI_D2XX.java │ ├── FTDevice.java │ ├── HSBColor.java │ ├── LinuxValidator.java │ ├── MoveBehaviour.java │ ├── OSXCommand.java │ ├── OSXValidator.java │ ├── PathFinder.java │ ├── SystemValidator.java │ ├── Timeline.java │ ├── TimelineDisplay.java │ ├── TimelineEvent.java │ └── WINValidator.java └── web ├── index.html └── stylesheet.css /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | custom: ['https://www.paypal.com/donate/?hosted_button_id=SW3V3XNHNU9ME'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ___ __ ____ __ ____ ___ ___ ________________________ 2 | / _ \/ |/ / |/_/ / / / / _ | / _ \/_ __/ _/ __/_ __/ __/ 3 | / // / /|_/ /> < /_ _/ / __ |/ , _/ / / _/ /_\ \ / / _\ \ 4 | /____/_/ /_/_/|_| /_/ /_/ |_/_/|_| /_/ /___/___/ /_/ /___/ 5 | 6 | # Introduction 7 | This is a processing library to control generic FTDI DMX USB devices, such as the Enttec Open DMX device. The library is designed to be as easy to use as possible for people 8 | that are new to programming and DMX lighting. It includes methods and classes for creating timelines, oscilators, trigger events and other behaviours to make it easy to control 9 | your DMX based lighting fixtures. 10 | 11 | This library has been tested and works with both Windows and OSX. It is designed to be used with generic FTDI DMX USB devices which are commonly found in the cheap usb DMX 12 | controllers you find on Taobao and Aliexpress. 13 | 14 | ![USB DMX Device](https://github.com/jaysonh/Dmx4Artists/blob/main/assets/images/usb-dmx.jpg) 15 | 16 | ## Version 17 | The latest version of this library 2.1 has been updated to work with Processing 4 on macbook intel/arm, windows 10, linux (ubuntu 64 bit) 18 | 19 | ## Setting up 20 | 21 | The library should now run straight away without any configuration. But if you are having problems please follow the steps below: 22 | 23 | ### OSX 24 | 1. Copy the libftd2xx.1.4.24.dylib in the dependencies folder to /usr/local/lib folder (requires sudo) 25 | 2. Set the permissions for symlink: sudo chmod a+r /usr/local/lib/libftd2xx.1.4.24.dylib 26 | 3. Create a symlink: sudo ln -sf /usr/local/lib/libftd2xx.1.4.24.dylib /usr/local/lib/libftd2xx.dylib 27 | 4. Set the permissions for symlink: sudo chmod a+r /usr/local/lib/libftd2xx.dylib 28 | 5. Check that the AppleFTDI driver is not enabled: sudo kextunload -b com.apple.driver.AppleUSBFTDI 29 | 30 | ### Windows 31 | 32 | Put the ftd2xx.dll file in the dependencies/win folder into your C:/windows/system32 folder 33 | 34 | ### Linux 35 | 36 | Tested and working on ubuntu 22.04 LTS. Should work on other linux distros, just make sure you have the correct libftd2xx.so file located in /usr/local/lib/ 37 | 38 | You can download the correct libftd2xx.so file for your system from here: https://ftdichip.com/drivers/d2xx-drivers/ 39 | 40 | For raspberry pi try the hard float versions although this is untested. 41 | 42 | ### Still having problems? 43 | 44 | Try installing qlc plus https://qlcplus.org/ which may set up some extra system properties that need to be set 45 | 46 | ### Donate 47 | 48 | [![Donate with PayPal](https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SW3V3XNHNU9ME) 49 | 50 | If you find this project useful then feel free to make a small donation. 51 | 52 | ### Thanks 53 | 54 | This library was create for the DMX Lighting for Artists workshop for OFCourse in Shanghai, that was run in 2019 and continuously updated since. Credit to Omar Khan whose code helped me to understand how to interface with FTDI device https://github.com/orcaomar -------------------------------------------------------------------------------- /assets/images/usb-dmx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/assets/images/usb-dmx.jpg -------------------------------------------------------------------------------- /bin/resources/code/ExampleTaglet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/resources/code/ExampleTaglet.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/DMXControl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/DMXControl.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/DMXFixture.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/DMXFixture.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/DMXParam.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/DMXParam.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/DMXParamOsc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/DMXParamOsc.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/DMXParamStatic.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/DMXParamStatic.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/FTDIDmx.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/FTDIDmx.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/FTDIException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/FTDIException.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/FTDI_D2XX.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/FTDI_D2XX.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/FTDevice.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/FTDevice.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/HSBColor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/HSBColor.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/LinuxValidator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/LinuxValidator.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/MoveBehaviour.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/MoveBehaviour.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/OSXCommand.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/OSXCommand.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/OSXValidator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/OSXValidator.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/PathFinder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/PathFinder.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/SystemValidator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/SystemValidator.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/Timeline.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/Timeline.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/TimelineDisplay.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/TimelineDisplay.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/TimelineEvent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/TimelineEvent.class -------------------------------------------------------------------------------- /bin/src/com/jaysonh/dmx4artists/WINValidator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/bin/src/com/jaysonh/dmx4artists/WINValidator.class -------------------------------------------------------------------------------- /data/README: -------------------------------------------------------------------------------- 1 | the data folder: 2 | If your Library is using files like images, sound files, 3 | any data file, etc., put them into the data folder. 4 | When coding your Library you can use processing's internal loading 5 | functions like loadImage(), loadStrings(), etc. to load files 6 | located inside the data folder into your Library. 7 | 8 | -------------------------------------------------------------------------------- /dependencies/linux/libftd2xx.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/dependencies/linux/libftd2xx.so -------------------------------------------------------------------------------- /dependencies/linux/libftd2xx.so.1.4.27: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/dependencies/linux/libftd2xx.so.1.4.27 -------------------------------------------------------------------------------- /dependencies/osx/libftd2xx.1.4.24.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/dependencies/osx/libftd2xx.1.4.24.dylib -------------------------------------------------------------------------------- /dependencies/win/ftd2xx.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/dependencies/win/ftd2xx.dll -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/README.md: -------------------------------------------------------------------------------- 1 | ## How to install Dmx4Artists 2 | 3 | ### Install with the Contribution Manager 4 | 5 | Add contributed Libraries by selecting the menu item _Sketch_ → _Import Library..._ → _Add Library..._ This will open the Contribution Manager, where you can browse for Dmx4Artists, or any other Library you want to install. 6 | 7 | Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below. 8 | 9 | ### Manual Install 10 | 11 | Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top. 12 | 13 | By default the following locations are used for your sketchbook folder: 14 | * For Mac users, the sketchbook folder is located inside `~/Documents/Processing` 15 | * For Windows users, the sketchbook folder is located inside `My Documents/Processing` 16 | 17 | Download Dmx4Artists from www.jaysonh.com 18 | 19 | Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist. 20 | 21 | The folder structure for Library Dmx4Artists should be as follows: 22 | 23 | ``` 24 | Processing 25 | libraries 26 | Dmx4Artists 27 | examples 28 | library 29 | Dmx4Artists.jar 30 | reference 31 | src 32 | ``` 33 | 34 | Some folders like `examples` or `src` might be missing. After Library Dmx4Artists has been successfully installed, restart the Processing application. 35 | 36 | ### Troubleshooting 37 | 38 | If you're having trouble, have a look at the [Processing Wiki](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) for more information, or contact the author [Jayson Haebich](http://www.jaysonh.com). 39 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/download/Dmx4Artists-2.0.txt: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your Library as you want it formatted. 5 | name = Dmx4Artists 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [Jayson Haebich](http://www.jaysonh.com) 9 | 10 | # A web page for your Library, NOT a direct link to where to download it. 11 | url = www.jaysonh.com 12 | 13 | # The category (or categories) of your Library, must be from the following list: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your Library will listed as 20 | # "Other". Many categories must be comma-separated. 21 | categories = Hardware 22 | 23 | # A short sentence (or fragment) to summarize the Library's function. This will 24 | # be shown from inside the PDE when the Library is being installed. Avoid 25 | # repeating the name of your Library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a Library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = Easy to use library for controlling DMX lights with an FTDI USB controller. 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your Library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | # A version number that increments once with each release. This is used to 41 | # compare different versions of the same Library, and check if an update is 42 | # available. You should think of it as a counter, counting the total number of 43 | # releases you've had. 44 | version = 2.0 # This must be parsable as an int 45 | 46 | # The version as the user will see it. If blank, the version attribute will be 47 | # used here. This should be a single word, with no spaces. 48 | prettyVersion = 2.0.0 # This is treated as a String 49 | 50 | # The min and max revision of Processing compatible with your Library. 51 | # Note that these fields use the revision and not the version of Processing, 52 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 53 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 54 | # Only use maxRevision (or minRevision), when your Library is known to 55 | # break in a later (or earlier) release. Otherwise, use the default value 0. 56 | minRevision = 0 57 | maxRevision = 0 58 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/download/Dmx4Artists-2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/distribution/Dmx4Artists-2.0/download/Dmx4Artists-2.0.zip -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/download/Dmx4Artists.txt: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your Library as you want it formatted. 5 | name = Dmx4Artists 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [Jayson Haebich](http://www.jaysonh.com) 9 | 10 | # A web page for your Library, NOT a direct link to where to download it. 11 | url = www.jaysonh.com 12 | 13 | # The category (or categories) of your Library, must be from the following list: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your Library will listed as 20 | # "Other". Many categories must be comma-separated. 21 | categories = Hardware 22 | 23 | # A short sentence (or fragment) to summarize the Library's function. This will 24 | # be shown from inside the PDE when the Library is being installed. Avoid 25 | # repeating the name of your Library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a Library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = Easy to use library for controlling DMX lights with an FTDI USB controller. 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your Library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | # A version number that increments once with each release. This is used to 41 | # compare different versions of the same Library, and check if an update is 42 | # available. You should think of it as a counter, counting the total number of 43 | # releases you've had. 44 | version = 2.0 # This must be parsable as an int 45 | 46 | # The version as the user will see it. If blank, the version attribute will be 47 | # used here. This should be a single word, with no spaces. 48 | prettyVersion = 2.0.0 # This is treated as a String 49 | 50 | # The min and max revision of Processing compatible with your Library. 51 | # Note that these fields use the revision and not the version of Processing, 52 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 53 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 54 | # Only use maxRevision (or minRevision), when your Library is known to 55 | # break in a later (or earlier) release. Otherwise, use the default value 0. 56 | minRevision = 0 57 | maxRevision = 0 58 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/download/Dmx4Artists.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/distribution/Dmx4Artists-2.0/download/Dmx4Artists.zip -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/BasicControl/BasicControl.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: BasicControl 4 | * 5 | * This is a simple example where we open the first available dmx device and set dmx channels 6 | * 0 and 1 to the mouse value 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | void setup() 17 | { 18 | size( 600, 600 ); 19 | 20 | // Connect to the first dmx usb device available 21 | dmx = new DMXControl( 0, numDmxChannels ); 22 | } 23 | 24 | void draw() 25 | { 26 | background( 0 ); 27 | 28 | // take the mouse pos and convert it to a number between 0 - 255 29 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 30 | 31 | // Send the mapped value to the dmx channels 1 and 2 to control the light 32 | dmx.sendValue( 1, brightness ); 33 | dmx.sendValue( 2, brightness ); 34 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/ConnectDevice/ConnectDevice.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: ConnectDevice 4 | * 5 | * This example shows connecting to a device with a specified serialNum 6 | * Useful if you have multiple devices connected and want to connect to a specific one of them 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 512; // total number of channels allocated for the dmx device 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to dmx device with serial number: AG0JGSJV 26 | dmx = new DMXControl( "AG0JGSJV", numDmxChannels ); 27 | 28 | light = new DMXFixture( this, lightAddress, numLightChannels); 29 | 30 | dmx.addFixture( light ); // add the rgb light to the dmx controller 31 | 32 | // set light to be purple 33 | light.setParam( 1, 255 ); // set the fader channel to 255 34 | light.setParam( 2, 255 ); // set the red channel to 255 35 | light.setParam( 3, 0 ); // set the green channel to 0 36 | light.setParam( 4, 255 ); // set the blue channel to 255 37 | } 38 | 39 | void draw() 40 | { 41 | background( 0 ); 42 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/DmxVisualise/DmxVisualise.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * DmxVisualiser 3 | * 4 | * This example shows how visualise the DmxFixtures on the screen 5 | * useful if you don't have any lights of your own 6 | */ 7 | import com.jaysonh.dmx4artists.*; 8 | 9 | DMXControl dmx; 10 | 11 | DMXFixture fix1; 12 | DMXFixture fix2; 13 | 14 | // Our visualise object 15 | Visualiser visualiser; 16 | 17 | int parCanAddr = 1; 18 | int movingHeadAddr = 11; 19 | 20 | int parCanNumChannels = 8; 21 | int movingHeadNumChannels = 11; 22 | void setup() 23 | { 24 | size( 1280,720); 25 | 26 | dmx = new DMXControl( 0, 256); 27 | 28 | fix1 = new DMXFixture( this, parCanAddr, parCanNumChannels ); 29 | fix2 = new DMXFixture( this, movingHeadAddr, movingHeadNumChannels ); // uses 11 channel dmx mode for moving head 30 | 31 | 32 | dmx.addFixture( fix1 ); 33 | 34 | // This is the object that will draw the DmxFixtures to the screen 35 | visualiser = new Visualiser(); 36 | visualiser.add( new ParCanFixture( fix1, 20, 20, 40, 40 ) ); 37 | visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, true ) ); // assumes that moving head is using rgb colour mode 38 | //visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, false) ); 39 | } 40 | 41 | void draw() 42 | { 43 | background(0); 44 | 45 | fix1.sendValue( 1, 255); 46 | fix1.sendValue( 2, 255-map( mouseY, 0, height, 0, 255 )); 47 | fix1.sendValue( 3, map( mouseX, 0, width, 0, 255 )); 48 | fix1.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 49 | 50 | fix2.sendValue( 2, map( mouseX, 0, width, 0, 255 )); 51 | fix2.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 52 | fix2.sendValue( 6, 255); 53 | fix2.sendValue( 8, 255); 54 | fix2.sendValue( 9, 0); 55 | fix2.sendValue( 10, 255); 56 | 57 | visualiser.draw(); 58 | } 59 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/DmxVisualise/FixtureDraw.pde: -------------------------------------------------------------------------------- 1 | abstract class FixtureDraw 2 | { 3 | FixtureDraw( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | this.fixture = fixture; 6 | 7 | this.xPos = xPos; 8 | this.yPos = yPos; 9 | this.xSize = xSize; 10 | this.ySize = ySize; 11 | } 12 | 13 | abstract void draw(); 14 | 15 | DMXFixture fixture; 16 | 17 | int xPos; 18 | int yPos; 19 | int xSize; 20 | int ySize; 21 | } 22 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/DmxVisualise/MovingHeadFixture.pde: -------------------------------------------------------------------------------- 1 | class MovingHeadFixture extends FixtureDraw 2 | { 3 | MovingHeadFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize, boolean rgbMode ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | this.rgbMode = rgbMode; 8 | panFineChannel = /*fixture.getAddress() +*/ 1; 9 | panCoarseChannel = /*fixture.getAddress() +*/ 2; 10 | tiltFineChannel = /*fixture.getAddress() +*/ 3; 11 | tiltCoarseChannel = /*fixture.getAddress() +*/ 4; 12 | briChannel = /*fixture.getAddress() +*/ 6; 13 | rChannel = /*fixture.getAddress() +*/ 8; 14 | gChannel = /*fixture.getAddress() +*/ 9; 15 | bChannel = /*fixture.getAddress() +*/ 10; 16 | } 17 | 18 | void draw() 19 | { 20 | pushStyle(); 21 | 22 | if( rgbMode ) // use rgb colour 23 | { 24 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 25 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 26 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 27 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 28 | 29 | fill( r, g , b); 30 | }else // use colour select 31 | { 32 | int colSelect = (int)(fixture.getParam( colSelectChannel ).getValue()); 33 | 34 | setCol( colSelect ); 35 | } 36 | 37 | ellipse( xPos, yPos, xSize, ySize ); 38 | 39 | stroke(255); 40 | fill(255); 41 | // draw pan 42 | float pan = fixture.getParam( panCoarseChannel - 1 ).getValue(); 43 | pushMatrix(); 44 | translate( xPos, yPos + ySize ); 45 | text("pan", 0, -5 ); 46 | rotate( map( pan, 0, 255.0, 0, TWO_PI ) ); 47 | line( 0, 0, xSize/2, 0); 48 | popMatrix(); 49 | 50 | // draw tilt 51 | float tilt = fixture.getParam( tiltCoarseChannel - 1 ).getValue(); 52 | pushMatrix(); 53 | translate( xPos, yPos + ySize * 2.0 ); 54 | text("tilt", 0, -5 ); 55 | rotate( map( tilt, 0, 255.0, 0, TWO_PI ) ); 56 | line( 0, 0, xSize/2, 0); 57 | popMatrix(); 58 | 59 | popStyle(); 60 | } 61 | 62 | void setCol( int col ) 63 | { 64 | switch( col ) 65 | { 66 | case 0: 67 | fill(255,0,0); 68 | break; 69 | case 1: 70 | fill(0,255,0); 71 | break; 72 | case 2: 73 | fill(0,0,255); 74 | break; 75 | case 3: 76 | fill(255,0,255); 77 | break; 78 | case 4: 79 | fill(255,255,0); 80 | break; 81 | } 82 | } 83 | private boolean rgbMode = true; // true - RGB false - colour select 84 | 85 | private int briChannel; 86 | private int rChannel; 87 | private int gChannel; 88 | private int bChannel; 89 | private int wChannel; 90 | 91 | private int panFineChannel; 92 | private int panCoarseChannel; 93 | private int tiltFineChannel; 94 | private int tiltCoarseChannel; 95 | 96 | private int colSelectChannel = 6; // use channel 6 by default 97 | } 98 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/DmxVisualise/ParCanFixture.pde: -------------------------------------------------------------------------------- 1 | class ParCanFixture extends FixtureDraw 2 | { 3 | ParCanFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | // set up default addresses for a par can bri = 1, r = 2, g = 3, b = 4 8 | briChannel = fixture.getAddress(); 9 | rChannel = fixture.getAddress() + 1; 10 | gChannel = fixture.getAddress() + 2; 11 | bChannel = fixture.getAddress() + 3; 12 | } 13 | 14 | void rgbChannels( int rChannel, int gChannel, int bChannel ) 15 | { 16 | brgbwChannels( 0, rChannel, gChannel, bChannel, 0 ); 17 | } 18 | 19 | void rgbwChannels( int rChannel, int gChannel, int bChannel, int wChannel) 20 | { 21 | brgbwChannels( 0, rChannel, gChannel, bChannel, wChannel ); 22 | } 23 | 24 | void brgbwChannels( int briChannel, int rChannel, int gChannel, int bChannel, int wChannel ) 25 | { 26 | this.briChannel = briChannel; 27 | this.rChannel = rChannel; 28 | this.gChannel = gChannel; 29 | this.bChannel = bChannel; 30 | this.wChannel = wChannel; 31 | } 32 | 33 | void draw() 34 | { 35 | pushStyle(); 36 | 37 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 38 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 39 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 40 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 41 | //float w = (wChannel == 0) ? 0 : fixture.getParam( wChannel ).getValue() * ( bri / 255.0 ); 42 | 43 | fill( r, g, b ); 44 | ellipse( xPos, yPos, xSize, ySize ); 45 | 46 | popStyle(); 47 | } 48 | 49 | private int briChannel; 50 | private int rChannel; 51 | private int gChannel; 52 | private int bChannel; 53 | private int wChannel; 54 | } 55 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/DmxVisualise/Visualiser.pde: -------------------------------------------------------------------------------- 1 | class Visualiser 2 | { 3 | 4 | void add( FixtureDraw fix) 5 | { 6 | fixtures.add(fix); 7 | } 8 | 9 | void draw() 10 | { 11 | for( FixtureDraw f : fixtures ) 12 | { 13 | f.draw(); 14 | } 15 | } 16 | ArrayList fixtures = new ArrayList(); 17 | } 18 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/FadeIn/FadeIn.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: FadeIn 4 | * 5 | * This examples shows how you can set lights to fade to a value 6 | * So instead of instantly changing the colour it softly moves that colour for nicer transitions 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | int lightAddress = 1; 17 | int lightChannels = 8; 18 | 19 | DMXFixture fixture; 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to the first dmx usb device available 26 | dmx = new DMXControl( 0, numDmxChannels ); 27 | 28 | dmx.setFixtureFade( true ); // Enable the fixture value fading in 29 | dmx.setFixtureFadeRate( 0.1 ); // (0.0-1.0) closer to 0 then the slower it will fade 30 | 31 | fixture = new DMXFixture( this, lightAddress, lightChannels ); 32 | dmx.addFixture( fixture ); 33 | } 34 | 35 | void draw() 36 | { 37 | background( 0 ); 38 | 39 | // take the mouse pos and convert it to a number between 0 - 255 40 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 41 | 42 | } 43 | 44 | void mousePressed() 45 | { 46 | int brightness = (int)random(0,255); 47 | // Send the mapped value to the dmx channels 1 and 2 to control the light 48 | fixture.sendValue( 1, brightness ); 49 | fixture.sendValue( 2, 255); 50 | } 51 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/FadeUpDown/FadeUpDown.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Fade up down 4 | * 5 | * Shows how you can fade a fixtures brightness up and down using an oscillator param 6 | * 7 | * Assumes you have connected two typical RGB can lights 8 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 9; 19 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 21 | 22 | // These control a param 23 | DMXParam fadeSlow; 24 | DMXParam fadeFast; 25 | 26 | void setup() 27 | { 28 | size( 600, 600 ); 29 | 30 | // Connect to the first dmx usb device available 31 | dmx = new DMXControl( 0, numDmxChannels ); 32 | 33 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 34 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 35 | 36 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 37 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 38 | 39 | // Set up our param oscillators 40 | // The way these work is you create them at startup and assign them to a fixture channel 41 | // The params will change over time and automatically be sent to that param 42 | fadeSlow = new DMXParamOsc( this, 43 | 10.0, // oscillate over 10 seconds 44 | 0, // min dmx value 45 | 255, // max dmx value 46 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 47 | 0, // num times to repeat 0 = infinite repeat 48 | true); // autostart 49 | 50 | fadeFast = new DMXParamOsc( this, 51 | 2.5, // oscillate over 2.5 seconds 52 | 0, // min dmx value 53 | 255, // max dmx value 54 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 55 | 0, // num times to repeat 0 = infinite repeat 56 | true); // autostart 57 | 58 | 59 | // set light 1 to be purple 60 | light1.sendValue( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light1.sendValue( 2, 255 ); // set the red channel to 255 62 | light1.sendValue( 3, 0 ); // set the green channel to 0 63 | light1.sendValue( 4, 255 ); // set the blue channel to 255 64 | 65 | // set light 2 to be green 66 | light2.sendValue( 1, fadeFast ); // set the fader channel to the fast oscillator 67 | light2.sendValue( 2, 0 ); // set the red channel to 0 68 | light2.sendValue( 3, 255 ); // set the green channel to 255 69 | light2.sendValue( 4, 0 ); // set the blue channel to 0 70 | 71 | } 72 | 73 | void draw() 74 | { 75 | background( 0 ); 76 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/MultipleFixtures/MultipleFixtures.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Multiple Fixtures 4 | * 5 | * This is a simple example where we control two lights 6 | * 7 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 8 | * channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 7; 19 | int numLightChannels = 6; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 511; // total number of channels allocated for the dmx device, must not be more than 511 21 | 22 | void setup() 23 | { 24 | size( 600, 600 ); 25 | 26 | // Connect to the first dmx usb device available 27 | dmx = new DMXControl( 0, numDmxChannels ); 28 | 29 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 30 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 31 | 32 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 33 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 34 | 35 | // set light 1 to be purple 36 | light1.sendValue( 1, 255 ); // set the fader channel to 255 37 | light1.sendValue( 2, 255 ); // set the red channel to 255 38 | light1.sendValue( 3, 0 ); // set the green channel to 0 39 | light1.sendValue( 4, 255 ); // set the blue channel to 255 40 | 41 | // set light 2 to be green 42 | light2.sendValue( 1, 255 ); // set the fader channel to 255 43 | light2.sendValue( 2, 0 ); // set the red channel to 0 44 | light2.sendValue( 3, 255 ); // set the green channel to 255 45 | light2.sendValue( 4, 0 ); // set the blue channel to 0 46 | 47 | } 48 | 49 | void draw() 50 | { 51 | background( 0 ); 52 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/SingleFixture/SingleFixture.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Single Fixture 4 | * 5 | * This is a simple example where we open the first available dmx device and set a 6 | * a random colour when a key is pressed 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture rgbLight; 16 | int lightAddress = 1; 17 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 18 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 19 | 20 | void setup() 21 | { 22 | size( 600, 600 ); 23 | 24 | // Connect to the first dmx usb device available 25 | dmx = new DMXControl( 0, numDmxChannels ); 26 | 27 | rgbLight = new DMXFixture( this, lightAddress, numLightChannels); 28 | dmx.addFixture( rgbLight ); // add the rgb light to the dmx controller 29 | 30 | 31 | } 32 | 33 | void draw() 34 | { 35 | background( 0 ); 36 | } 37 | 38 | void keyPressed() 39 | { 40 | // when we detect a key press then set the rgb light to a random colour 41 | rgbLight.sendValue( 1, 255 ); // set the fader channel to 255 42 | rgbLight.sendValue( 2, ( int )random( 0, 255 ) ); // red 43 | rgbLight.sendValue( 3, ( int )random( 0, 255 ) ); // green 44 | rgbLight.sendValue( 4, ( int )random( 0, 255 ) ); // blue 45 | //rgbLight.sendValue( 5, ( int )random( 0, 255 ) ); // white, uncomment if your light has a white channel 46 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/TimelineExample/TimelineExample.pde: -------------------------------------------------------------------------------- 1 | import com.jaysonh.dmx4artists.*; 2 | 3 | DMXControl dmx; 4 | DMXFixture fixture; 5 | 6 | DMXParam fadeOscSlow; 7 | DMXParam fadeOscFast; 8 | 9 | int maxDmxChannels = 9; 10 | int numLightChannels = 8; 11 | int lightAddress = 1; 12 | 13 | Timeline timeline; 14 | TimelineDisplay timeDisplay; 15 | 16 | void setup() 17 | { 18 | size(600,600); 19 | 20 | dmx = new DMXControl( 0, maxDmxChannels ); // connect to the first dmx device (0) 21 | 22 | 23 | fadeOscSlow = new DMXParamOsc( this, 24 | 5.0, // oscillate over 5 seconds 25 | 0, // min dmx value 26 | 255, // max dmx value 27 | MoveBehaviour.OSC_SINE, 28 | 1,// num times to repeat 0 = infinite repeat 29 | false); // do not autostart 30 | 31 | fadeOscFast = new DMXParamOsc( this, 32 | 2.5, // oscillate over 2.5 seconds 33 | 0, // min dmx value 34 | 255, // max dmx value 35 | MoveBehaviour.OSC_SINE, 36 | 2, // num times to repeat 0 = infinite repeat 37 | false); // do not autostart 38 | 39 | fixture = new DMXFixture( this, lightAddress, numLightChannels); // create a new fixture 40 | dmx.addFixture( fixture ); // add the fixture to the dmx controller 41 | 42 | 43 | fixture.setParam(2,255); 44 | fixture.setParam(3,255); 45 | 46 | DMXParamStatic p0 = new DMXParamStatic(this,50); 47 | DMXParamStatic p1 = new DMXParamStatic(this,100); 48 | DMXParamStatic p2 = new DMXParamStatic(this,150); 49 | DMXParamStatic p3 = new DMXParamStatic(this,200); 50 | DMXParamStatic p4 = new DMXParamStatic(this,250); 51 | 52 | timeDisplay = new TimelineDisplay( width, height,this ); 53 | timeline = new Timeline( this, 30.0 ); // create a timline with a duration of 30 seconds, it will repeat by default 54 | 55 | timeline.add( fixture, fadeOscSlow, 1, 1.0, 5.0); 56 | timeline.add( fixture, p1, 1, 8.0, 10.0); 57 | timeline.add( fixture, fadeOscFast, 1, 10.0,15.0); 58 | timeline.add( fixture, p3, 1, 15.0,20.0); 59 | timeline.add( fixture, p4, 1, 20.0,25.0); 60 | 61 | timeline.begin(); 62 | } 63 | 64 | void draw() 65 | { 66 | background(0,0,0); 67 | 68 | PGraphics timelineDisp = timeDisplay.update( timeline, width, height ); 69 | image( timelineDisp, 0, 0 ); 70 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/examples/TriggerParam/TriggerParam.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Trigger param 4 | * 5 | * Shows how you can trigger one param to change after another param is finished 6 | * For example you can make a light pulse once slowly then when it finishes trigger it to pulse slowly 7 | * 8 | * Assumes you have connected two typical RGB can lights 9 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 511; // total number of channels allocated for the dmx device 20 | 21 | // These control a param 22 | DMXParam fadeSlow; 23 | DMXParam fadeFast; 24 | 25 | void setup() 26 | { 27 | size( 600, 600 ); 28 | 29 | // Connect to the first dmx usb device available 30 | dmx = new DMXControl( 0, numDmxChannels ); 31 | 32 | light = new DMXFixture( this, lightAddress, numLightChannels); 33 | 34 | dmx.addFixture( light ); // add the rgb light to the dmx controller 35 | 36 | // Set up our param oscillators 37 | // The way these work is you create them at startup and assign them to a fixture channel 38 | // The params will change over time and automatically be sent to that param 39 | fadeSlow = new DMXParamOsc( this, 40 | 10.0, // oscillate over 10 seconds 41 | 0, // min dmx value 42 | 255, // max dmx value 43 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 44 | 1, // num times to repeat 0 = infinite repeat 45 | true); // autostart 46 | 47 | fadeFast = new DMXParamOsc( this, 48 | 2.5, // oscillate over 2.5 seconds 49 | 0, // min dmx value 50 | 255, // max dmx value 51 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 52 | 0, // num times to repeat 0 = infinite repeat 53 | false); // autostart 54 | 55 | // add the fadeFast trigger to the fadeSlow trigger, so that when the fadeSlow trigger finishes the 56 | // fadeFast trigger will begin 57 | fadeSlow.addTrigger( fadeFast ); 58 | 59 | // set light 1 to be purple 60 | light.setParam( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light.setParam( 2, 255 ); // set the red channel to 255 62 | light.setParam( 3, 0 ); // set the green channel to 0 63 | light.setParam( 4, 255 ); // set the blue channel to 255 64 | 65 | } 66 | 67 | void draw() 68 | { 69 | background( 0 ); 70 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Dmx4Artists 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 25 | 26 | 38 | 39 |
40 | 41 |
42 |

Dmx4Artists

43 |

44 | A Library by Jayson Haebich for the Processing programming environment.
45 | Last update, 10/25/2023. 46 |

47 |

48 | Easy to use library for controlling DMX lights with an FTDI USB controller.
49 |
50 | Feel free to replace this paragraph with a description of the Library.
51 | Contributed Libraries are developed, documented, and maintained by members of the Processing community. Further directions are included with each Library. For feedback and support, please post to the Discourse. We strongly encourage all Libraries to be open source, but not all of them are. 52 |

53 |
54 | 55 | 56 | 57 |
58 |

Download

59 |

60 | Download Dmx4Artists version 2.0.0 (2.0) in 61 | .zip format. 62 |

63 |

Installation

64 |

65 | Unzip and put the extracted Dmx4Artists folder into the libraries folder of your Processing sketches. Reference and examples are included in the Dmx4Artists folder. 66 |

67 |
68 | 69 | 70 |
71 |

Keywords. DMX,lighting

72 |

Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.

73 |

Source. The source code of Dmx4Artists is available at GitHub, and its repository can be browsed here.

74 |
75 | 76 | 77 |
78 |

Examples

79 |

Find a list of examples in the current distribution of Dmx4Artists, or have a look at them by following the links below.

80 | 83 |
84 | 85 | 86 |
87 |

Tested

88 |

89 | 90 | Platform osx,windows 91 | 92 | 93 |
Processing 3.2.3 94 | 95 | 96 |
Dependencies ? 97 |

98 |
99 | 100 | 101 | 102 | 114 | 115 | 116 | 121 | 122 | 123 | 127 | 128 | 129 |
130 |
131 | 132 | 135 |
136 | 137 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.0/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* processingLibs style by andreas schlegel, sojamo. */ 2 | 3 | 4 | * { 5 | margin:0; 6 | padding:0; 7 | border:0; 8 | } 9 | 10 | 11 | body { 12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; 13 | font-size : 100%; 14 | font-size : 0.70em; 15 | font-weight : normal; 16 | line-height : normal; 17 | } 18 | 19 | 20 | 21 | #container { 22 | margin-left:64px; 23 | background-color:#fff; 24 | } 25 | 26 | #header { 27 | float:left; 28 | padding-top:24px; 29 | padding-bottom:48px; 30 | } 31 | 32 | #menu { 33 | margin-top:16px; 34 | float:left; 35 | margin-bottom:64px; 36 | } 37 | 38 | 39 | #about, 40 | #download, 41 | #examples, 42 | #demos, 43 | #misc { 44 | width:480px; 45 | float:left; 46 | margin-right:24px; 47 | } 48 | 49 | 50 | #resources, #info { 51 | width:320px; 52 | float:left; 53 | } 54 | 55 | 56 | .clear { 57 | clear:both; 58 | } 59 | 60 | #footer { 61 | margin-top:300px; 62 | height:20px; 63 | margin-bottom:32px; 64 | } 65 | 66 | 67 | ul { 68 | list-style:none; 69 | padding:0; 70 | margin:0; 71 | } 72 | 73 | 74 | #menu ul li, #subMenu ul li { 75 | float:left; 76 | padding-right:6px; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | /* Headings */ 85 | 86 | h1 { 87 | font-size:2em; 88 | font-weight:normal; 89 | } 90 | 91 | 92 | h2, h3, h4, h5, th { 93 | font-size:1.3em; 94 | font-weight:normal; 95 | margin-bottom:4px; 96 | } 97 | 98 | 99 | 100 | p { 101 | font-size:1em; 102 | width:90%; 103 | margin-bottom:32px; 104 | } 105 | 106 | 107 | pre, code { 108 | font-family:"Courier New", Courier, monospace; 109 | font-size:1em; 110 | line-height:normal; 111 | } 112 | 113 | 114 | 115 | 116 | hr { 117 | border:0; 118 | height:1px; 119 | margin-bottom:24px; 120 | } 121 | 122 | 123 | a { 124 | text-decoration: underline; 125 | font-weight: normal; 126 | } 127 | 128 | 129 | a:hover, 130 | a:active { 131 | text-decoration: underline; 132 | font-weight: normal; 133 | } 134 | 135 | 136 | a:visited, 137 | a:link:visited { 138 | text-decoration: underline; 139 | font-weight: normal; 140 | } 141 | 142 | 143 | 144 | img { 145 | border: 0px solid #000000; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | /* COLORS */ 153 | 154 | 155 | body { 156 | color : #333; 157 | background-color :#fff; 158 | } 159 | 160 | 161 | #header { 162 | background-color:#fff; 163 | color:#333; 164 | } 165 | 166 | 167 | 168 | h1, h2, h3, h4, h5, h6 { 169 | color:#666; 170 | } 171 | 172 | 173 | pre, code { 174 | color: #000000; 175 | } 176 | 177 | 178 | a,strong { 179 | color: #333; 180 | } 181 | 182 | 183 | a:hover, 184 | a:active { 185 | color: #333; 186 | } 187 | 188 | 189 | a:visited, 190 | a:link:visited { 191 | color: #333; 192 | } 193 | 194 | 195 | #footer, #menu { 196 | background-color:#fff; 197 | color:#333; 198 | } 199 | 200 | 201 | #footer a, #menu a { 202 | color:#333; 203 | } 204 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/README.md: -------------------------------------------------------------------------------- 1 | ## How to install Dmx4Artists 2 | 3 | ### Install with the Contribution Manager 4 | 5 | Add contributed Libraries by selecting the menu item _Sketch_ → _Import Library..._ → _Add Library..._ This will open the Contribution Manager, where you can browse for Dmx4Artists, or any other Library you want to install. 6 | 7 | Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below. 8 | 9 | ### Manual Install 10 | 11 | Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top. 12 | 13 | By default the following locations are used for your sketchbook folder: 14 | * For Mac users, the sketchbook folder is located inside `~/Documents/Processing` 15 | * For Windows users, the sketchbook folder is located inside `My Documents/Processing` 16 | 17 | Download Dmx4Artists from www.jaysonh.com 18 | 19 | Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist. 20 | 21 | The folder structure for Library Dmx4Artists should be as follows: 22 | 23 | ``` 24 | Processing 25 | libraries 26 | Dmx4Artists 27 | examples 28 | library 29 | Dmx4Artists.jar 30 | reference 31 | src 32 | ``` 33 | 34 | Some folders like `examples` or `src` might be missing. After Library Dmx4Artists has been successfully installed, restart the Processing application. 35 | 36 | ### Troubleshooting 37 | 38 | If you're having trouble, have a look at the [Processing Wiki](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) for more information, or contact the author [Jayson Haebich](http://www.jaysonh.com). 39 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/download/Dmx4Artists-2.1.txt: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your Library as you want it formatted. 5 | name = Dmx4Artists 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [Jayson Haebich](http://www.jaysonh.com) 9 | 10 | # A web page for your Library, NOT a direct link to where to download it. 11 | url = www.jaysonh.com 12 | 13 | # The category (or categories) of your Library, must be from the following list: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your Library will listed as 20 | # "Other". Many categories must be comma-separated. 21 | categories = Hardware 22 | 23 | # A short sentence (or fragment) to summarize the Library's function. This will 24 | # be shown from inside the PDE when the Library is being installed. Avoid 25 | # repeating the name of your Library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a Library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = Easy to use library for controlling DMX lights with an FTDI USB controller. 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your Library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | # A version number that increments once with each release. This is used to 41 | # compare different versions of the same Library, and check if an update is 42 | # available. You should think of it as a counter, counting the total number of 43 | # releases you've had. 44 | version = 2.1 # This must be parsable as an int 45 | 46 | # The version as the user will see it. If blank, the version attribute will be 47 | # used here. This should be a single word, with no spaces. 48 | prettyVersion = 2.1.0 # This is treated as a String 49 | 50 | # The min and max revision of Processing compatible with your Library. 51 | # Note that these fields use the revision and not the version of Processing, 52 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 53 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 54 | # Only use maxRevision (or minRevision), when your Library is known to 55 | # break in a later (or earlier) release. Otherwise, use the default value 0. 56 | minRevision = 0 57 | maxRevision = 0 58 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/download/Dmx4Artists-2.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/distribution/Dmx4Artists-2.1/download/Dmx4Artists-2.1.zip -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/download/Dmx4Artists.txt: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your Library as you want it formatted. 5 | name = Dmx4Artists 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [Jayson Haebich](http://www.jaysonh.com) 9 | 10 | # A web page for your Library, NOT a direct link to where to download it. 11 | url = www.jaysonh.com 12 | 13 | # The category (or categories) of your Library, must be from the following list: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your Library will listed as 20 | # "Other". Many categories must be comma-separated. 21 | categories = Hardware 22 | 23 | # A short sentence (or fragment) to summarize the Library's function. This will 24 | # be shown from inside the PDE when the Library is being installed. Avoid 25 | # repeating the name of your Library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a Library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = Easy to use library for controlling DMX lights with an FTDI USB controller. 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your Library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | # A version number that increments once with each release. This is used to 41 | # compare different versions of the same Library, and check if an update is 42 | # available. You should think of it as a counter, counting the total number of 43 | # releases you've had. 44 | version = 2.1 # This must be parsable as an int 45 | 46 | # The version as the user will see it. If blank, the version attribute will be 47 | # used here. This should be a single word, with no spaces. 48 | prettyVersion = 2.1.0 # This is treated as a String 49 | 50 | # The min and max revision of Processing compatible with your Library. 51 | # Note that these fields use the revision and not the version of Processing, 52 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 53 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 54 | # Only use maxRevision (or minRevision), when your Library is known to 55 | # break in a later (or earlier) release. Otherwise, use the default value 0. 56 | minRevision = 0 57 | maxRevision = 0 58 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/download/Dmx4Artists.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/distribution/Dmx4Artists-2.1/download/Dmx4Artists.zip -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/BasicControl/BasicControl.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: BasicControl 4 | * 5 | * This is a simple example where we open the first available dmx device and set dmx channels 6 | * 0 and 1 to the mouse value 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | void setup() 17 | { 18 | size( 600, 600 ); 19 | 20 | // Connect to the first dmx usb device available 21 | dmx = new DMXControl( 0, numDmxChannels ); 22 | } 23 | 24 | void draw() 25 | { 26 | background( 0 ); 27 | 28 | // take the mouse pos and convert it to a number between 0 - 255 29 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 30 | 31 | // Send the mapped value to the dmx channels 1 and 2 to control the light 32 | dmx.sendValue( 1, brightness ); 33 | dmx.sendValue( 2, brightness ); 34 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/ConnectDevice/ConnectDevice.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: ConnectDevice 4 | * 5 | * This example shows connecting to a device with a specified serialNum 6 | * Useful if you have multiple devices connected and want to connect to a specific one of them 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 512; // total number of channels allocated for the dmx device 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to dmx device with serial number: AG0JGSJV 26 | dmx = new DMXControl( "AG0JGSJV", numDmxChannels ); 27 | 28 | light = new DMXFixture( this, lightAddress, numLightChannels); 29 | 30 | dmx.addFixture( light ); // add the rgb light to the dmx controller 31 | 32 | // set light to be purple 33 | light.setParam( 1, 255 ); // set the fader channel to 255 34 | light.setParam( 2, 255 ); // set the red channel to 255 35 | light.setParam( 3, 0 ); // set the green channel to 0 36 | light.setParam( 4, 255 ); // set the blue channel to 255 37 | } 38 | 39 | void draw() 40 | { 41 | background( 0 ); 42 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/DmxVisualise/DmxVisualise.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * DmxVisualiser 3 | * 4 | * This example shows how visualise the DmxFixtures on the screen 5 | * useful if you don't have any lights of your own 6 | */ 7 | import com.jaysonh.dmx4artists.*; 8 | 9 | DMXControl dmx; 10 | 11 | DMXFixture fix1; 12 | DMXFixture fix2; 13 | 14 | // Our visualise object 15 | Visualiser visualiser; 16 | 17 | int parCanAddr = 1; 18 | int movingHeadAddr = 11; 19 | 20 | int parCanNumChannels = 8; 21 | int movingHeadNumChannels = 11; 22 | void setup() 23 | { 24 | size( 1280,720); 25 | 26 | dmx = new DMXControl( 0, 256); 27 | 28 | fix1 = new DMXFixture( this, parCanAddr, parCanNumChannels ); 29 | fix2 = new DMXFixture( this, movingHeadAddr, movingHeadNumChannels ); // uses 11 channel dmx mode for moving head 30 | 31 | 32 | dmx.addFixture( fix1 ); 33 | 34 | // This is the object that will draw the DmxFixtures to the screen 35 | visualiser = new Visualiser(); 36 | visualiser.add( new ParCanFixture( fix1, 20, 20, 40, 40 ) ); 37 | visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, true ) ); // assumes that moving head is using rgb colour mode 38 | //visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, false) ); 39 | } 40 | 41 | void draw() 42 | { 43 | background(0); 44 | 45 | fix1.sendValue( 1, 255); 46 | fix1.sendValue( 2, 255-map( mouseY, 0, height, 0, 255 )); 47 | fix1.sendValue( 3, map( mouseX, 0, width, 0, 255 )); 48 | fix1.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 49 | 50 | fix2.sendValue( 2, map( mouseX, 0, width, 0, 255 )); 51 | fix2.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 52 | fix2.sendValue( 6, 255); 53 | fix2.sendValue( 8, 255); 54 | fix2.sendValue( 9, 0); 55 | fix2.sendValue( 10, 255); 56 | 57 | visualiser.draw(); 58 | } 59 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/DmxVisualise/FixtureDraw.pde: -------------------------------------------------------------------------------- 1 | abstract class FixtureDraw 2 | { 3 | FixtureDraw( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | this.fixture = fixture; 6 | 7 | this.xPos = xPos; 8 | this.yPos = yPos; 9 | this.xSize = xSize; 10 | this.ySize = ySize; 11 | } 12 | 13 | abstract void draw(); 14 | 15 | DMXFixture fixture; 16 | 17 | int xPos; 18 | int yPos; 19 | int xSize; 20 | int ySize; 21 | } 22 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/DmxVisualise/MovingHeadFixture.pde: -------------------------------------------------------------------------------- 1 | class MovingHeadFixture extends FixtureDraw 2 | { 3 | MovingHeadFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize, boolean rgbMode ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | this.rgbMode = rgbMode; 8 | panFineChannel = /*fixture.getAddress() +*/ 1; 9 | panCoarseChannel = /*fixture.getAddress() +*/ 2; 10 | tiltFineChannel = /*fixture.getAddress() +*/ 3; 11 | tiltCoarseChannel = /*fixture.getAddress() +*/ 4; 12 | briChannel = /*fixture.getAddress() +*/ 6; 13 | rChannel = /*fixture.getAddress() +*/ 8; 14 | gChannel = /*fixture.getAddress() +*/ 9; 15 | bChannel = /*fixture.getAddress() +*/ 10; 16 | } 17 | 18 | void draw() 19 | { 20 | pushStyle(); 21 | 22 | if( rgbMode ) // use rgb colour 23 | { 24 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 25 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 26 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 27 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 28 | 29 | fill( r, g , b); 30 | }else // use colour select 31 | { 32 | int colSelect = (int)(fixture.getParam( colSelectChannel ).getValue()); 33 | 34 | setCol( colSelect ); 35 | } 36 | 37 | ellipse( xPos, yPos, xSize, ySize ); 38 | 39 | stroke(255); 40 | fill(255); 41 | // draw pan 42 | float pan = fixture.getParam( panCoarseChannel - 1 ).getValue(); 43 | pushMatrix(); 44 | translate( xPos, yPos + ySize ); 45 | text("pan", 0, -5 ); 46 | rotate( map( pan, 0, 255.0, 0, TWO_PI ) ); 47 | line( 0, 0, xSize/2, 0); 48 | popMatrix(); 49 | 50 | // draw tilt 51 | float tilt = fixture.getParam( tiltCoarseChannel - 1 ).getValue(); 52 | pushMatrix(); 53 | translate( xPos, yPos + ySize * 2.0 ); 54 | text("tilt", 0, -5 ); 55 | rotate( map( tilt, 0, 255.0, 0, TWO_PI ) ); 56 | line( 0, 0, xSize/2, 0); 57 | popMatrix(); 58 | 59 | popStyle(); 60 | } 61 | 62 | void setCol( int col ) 63 | { 64 | switch( col ) 65 | { 66 | case 0: 67 | fill(255,0,0); 68 | break; 69 | case 1: 70 | fill(0,255,0); 71 | break; 72 | case 2: 73 | fill(0,0,255); 74 | break; 75 | case 3: 76 | fill(255,0,255); 77 | break; 78 | case 4: 79 | fill(255,255,0); 80 | break; 81 | } 82 | } 83 | private boolean rgbMode = true; // true - RGB false - colour select 84 | 85 | private int briChannel; 86 | private int rChannel; 87 | private int gChannel; 88 | private int bChannel; 89 | private int wChannel; 90 | 91 | private int panFineChannel; 92 | private int panCoarseChannel; 93 | private int tiltFineChannel; 94 | private int tiltCoarseChannel; 95 | 96 | private int colSelectChannel = 6; // use channel 6 by default 97 | } 98 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/DmxVisualise/ParCanFixture.pde: -------------------------------------------------------------------------------- 1 | class ParCanFixture extends FixtureDraw 2 | { 3 | ParCanFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | // set up default addresses for a par can bri = 1, r = 2, g = 3, b = 4 8 | briChannel = fixture.getAddress(); 9 | rChannel = fixture.getAddress() + 1; 10 | gChannel = fixture.getAddress() + 2; 11 | bChannel = fixture.getAddress() + 3; 12 | } 13 | 14 | void rgbChannels( int rChannel, int gChannel, int bChannel ) 15 | { 16 | brgbwChannels( 0, rChannel, gChannel, bChannel, 0 ); 17 | } 18 | 19 | void rgbwChannels( int rChannel, int gChannel, int bChannel, int wChannel) 20 | { 21 | brgbwChannels( 0, rChannel, gChannel, bChannel, wChannel ); 22 | } 23 | 24 | void brgbwChannels( int briChannel, int rChannel, int gChannel, int bChannel, int wChannel ) 25 | { 26 | this.briChannel = briChannel; 27 | this.rChannel = rChannel; 28 | this.gChannel = gChannel; 29 | this.bChannel = bChannel; 30 | this.wChannel = wChannel; 31 | } 32 | 33 | void draw() 34 | { 35 | pushStyle(); 36 | 37 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 38 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 39 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 40 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 41 | //float w = (wChannel == 0) ? 0 : fixture.getParam( wChannel ).getValue() * ( bri / 255.0 ); 42 | 43 | fill( r, g, b ); 44 | ellipse( xPos, yPos, xSize, ySize ); 45 | 46 | popStyle(); 47 | } 48 | 49 | private int briChannel; 50 | private int rChannel; 51 | private int gChannel; 52 | private int bChannel; 53 | private int wChannel; 54 | } 55 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/DmxVisualise/Visualiser.pde: -------------------------------------------------------------------------------- 1 | class Visualiser 2 | { 3 | 4 | void add( FixtureDraw fix) 5 | { 6 | fixtures.add(fix); 7 | } 8 | 9 | void draw() 10 | { 11 | for( FixtureDraw f : fixtures ) 12 | { 13 | f.draw(); 14 | } 15 | } 16 | ArrayList fixtures = new ArrayList(); 17 | } 18 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/FadeIn/FadeIn.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: FadeIn 4 | * 5 | * This examples shows how you can set lights to fade to a value 6 | * So instead of instantly changing the colour it softly moves that colour for nicer transitions 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | int lightAddress = 1; 17 | int lightChannels = 8; 18 | 19 | DMXFixture fixture; 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to the first dmx usb device available 26 | dmx = new DMXControl( 0, numDmxChannels ); 27 | 28 | dmx.setFixtureFade( true ); // Enable the fixture value fading in 29 | dmx.setFixtureFadeRate( 0.1 ); // (0.0-1.0) closer to 0 then the slower it will fade 30 | 31 | fixture = new DMXFixture( this, lightAddress, lightChannels ); 32 | dmx.addFixture( fixture ); 33 | } 34 | 35 | void draw() 36 | { 37 | background( 0 ); 38 | 39 | // take the mouse pos and convert it to a number between 0 - 255 40 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 41 | 42 | } 43 | 44 | void mousePressed() 45 | { 46 | int brightness = (int)random(0,255); 47 | // Send the mapped value to the dmx channels 1 and 2 to control the light 48 | fixture.sendValue( 1, brightness ); 49 | fixture.sendValue( 2, 255); 50 | } 51 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/FadeUpDown/FadeUpDown.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Fade up down 4 | * 5 | * Shows how you can fade a fixtures brightness up and down using an oscillator param 6 | * 7 | * Assumes you have connected two typical RGB can lights 8 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 9; 19 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 21 | 22 | // These control a param 23 | DMXParam fadeSlow; 24 | DMXParam fadeFast; 25 | 26 | void setup() 27 | { 28 | size( 600, 600 ); 29 | 30 | // Connect to the first dmx usb device available 31 | dmx = new DMXControl( 0, numDmxChannels ); 32 | 33 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 34 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 35 | 36 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 37 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 38 | 39 | // Set up our param oscillators 40 | // The way these work is you create them at startup and assign them to a fixture channel 41 | // The params will change over time and automatically be sent to that param 42 | fadeSlow = new DMXParamOsc( this, 43 | 10.0, // oscillate over 10 seconds 44 | 0, // min dmx value 45 | 255, // max dmx value 46 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 47 | 0, // num times to repeat 0 = infinite repeat 48 | true); // autostart 49 | 50 | fadeFast = new DMXParamOsc( this, 51 | 2.5, // oscillate over 2.5 seconds 52 | 0, // min dmx value 53 | 255, // max dmx value 54 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 55 | 0, // num times to repeat 0 = infinite repeat 56 | true); // autostart 57 | 58 | 59 | // set light 1 to be purple 60 | light1.sendValue( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light1.sendValue( 2, 255 ); // set the red channel to 255 62 | light1.sendValue( 3, 0 ); // set the green channel to 0 63 | light1.sendValue( 4, 255 ); // set the blue channel to 255 64 | 65 | // set light 2 to be green 66 | light2.sendValue( 1, fadeFast ); // set the fader channel to the fast oscillator 67 | light2.sendValue( 2, 0 ); // set the red channel to 0 68 | light2.sendValue( 3, 255 ); // set the green channel to 255 69 | light2.sendValue( 4, 0 ); // set the blue channel to 0 70 | 71 | } 72 | 73 | void draw() 74 | { 75 | background( 0 ); 76 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/MultipleFixtures/MultipleFixtures.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Multiple Fixtures 4 | * 5 | * This is a simple example where we control two lights 6 | * 7 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 8 | * channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 7; 19 | int numLightChannels = 6; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 511; // total number of channels allocated for the dmx device, must not be more than 511 21 | 22 | void setup() 23 | { 24 | size( 600, 600 ); 25 | 26 | // Connect to the first dmx usb device available 27 | dmx = new DMXControl( 0, numDmxChannels ); 28 | 29 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 30 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 31 | 32 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 33 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 34 | 35 | // set light 1 to be purple 36 | light1.sendValue( 1, 255 ); // set the fader channel to 255 37 | light1.sendValue( 2, 255 ); // set the red channel to 255 38 | light1.sendValue( 3, 0 ); // set the green channel to 0 39 | light1.sendValue( 4, 255 ); // set the blue channel to 255 40 | 41 | // set light 2 to be green 42 | light2.sendValue( 1, 255 ); // set the fader channel to 255 43 | light2.sendValue( 2, 0 ); // set the red channel to 0 44 | light2.sendValue( 3, 255 ); // set the green channel to 255 45 | light2.sendValue( 4, 0 ); // set the blue channel to 0 46 | 47 | } 48 | 49 | void draw() 50 | { 51 | background( 0 ); 52 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/SingleFixture/SingleFixture.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Single Fixture 4 | * 5 | * This is a simple example where we open the first available dmx device and set a 6 | * a random colour when a key is pressed 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture rgbLight; 16 | int lightAddress = 1; 17 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 18 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 19 | 20 | void setup() 21 | { 22 | size( 600, 600 ); 23 | 24 | // Connect to the first dmx usb device available 25 | dmx = new DMXControl( 0, numDmxChannels ); 26 | 27 | rgbLight = new DMXFixture( this, lightAddress, numLightChannels); 28 | dmx.addFixture( rgbLight ); // add the rgb light to the dmx controller 29 | 30 | 31 | } 32 | 33 | void draw() 34 | { 35 | background( 0 ); 36 | } 37 | 38 | void keyPressed() 39 | { 40 | // when we detect a key press then set the rgb light to a random colour 41 | rgbLight.sendValue( 1, 255 ); // set the fader channel to 255 42 | rgbLight.sendValue( 2, ( int )random( 0, 255 ) ); // red 43 | rgbLight.sendValue( 3, ( int )random( 0, 255 ) ); // green 44 | rgbLight.sendValue( 4, ( int )random( 0, 255 ) ); // blue 45 | //rgbLight.sendValue( 5, ( int )random( 0, 255 ) ); // white, uncomment if your light has a white channel 46 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/TimelineExample/TimelineExample.pde: -------------------------------------------------------------------------------- 1 | import com.jaysonh.dmx4artists.*; 2 | 3 | DMXControl dmx; 4 | DMXFixture fixture; 5 | 6 | DMXParam fadeOscSlow; 7 | DMXParam fadeOscFast; 8 | 9 | int maxDmxChannels = 9; 10 | int numLightChannels = 8; 11 | int lightAddress = 1; 12 | 13 | Timeline timeline; 14 | TimelineDisplay timeDisplay; 15 | 16 | void setup() 17 | { 18 | size(600,600); 19 | 20 | dmx = new DMXControl( 0, maxDmxChannels ); // connect to the first dmx device (0) 21 | 22 | 23 | fadeOscSlow = new DMXParamOsc( this, 24 | 5.0, // oscillate over 5 seconds 25 | 0, // min dmx value 26 | 255, // max dmx value 27 | MoveBehaviour.OSC_SINE, 28 | 1,// num times to repeat 0 = infinite repeat 29 | false); // do not autostart 30 | 31 | fadeOscFast = new DMXParamOsc( this, 32 | 2.5, // oscillate over 2.5 seconds 33 | 0, // min dmx value 34 | 255, // max dmx value 35 | MoveBehaviour.OSC_SINE, 36 | 2, // num times to repeat 0 = infinite repeat 37 | false); // do not autostart 38 | 39 | fixture = new DMXFixture( this, lightAddress, numLightChannels); // create a new fixture 40 | dmx.addFixture( fixture ); // add the fixture to the dmx controller 41 | 42 | 43 | fixture.setParam(2,255); 44 | fixture.setParam(3,255); 45 | 46 | DMXParamStatic p0 = new DMXParamStatic(this,50); 47 | DMXParamStatic p1 = new DMXParamStatic(this,100); 48 | DMXParamStatic p2 = new DMXParamStatic(this,150); 49 | DMXParamStatic p3 = new DMXParamStatic(this,200); 50 | DMXParamStatic p4 = new DMXParamStatic(this,250); 51 | 52 | timeDisplay = new TimelineDisplay( width, height,this ); 53 | timeline = new Timeline( this, 30.0 ); // create a timline with a duration of 30 seconds, it will repeat by default 54 | 55 | timeline.add( fixture, fadeOscSlow, 1, 1.0, 5.0); 56 | timeline.add( fixture, p1, 1, 8.0, 10.0); 57 | timeline.add( fixture, fadeOscFast, 1, 10.0,15.0); 58 | timeline.add( fixture, p3, 1, 15.0,20.0); 59 | timeline.add( fixture, p4, 1, 20.0,25.0); 60 | 61 | timeline.begin(); 62 | } 63 | 64 | void draw() 65 | { 66 | background(0,0,0); 67 | 68 | PGraphics timelineDisp = timeDisplay.update( timeline, width, height ); 69 | image( timelineDisp, 0, 0 ); 70 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/examples/TriggerParam/TriggerParam.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Trigger param 4 | * 5 | * Shows how you can trigger one param to change after another param is finished 6 | * For example you can make a light pulse once slowly then when it finishes trigger it to pulse slowly 7 | * 8 | * Assumes you have connected two typical RGB can lights 9 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 511; // total number of channels allocated for the dmx device 20 | 21 | // These control a param 22 | DMXParam fadeSlow; 23 | DMXParam fadeFast; 24 | 25 | void setup() 26 | { 27 | size( 600, 600 ); 28 | 29 | // Connect to the first dmx usb device available 30 | dmx = new DMXControl( 0, numDmxChannels ); 31 | 32 | light = new DMXFixture( this, lightAddress, numLightChannels); 33 | 34 | dmx.addFixture( light ); // add the rgb light to the dmx controller 35 | 36 | // Set up our param oscillators 37 | // The way these work is you create them at startup and assign them to a fixture channel 38 | // The params will change over time and automatically be sent to that param 39 | fadeSlow = new DMXParamOsc( this, 40 | 10.0, // oscillate over 10 seconds 41 | 0, // min dmx value 42 | 255, // max dmx value 43 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 44 | 1, // num times to repeat 0 = infinite repeat 45 | true); // autostart 46 | 47 | fadeFast = new DMXParamOsc( this, 48 | 2.5, // oscillate over 2.5 seconds 49 | 0, // min dmx value 50 | 255, // max dmx value 51 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 52 | 0, // num times to repeat 0 = infinite repeat 53 | false); // autostart 54 | 55 | // add the fadeFast trigger to the fadeSlow trigger, so that when the fadeSlow trigger finishes the 56 | // fadeFast trigger will begin 57 | fadeSlow.addTrigger( fadeFast ); 58 | 59 | // set light 1 to be purple 60 | light.setParam( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light.setParam( 2, 255 ); // set the red channel to 255 62 | light.setParam( 3, 0 ); // set the green channel to 0 63 | light.setParam( 4, 255 ); // set the blue channel to 255 64 | 65 | } 66 | 67 | void draw() 68 | { 69 | background( 0 ); 70 | } -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Dmx4Artists 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 25 | 26 | 38 | 39 |
40 | 41 |
42 |

Dmx4Artists

43 |

44 | A Library by Jayson Haebich for the Processing programming environment.
45 | Last update, 10/25/2023. 46 |

47 |

48 | Easy to use library for controlling DMX lights with an FTDI USB controller.
49 |
50 | Feel free to replace this paragraph with a description of the Library.
51 | Contributed Libraries are developed, documented, and maintained by members of the Processing community. Further directions are included with each Library. For feedback and support, please post to the Discourse. We strongly encourage all Libraries to be open source, but not all of them are. 52 |

53 |
54 | 55 | 56 | 57 |
58 |

Download

59 |

60 | Download Dmx4Artists version 2.1.0 (2.1) in 61 | .zip format. 62 |

63 |

Installation

64 |

65 | Unzip and put the extracted Dmx4Artists folder into the libraries folder of your Processing sketches. Reference and examples are included in the Dmx4Artists folder. 66 |

67 |
68 | 69 | 70 |
71 |

Keywords. DMX,lighting,hardware

72 |

Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.

73 |

Source. The source code of Dmx4Artists is available at GitHub, and its repository can be browsed here.

74 |
75 | 76 | 77 |
78 |

Examples

79 |

Find a list of examples in the current distribution of Dmx4Artists, or have a look at them by following the links below.

80 | 83 |
84 | 85 | 86 |
87 |

Tested

88 |

89 | 90 | Platform osx,windows 91 | 92 | 93 |
Processing 4.3.0 94 | 95 | 96 |
Dependencies ? 97 |

98 |
99 | 100 | 101 | 102 | 114 | 115 | 116 | 121 | 122 | 123 | 127 | 128 | 129 |
130 |
131 | 132 | 135 |
136 | 137 | -------------------------------------------------------------------------------- /distribution/Dmx4Artists-2.1/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* processingLibs style by andreas schlegel, sojamo. */ 2 | 3 | 4 | * { 5 | margin:0; 6 | padding:0; 7 | border:0; 8 | } 9 | 10 | 11 | body { 12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; 13 | font-size : 100%; 14 | font-size : 0.70em; 15 | font-weight : normal; 16 | line-height : normal; 17 | } 18 | 19 | 20 | 21 | #container { 22 | margin-left:64px; 23 | background-color:#fff; 24 | } 25 | 26 | #header { 27 | float:left; 28 | padding-top:24px; 29 | padding-bottom:48px; 30 | } 31 | 32 | #menu { 33 | margin-top:16px; 34 | float:left; 35 | margin-bottom:64px; 36 | } 37 | 38 | 39 | #about, 40 | #download, 41 | #examples, 42 | #demos, 43 | #misc { 44 | width:480px; 45 | float:left; 46 | margin-right:24px; 47 | } 48 | 49 | 50 | #resources, #info { 51 | width:320px; 52 | float:left; 53 | } 54 | 55 | 56 | .clear { 57 | clear:both; 58 | } 59 | 60 | #footer { 61 | margin-top:300px; 62 | height:20px; 63 | margin-bottom:32px; 64 | } 65 | 66 | 67 | ul { 68 | list-style:none; 69 | padding:0; 70 | margin:0; 71 | } 72 | 73 | 74 | #menu ul li, #subMenu ul li { 75 | float:left; 76 | padding-right:6px; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | /* Headings */ 85 | 86 | h1 { 87 | font-size:2em; 88 | font-weight:normal; 89 | } 90 | 91 | 92 | h2, h3, h4, h5, th { 93 | font-size:1.3em; 94 | font-weight:normal; 95 | margin-bottom:4px; 96 | } 97 | 98 | 99 | 100 | p { 101 | font-size:1em; 102 | width:90%; 103 | margin-bottom:32px; 104 | } 105 | 106 | 107 | pre, code { 108 | font-family:"Courier New", Courier, monospace; 109 | font-size:1em; 110 | line-height:normal; 111 | } 112 | 113 | 114 | 115 | 116 | hr { 117 | border:0; 118 | height:1px; 119 | margin-bottom:24px; 120 | } 121 | 122 | 123 | a { 124 | text-decoration: underline; 125 | font-weight: normal; 126 | } 127 | 128 | 129 | a:hover, 130 | a:active { 131 | text-decoration: underline; 132 | font-weight: normal; 133 | } 134 | 135 | 136 | a:visited, 137 | a:link:visited { 138 | text-decoration: underline; 139 | font-weight: normal; 140 | } 141 | 142 | 143 | 144 | img { 145 | border: 0px solid #000000; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | /* COLORS */ 153 | 154 | 155 | body { 156 | color : #333; 157 | background-color :#fff; 158 | } 159 | 160 | 161 | #header { 162 | background-color:#fff; 163 | color:#333; 164 | } 165 | 166 | 167 | 168 | h1, h2, h3, h4, h5, h6 { 169 | color:#666; 170 | } 171 | 172 | 173 | pre, code { 174 | color: #000000; 175 | } 176 | 177 | 178 | a,strong { 179 | color: #333; 180 | } 181 | 182 | 183 | a:hover, 184 | a:active { 185 | color: #333; 186 | } 187 | 188 | 189 | a:visited, 190 | a:link:visited { 191 | color: #333; 192 | } 193 | 194 | 195 | #footer, #menu { 196 | background-color:#fff; 197 | color:#333; 198 | } 199 | 200 | 201 | #footer a, #menu a { 202 | color:#333; 203 | } 204 | -------------------------------------------------------------------------------- /examples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/examples/.DS_Store -------------------------------------------------------------------------------- /examples/BasicControl/BasicControl.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: BasicControl 4 | * 5 | * This is a simple example where we open the first available dmx device and set dmx channels 6 | * 0 and 1 to the mouse value 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | void setup() 17 | { 18 | size( 600, 600 ); 19 | 20 | // Connect to the first dmx usb device available 21 | dmx = new DMXControl( 0, numDmxChannels ); 22 | } 23 | 24 | void draw() 25 | { 26 | background( 0 ); 27 | 28 | // take the mouse pos and convert it to a number between 0 - 255 29 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 30 | 31 | // Send the mapped value to the dmx channels 1 and 2 to control the light 32 | dmx.sendValue( 1, brightness ); 33 | dmx.sendValue( 2, brightness ); 34 | } -------------------------------------------------------------------------------- /examples/ConnectDevice/ConnectDevice.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: ConnectDevice 4 | * 5 | * This example shows connecting to a device with a specified serialNum 6 | * Useful if you have multiple devices connected and want to connect to a specific one of them 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 512; // total number of channels allocated for the dmx device 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to dmx device with serial number: AG0JGSJV 26 | dmx = new DMXControl( "AG0JGSJV", numDmxChannels ); 27 | 28 | light = new DMXFixture( this, lightAddress, numLightChannels); 29 | 30 | dmx.addFixture( light ); // add the rgb light to the dmx controller 31 | 32 | // set light to be purple 33 | light.setParam( 1, 255 ); // set the fader channel to 255 34 | light.setParam( 2, 255 ); // set the red channel to 255 35 | light.setParam( 3, 0 ); // set the green channel to 0 36 | light.setParam( 4, 255 ); // set the blue channel to 255 37 | } 38 | 39 | void draw() 40 | { 41 | background( 0 ); 42 | } -------------------------------------------------------------------------------- /examples/DmxVisualise/DmxVisualise.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * DmxVisualiser 3 | * 4 | * This example shows how visualise the DmxFixtures on the screen 5 | * useful if you don't have any lights of your own 6 | */ 7 | import com.jaysonh.dmx4artists.*; 8 | 9 | DMXControl dmx; 10 | 11 | DMXFixture fix1; 12 | DMXFixture fix2; 13 | 14 | // Our visualise object 15 | Visualiser visualiser; 16 | 17 | int parCanAddr = 1; 18 | int movingHeadAddr = 11; 19 | 20 | int parCanNumChannels = 8; 21 | int movingHeadNumChannels = 11; 22 | void setup() 23 | { 24 | size( 1280,720); 25 | 26 | dmx = new DMXControl( 0, 256); 27 | 28 | fix1 = new DMXFixture( this, parCanAddr, parCanNumChannels ); 29 | fix2 = new DMXFixture( this, movingHeadAddr, movingHeadNumChannels ); // uses 11 channel dmx mode for moving head 30 | 31 | 32 | dmx.addFixture( fix1 ); 33 | 34 | // This is the object that will draw the DmxFixtures to the screen 35 | visualiser = new Visualiser(); 36 | visualiser.add( new ParCanFixture( fix1, 20, 20, 40, 40 ) ); 37 | visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, true ) ); // assumes that moving head is using rgb colour mode 38 | //visualiser.add( new MovingHeadFixture( fix2, 100, 20, 40, 40, false) ); 39 | } 40 | 41 | void draw() 42 | { 43 | background(0); 44 | 45 | fix1.sendValue( 1, 255); 46 | fix1.sendValue( 2, 255-map( mouseY, 0, height, 0, 255 )); 47 | fix1.sendValue( 3, map( mouseX, 0, width, 0, 255 )); 48 | fix1.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 49 | 50 | fix2.sendValue( 2, map( mouseX, 0, width, 0, 255 )); 51 | fix2.sendValue( 4, map( mouseY, 0, height, 0, 255 )); 52 | fix2.sendValue( 6, 255); 53 | fix2.sendValue( 8, 255); 54 | fix2.sendValue( 9, 0); 55 | fix2.sendValue( 10, 255); 56 | 57 | visualiser.draw(); 58 | } 59 | -------------------------------------------------------------------------------- /examples/DmxVisualise/FixtureDraw.pde: -------------------------------------------------------------------------------- 1 | abstract class FixtureDraw 2 | { 3 | FixtureDraw( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | this.fixture = fixture; 6 | 7 | this.xPos = xPos; 8 | this.yPos = yPos; 9 | this.xSize = xSize; 10 | this.ySize = ySize; 11 | } 12 | 13 | abstract void draw(); 14 | 15 | DMXFixture fixture; 16 | 17 | int xPos; 18 | int yPos; 19 | int xSize; 20 | int ySize; 21 | } 22 | -------------------------------------------------------------------------------- /examples/DmxVisualise/MovingHeadFixture.pde: -------------------------------------------------------------------------------- 1 | class MovingHeadFixture extends FixtureDraw 2 | { 3 | MovingHeadFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize, boolean rgbMode ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | this.rgbMode = rgbMode; 8 | panFineChannel = /*fixture.getAddress() +*/ 1; 9 | panCoarseChannel = /*fixture.getAddress() +*/ 2; 10 | tiltFineChannel = /*fixture.getAddress() +*/ 3; 11 | tiltCoarseChannel = /*fixture.getAddress() +*/ 4; 12 | briChannel = /*fixture.getAddress() +*/ 6; 13 | rChannel = /*fixture.getAddress() +*/ 8; 14 | gChannel = /*fixture.getAddress() +*/ 9; 15 | bChannel = /*fixture.getAddress() +*/ 10; 16 | } 17 | 18 | void draw() 19 | { 20 | pushStyle(); 21 | 22 | if( rgbMode ) // use rgb colour 23 | { 24 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 25 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 26 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 27 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 28 | 29 | fill( r, g , b); 30 | }else // use colour select 31 | { 32 | int colSelect = (int)(fixture.getParam( colSelectChannel ).getValue()); 33 | 34 | setCol( colSelect ); 35 | } 36 | 37 | ellipse( xPos, yPos, xSize, ySize ); 38 | 39 | stroke(255); 40 | fill(255); 41 | // draw pan 42 | float pan = fixture.getParam( panCoarseChannel - 1 ).getValue(); 43 | pushMatrix(); 44 | translate( xPos, yPos + ySize ); 45 | text("pan", 0, -5 ); 46 | rotate( map( pan, 0, 255.0, 0, TWO_PI ) ); 47 | line( 0, 0, xSize/2, 0); 48 | popMatrix(); 49 | 50 | // draw tilt 51 | float tilt = fixture.getParam( tiltCoarseChannel - 1 ).getValue(); 52 | pushMatrix(); 53 | translate( xPos, yPos + ySize * 2.0 ); 54 | text("tilt", 0, -5 ); 55 | rotate( map( tilt, 0, 255.0, 0, TWO_PI ) ); 56 | line( 0, 0, xSize/2, 0); 57 | popMatrix(); 58 | 59 | popStyle(); 60 | } 61 | 62 | void setCol( int col ) 63 | { 64 | switch( col ) 65 | { 66 | case 0: 67 | fill(255,0,0); 68 | break; 69 | case 1: 70 | fill(0,255,0); 71 | break; 72 | case 2: 73 | fill(0,0,255); 74 | break; 75 | case 3: 76 | fill(255,0,255); 77 | break; 78 | case 4: 79 | fill(255,255,0); 80 | break; 81 | } 82 | } 83 | private boolean rgbMode = true; // true - RGB false - colour select 84 | 85 | private int briChannel; 86 | private int rChannel; 87 | private int gChannel; 88 | private int bChannel; 89 | private int wChannel; 90 | 91 | private int panFineChannel; 92 | private int panCoarseChannel; 93 | private int tiltFineChannel; 94 | private int tiltCoarseChannel; 95 | 96 | private int colSelectChannel = 6; // use channel 6 by default 97 | } 98 | -------------------------------------------------------------------------------- /examples/DmxVisualise/ParCanFixture.pde: -------------------------------------------------------------------------------- 1 | class ParCanFixture extends FixtureDraw 2 | { 3 | ParCanFixture( DMXFixture fixture, int xPos, int yPos, int xSize, int ySize ) 4 | { 5 | super( fixture, xPos, yPos, xSize, ySize ); 6 | 7 | // set up default addresses for a par can bri = 1, r = 2, g = 3, b = 4 8 | briChannel = fixture.getAddress(); 9 | rChannel = fixture.getAddress() + 1; 10 | gChannel = fixture.getAddress() + 2; 11 | bChannel = fixture.getAddress() + 3; 12 | } 13 | 14 | void rgbChannels( int rChannel, int gChannel, int bChannel ) 15 | { 16 | brgbwChannels( 0, rChannel, gChannel, bChannel, 0 ); 17 | } 18 | 19 | void rgbwChannels( int rChannel, int gChannel, int bChannel, int wChannel) 20 | { 21 | brgbwChannels( 0, rChannel, gChannel, bChannel, wChannel ); 22 | } 23 | 24 | void brgbwChannels( int briChannel, int rChannel, int gChannel, int bChannel, int wChannel ) 25 | { 26 | this.briChannel = briChannel; 27 | this.rChannel = rChannel; 28 | this.gChannel = gChannel; 29 | this.bChannel = bChannel; 30 | this.wChannel = wChannel; 31 | } 32 | 33 | void draw() 34 | { 35 | pushStyle(); 36 | 37 | float bri = (briChannel == 0) ? 0 : fixture.getParam( briChannel -1 ).getValue(); 38 | float r = (rChannel == 0) ? 0 : fixture.getParam( rChannel -1 ).getValue() * ( bri / 255.0 ); 39 | float g = (gChannel == 0) ? 0 : fixture.getParam( gChannel -1 ).getValue() * ( bri / 255.0 ); 40 | float b = (bChannel == 0) ? 0 : fixture.getParam( bChannel -1 ).getValue() * ( bri / 255.0 ); 41 | //float w = (wChannel == 0) ? 0 : fixture.getParam( wChannel ).getValue() * ( bri / 255.0 ); 42 | 43 | fill( r, g, b ); 44 | ellipse( xPos, yPos, xSize, ySize ); 45 | 46 | popStyle(); 47 | } 48 | 49 | private int briChannel; 50 | private int rChannel; 51 | private int gChannel; 52 | private int bChannel; 53 | private int wChannel; 54 | } 55 | -------------------------------------------------------------------------------- /examples/DmxVisualise/Visualiser.pde: -------------------------------------------------------------------------------- 1 | class Visualiser 2 | { 3 | 4 | void add( FixtureDraw fix) 5 | { 6 | fixtures.add(fix); 7 | } 8 | 9 | void draw() 10 | { 11 | for( FixtureDraw f : fixtures ) 12 | { 13 | f.draw(); 14 | } 15 | } 16 | ArrayList fixtures = new ArrayList(); 17 | } 18 | -------------------------------------------------------------------------------- /examples/FadeIn/FadeIn.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: FadeIn 4 | * 5 | * This examples shows how you can set lights to fade to a value 6 | * So instead of instantly changing the colour it softly moves that colour for nicer transitions 7 | * Assumes you have connected a typical RGB can light where channel 0 is master fader and channel 1 is red (or white) 8 | */ 9 | 10 | import com.jaysonh.dmx4artists.*; 11 | 12 | DMXControl dmx; 13 | 14 | int numDmxChannels = 256; // number of channels we will use 15 | 16 | int lightAddress = 1; 17 | int lightChannels = 8; 18 | 19 | DMXFixture fixture; 20 | 21 | void setup() 22 | { 23 | size( 600, 600 ); 24 | 25 | // Connect to the first dmx usb device available 26 | dmx = new DMXControl( 0, numDmxChannels ); 27 | 28 | dmx.setFixtureFade( true ); // Enable the fixture value fading in 29 | dmx.setFixtureFadeRate( 0.1 ); // (0.0-1.0) closer to 0 then the slower it will fade 30 | 31 | fixture = new DMXFixture( this, lightAddress, lightChannels ); 32 | dmx.addFixture( fixture ); 33 | } 34 | 35 | void draw() 36 | { 37 | background( 0 ); 38 | 39 | // take the mouse pos and convert it to a number between 0 - 255 40 | int brightness = ( int ) map( mouseX, 0, width, 0, 255 ); 41 | 42 | } 43 | 44 | void mousePressed() 45 | { 46 | int brightness = (int)random(0,255); 47 | // Send the mapped value to the dmx channels 1 and 2 to control the light 48 | fixture.sendValue( 1, brightness ); 49 | fixture.sendValue( 2, 255); 50 | } 51 | -------------------------------------------------------------------------------- /examples/FadeUpDown/FadeUpDown.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Fade up down 4 | * 5 | * Shows how you can fade a fixtures brightness up and down using an oscillator param 6 | * 7 | * Assumes you have connected two typical RGB can lights 8 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 9; 19 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 21 | 22 | // These control a param 23 | DMXParam fadeSlow; 24 | DMXParam fadeFast; 25 | 26 | void setup() 27 | { 28 | size( 600, 600 ); 29 | 30 | // Connect to the first dmx usb device available 31 | dmx = new DMXControl( 0, numDmxChannels ); 32 | 33 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 34 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 35 | 36 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 37 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 38 | 39 | // Set up our param oscillators 40 | // The way these work is you create them at startup and assign them to a fixture channel 41 | // The params will change over time and automatically be sent to that param 42 | fadeSlow = new DMXParamOsc( this, 43 | 10.0, // oscillate over 10 seconds 44 | 0, // min dmx value 45 | 255, // max dmx value 46 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 47 | 0, // num times to repeat 0 = infinite repeat 48 | true); // autostart 49 | 50 | fadeFast = new DMXParamOsc( this, 51 | 2.5, // oscillate over 2.5 seconds 52 | 0, // min dmx value 53 | 255, // max dmx value 54 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 55 | 0, // num times to repeat 0 = infinite repeat 56 | true); // autostart 57 | 58 | 59 | // set light 1 to be purple 60 | light1.sendValue( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light1.sendValue( 2, 255 ); // set the red channel to 255 62 | light1.sendValue( 3, 0 ); // set the green channel to 0 63 | light1.sendValue( 4, 255 ); // set the blue channel to 255 64 | 65 | // set light 2 to be green 66 | light2.sendValue( 1, fadeFast ); // set the fader channel to the fast oscillator 67 | light2.sendValue( 2, 0 ); // set the red channel to 0 68 | light2.sendValue( 3, 255 ); // set the green channel to 255 69 | light2.sendValue( 4, 0 ); // set the blue channel to 0 70 | 71 | } 72 | 73 | void draw() 74 | { 75 | background( 0 ); 76 | } -------------------------------------------------------------------------------- /examples/MultipleFixtures/MultipleFixtures.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Multiple Fixtures 4 | * 5 | * This is a simple example where we control two lights 6 | * 7 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 8 | * channel 2 is red, channel 3 is green, channel 4 is blue 9 | */ 10 | 11 | import com.jaysonh.dmx4artists.*; 12 | 13 | DMXControl dmx; 14 | DMXFixture light1; 15 | DMXFixture light2; 16 | 17 | int lightAddress1 = 1; 18 | int lightAddress2 = 7; 19 | int numLightChannels = 6; // number of channels for the light (master fade, red, green, blue) 20 | int numDmxChannels = 511; // total number of channels allocated for the dmx device, must not be more than 511 21 | 22 | void setup() 23 | { 24 | size( 600, 600 ); 25 | 26 | // Connect to the first dmx usb device available 27 | dmx = new DMXControl( 0, numDmxChannels ); 28 | 29 | light1 = new DMXFixture( this, lightAddress1, numLightChannels); 30 | light2 = new DMXFixture( this, lightAddress2, numLightChannels); 31 | 32 | dmx.addFixture( light1 ); // add the rgb light to the dmx controller 33 | dmx.addFixture( light2 ); // add the rgb light to the dmx controller 34 | 35 | // set light 1 to be purple 36 | light1.sendValue( 1, 255 ); // set the fader channel to 255 37 | light1.sendValue( 2, 255 ); // set the red channel to 255 38 | light1.sendValue( 3, 0 ); // set the green channel to 0 39 | light1.sendValue( 4, 255 ); // set the blue channel to 255 40 | 41 | // set light 2 to be green 42 | light2.sendValue( 1, 255 ); // set the fader channel to 255 43 | light2.sendValue( 2, 0 ); // set the red channel to 0 44 | light2.sendValue( 3, 255 ); // set the green channel to 255 45 | light2.sendValue( 4, 0 ); // set the blue channel to 0 46 | 47 | } 48 | 49 | void draw() 50 | { 51 | background( 0 ); 52 | } -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | add examples for your Library here. -------------------------------------------------------------------------------- /examples/SingleFixture/SingleFixture.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Single Fixture 4 | * 5 | * This is a simple example where we open the first available dmx device and set a 6 | * a random colour when a key is pressed 7 | * 8 | * Assumes you have connected a typical RGB can light where channel 1 is master fader, 9 | * channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture rgbLight; 16 | int lightAddress = 1; 17 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 18 | int numDmxChannels = 256; // total number of channels allocated for the dmx device 19 | 20 | void setup() 21 | { 22 | size( 600, 600 ); 23 | 24 | // Connect to the first dmx usb device available 25 | dmx = new DMXControl( 0, numDmxChannels ); 26 | 27 | rgbLight = new DMXFixture( this, lightAddress, numLightChannels); 28 | dmx.addFixture( rgbLight ); // add the rgb light to the dmx controller 29 | 30 | 31 | } 32 | 33 | void draw() 34 | { 35 | background( 0 ); 36 | } 37 | 38 | void keyPressed() 39 | { 40 | // when we detect a key press then set the rgb light to a random colour 41 | rgbLight.sendValue( 1, 255 ); // set the fader channel to 255 42 | rgbLight.sendValue( 2, ( int )random( 0, 255 ) ); // red 43 | rgbLight.sendValue( 3, ( int )random( 0, 255 ) ); // green 44 | rgbLight.sendValue( 4, ( int )random( 0, 255 ) ); // blue 45 | //rgbLight.sendValue( 5, ( int )random( 0, 255 ) ); // white, uncomment if your light has a white channel 46 | } -------------------------------------------------------------------------------- /examples/TimelineExample/TimelineExample.pde: -------------------------------------------------------------------------------- 1 | import com.jaysonh.dmx4artists.*; 2 | 3 | DMXControl dmx; 4 | DMXFixture fixture; 5 | 6 | DMXParam fadeOscSlow; 7 | DMXParam fadeOscFast; 8 | 9 | int maxDmxChannels = 9; 10 | int numLightChannels = 8; 11 | int lightAddress = 1; 12 | 13 | Timeline timeline; 14 | TimelineDisplay timeDisplay; 15 | 16 | void setup() 17 | { 18 | size(600,600); 19 | 20 | dmx = new DMXControl( 0, maxDmxChannels ); // connect to the first dmx device (0) 21 | 22 | 23 | fadeOscSlow = new DMXParamOsc( this, 24 | 5.0, // oscillate over 5 seconds 25 | 0, // min dmx value 26 | 255, // max dmx value 27 | MoveBehaviour.OSC_SINE, 28 | 1,// num times to repeat 0 = infinite repeat 29 | false); // do not autostart 30 | 31 | fadeOscFast = new DMXParamOsc( this, 32 | 2.5, // oscillate over 2.5 seconds 33 | 0, // min dmx value 34 | 255, // max dmx value 35 | MoveBehaviour.OSC_SINE, 36 | 2, // num times to repeat 0 = infinite repeat 37 | false); // do not autostart 38 | 39 | fixture = new DMXFixture( this, lightAddress, numLightChannels); // create a new fixture 40 | dmx.addFixture( fixture ); // add the fixture to the dmx controller 41 | 42 | 43 | fixture.setParam(2,255); 44 | fixture.setParam(3,255); 45 | 46 | DMXParamStatic p0 = new DMXParamStatic(this,50); 47 | DMXParamStatic p1 = new DMXParamStatic(this,100); 48 | DMXParamStatic p2 = new DMXParamStatic(this,150); 49 | DMXParamStatic p3 = new DMXParamStatic(this,200); 50 | DMXParamStatic p4 = new DMXParamStatic(this,250); 51 | 52 | timeDisplay = new TimelineDisplay( width, height,this ); 53 | timeline = new Timeline( this, 30.0 ); // create a timline with a duration of 30 seconds, it will repeat by default 54 | 55 | timeline.add( fixture, fadeOscSlow, 1, 1.0, 5.0); 56 | timeline.add( fixture, p1, 1, 8.0, 10.0); 57 | timeline.add( fixture, fadeOscFast, 1, 10.0,15.0); 58 | timeline.add( fixture, p3, 1, 15.0,20.0); 59 | timeline.add( fixture, p4, 1, 20.0,25.0); 60 | 61 | timeline.begin(); 62 | } 63 | 64 | void draw() 65 | { 66 | background(0,0,0); 67 | 68 | PGraphics timelineDisp = timeDisplay.update( timeline, width, height ); 69 | image( timelineDisp, 0, 0 ); 70 | } -------------------------------------------------------------------------------- /examples/TriggerParam/TriggerParam.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Example: Trigger param 4 | * 5 | * Shows how you can trigger one param to change after another param is finished 6 | * For example you can make a light pulse once slowly then when it finishes trigger it to pulse slowly 7 | * 8 | * Assumes you have connected two typical RGB can lights 9 | * where channel 1 is master fader, channel 2 is red, channel 3 is green, channel 4 is blue 10 | */ 11 | 12 | import com.jaysonh.dmx4artists.*; 13 | 14 | DMXControl dmx; 15 | DMXFixture light; 16 | 17 | int lightAddress = 1; 18 | int numLightChannels = 8; // number of channels for the light (master fade, red, green, blue) 19 | int numDmxChannels = 511; // total number of channels allocated for the dmx device 20 | 21 | // These control a param 22 | DMXParam fadeSlow; 23 | DMXParam fadeFast; 24 | 25 | void setup() 26 | { 27 | size( 600, 600 ); 28 | 29 | // Connect to the first dmx usb device available 30 | dmx = new DMXControl( 0, numDmxChannels ); 31 | 32 | light = new DMXFixture( this, lightAddress, numLightChannels); 33 | 34 | dmx.addFixture( light ); // add the rgb light to the dmx controller 35 | 36 | // Set up our param oscillators 37 | // The way these work is you create them at startup and assign them to a fixture channel 38 | // The params will change over time and automatically be sent to that param 39 | fadeSlow = new DMXParamOsc( this, 40 | 10.0, // oscillate over 10 seconds 41 | 0, // min dmx value 42 | 255, // max dmx value 43 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 44 | 1, // num times to repeat 0 = infinite repeat 45 | true); // autostart 46 | 47 | fadeFast = new DMXParamOsc( this, 48 | 2.5, // oscillate over 2.5 seconds 49 | 0, // min dmx value 50 | 255, // max dmx value 51 | MoveBehaviour.OSC_SINE, // This is the type of movement, OSC_SINE means follow a sin function over time 52 | 0, // num times to repeat 0 = infinite repeat 53 | false); // autostart 54 | 55 | // add the fadeFast trigger to the fadeSlow trigger, so that when the fadeSlow trigger finishes the 56 | // fadeFast trigger will begin 57 | fadeSlow.addTrigger( fadeFast ); 58 | 59 | // set light 1 to be purple 60 | light.setParam( 1, fadeSlow ); // set the fader channel to the slow oscillator 61 | light.setParam( 2, 255 ); // set the red channel to 255 62 | light.setParam( 3, 0 ); // set the green channel to 0 63 | light.setParam( 4, 255 ); // set the blue channel to 255 64 | 65 | } 66 | 67 | void draw() 68 | { 69 | background( 0 ); 70 | } -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | The lib folder: 2 | In case your Library requires 3rd party libraries, which need to be 3 | added to the distribution, put them into the lib folder. 4 | These 3rd party libraries will be added to your distribution and are 5 | located next to your Library's jar file. 6 | This does not apply to .jar files that are considered core processing libraries. -------------------------------------------------------------------------------- /lib/jna-5.12.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/lib/jna-5.12.1.jar -------------------------------------------------------------------------------- /lib/jna-platform-5.12.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/lib/jna-platform-5.12.1.jar -------------------------------------------------------------------------------- /library/Dmx4Artists.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/library/Dmx4Artists.jar -------------------------------------------------------------------------------- /library/README: -------------------------------------------------------------------------------- 1 | The lib folder: 2 | In case your Library requires 3rd party libraries, which need to be 3 | added to the distribution, put them into the lib folder. 4 | These 3rd party libraries will be added to your distribution and are 5 | located next to your Library's jar file. 6 | This does not apply to .jar files that are considered core processing libraries. -------------------------------------------------------------------------------- /library/jna-platform.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/library/jna-platform.jar -------------------------------------------------------------------------------- /library/jna.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/library/jna.jar -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | A template to build a Library for the Processing programming environment. 2 | 3 | Part of the Processing project - http://processing.org 4 | 5 | Copyright 2011-2018 Elie Zananiri 6 | Copyright 2008-2011 Andreas Shlegel 7 | 8 | Licensed under the Apache License, Version 2.0 (the "License"); 9 | you may not use this file except in compliance with the License. 10 | You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, software 15 | distributed under the License is distributed on an "AS IS" BASIS, 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | See the License for the specific language governing permissions and 18 | limitations under the License. -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | ## How to install ##library.name## 2 | 3 | ### Install with the Contribution Manager 4 | 5 | Add contributed Libraries by selecting the menu item _Sketch_ → _Import Library..._ → _Add Library..._ This will open the Contribution Manager, where you can browse for ##library.name##, or any other Library you want to install. 6 | 7 | Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below. 8 | 9 | ### Manual Install 10 | 11 | Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top. 12 | 13 | By default the following locations are used for your sketchbook folder: 14 | * For Mac users, the sketchbook folder is located inside `~/Documents/Processing` 15 | * For Windows users, the sketchbook folder is located inside `My Documents/Processing` 16 | 17 | Download ##library.name## from ##library.url## 18 | 19 | Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist. 20 | 21 | The folder structure for Library ##library.name## should be as follows: 22 | 23 | ``` 24 | Processing 25 | libraries 26 | ##library.name## 27 | examples 28 | library 29 | ##library.name##.jar 30 | reference 31 | src 32 | ``` 33 | 34 | Some folders like `examples` or `src` might be missing. After Library ##library.name## has been successfully installed, restart the Processing application. 35 | 36 | ### Troubleshooting 37 | 38 | If you're having trouble, have a look at the [Processing Wiki](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) for more information, or contact the author [##author.name##](##author.url##). 39 | -------------------------------------------------------------------------------- /resources/build.properties: -------------------------------------------------------------------------------- 1 | # Create a Library for the Processing open source programming language and 2 | # environment (http://processing.org/) 3 | # 4 | # Customize the build properties to make the ant-build-process work for your 5 | # environment. How? Please read the comments below. 6 | # 7 | # The default properties are set for OS X. Please refer to comments for Windows 8 | # settings. 9 | 10 | 11 | # Where is your Processing sketchbook located? 12 | # If you are not sure, check the sketchbook location in your Processing 13 | # application preferences. 14 | # ${user.home} points the compiler to your home directory. 15 | # For windows the default path to your sketchbook would be 16 | # ${user.home}/My Documents/Processing (make adjustments below) 17 | 18 | #sketchbook.location=${user.home}/My Documents/Processing 19 | sketchbook.location=${user.home}/Documents/Processing 20 | 21 | 22 | # Where are the jar files located that are required for compiling your Library 23 | # such as e.g. core.jar? 24 | # By default the local classpath location points to folder libs inside Eclipse's 25 | # workspace (by default found in your home directory). 26 | # For Windows, the default path would be 27 | # ${user.home}/Documents/workspace/libs (make adjustments below) 28 | # For OS X,the following path will direct you into Processing's application 29 | # package, in case you put Processing inside your Applications folder. 30 | 31 | classpath.local.location=D:/program files/processing-3.5.3/core/library 32 | #classpath.local.location=/Applications/Processing.app/Contents/Java/core/library 33 | 34 | 35 | # Add all jar files that are required for compiling your project to the local 36 | # and project classpath. Use a comma as delimiter. These jar files must be 37 | # inside your classpath.local.location folder. 38 | 39 | classpath.local.include=core.jar,jna.jar,jna-platform.jar 40 | 41 | 42 | # Add Processing's libraries folder to the classpath. 43 | # If you don't need to include the libraries folder to your classpath, comment 44 | # out the following line. 45 | 46 | classpath.libraries.location=${sketchbook.location}/libraries 47 | 48 | 49 | # Set the java version that should be used to compile your Library. 50 | 51 | java.target.version=1.8 52 | 53 | 54 | # Set the description of the Ant build.xml file. 55 | 56 | ant.description=Processing Library Ant build file. 57 | 58 | 59 | # Give your Library a name. The name must not contain spaces or special 60 | # characters. 61 | 62 | project.name=Dmx4Artists 63 | 64 | 65 | # The name as the user will see it. This can contain spaces and special 66 | # characters. 67 | 68 | project.prettyName=Dmx4Artists 69 | 70 | 71 | # Use 'normal' or 'fast' as value for project.compile. 72 | # 'fast' will only compile the project into your sketchbook. 73 | # 'normal' will compile the distribution including the javadoc-reference and all 74 | # web-files (the compile process here takes longer). 75 | # All files compiled with project.compile=normal are stored in the distribution 76 | # folder. 77 | 78 | project.compile=normal 79 | 80 | 81 | # Set your name and URL, used for the web page and properties file. 82 | 83 | author.name=Jayson Haebich 84 | author.url=http://www.jaysonh.com 85 | 86 | 87 | # Set the web page for your Library. 88 | # This is NOT a direct link to where to download it. 89 | 90 | library.url=www.jaysonh.com 91 | 92 | 93 | # Set the category (or categories) of your Library from the following list: 94 | # "3D" "Animation" "Compilations" "Data" 95 | # "Fabrication" "Geometry" "GUI" "Hardware" 96 | # "I/O" "Language" "Math" "Simulation" 97 | # "Sound" "Utilities" "Typography" "Video & Vision" 98 | # 99 | # If a value other than those listed is used, your Library will listed as 100 | # "Other". Many categories must be comma-separated. 101 | 102 | library.categories=Hardware 103 | 104 | 105 | # A short sentence (or fragment) to summarize the Library's function. This will 106 | # be shown from inside the PDE when the Library is being installed. Avoid 107 | # repeating the name of your Library here. Also, avoid saying anything redundant 108 | # like mentioning that it's a Library. This should start with a capitalized 109 | # letter, and end with a period. 110 | 111 | library.sentence=Easy to use library for controlling DMX lights with an FTDI USB controller. 112 | 113 | 114 | # Additional information suitable for the Processing website. The value of 115 | # 'sentence' always will be prepended, so you should start by writing the 116 | # second sentence here. If your Library only works on certain operating systems, 117 | # mention it here. 118 | 119 | library.paragraph= 120 | 121 | 122 | # Set the source code repository for your project. 123 | # We recommend Bitbucket (https://bitbucket.org) or GitHub (https://github.com). 124 | 125 | source.host=GitHub 126 | source.url=https://github.com/jaysonh/Dmx4Artists 127 | source.repository=https://github.com/jaysonh/Dmx4Artists.git 128 | 129 | 130 | # The current version of your Library. 131 | # This number must be parsable as an int. It increments once with each release. 132 | # This is used to compare different versions of the same Library, and check if 133 | # an update is available. 134 | 135 | library.version=2.1 136 | 137 | 138 | # The version as the user will see it. 139 | 140 | library.prettyVersion=2.1.0 141 | 142 | 143 | # The min and max revision of Processing compatible with your Library. 144 | # Note that these fields use the revision and not the version of Processing, 145 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 146 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 147 | # Only use maxRevision (or minRevision), when your Library is known to 148 | # break in a later (or earlier) release. Otherwise, use the default value 0. 149 | 150 | compatible.minRevision=0 151 | compatible.maxRevision=0 152 | 153 | 154 | # The platforms and Processing version that the Library has been tested 155 | # against. This information is only used in the generated webpage. 156 | 157 | tested.platform=osx,windows 158 | tested.processingVersion=4.3.0 159 | 160 | 161 | # Additional information for the generated webpage. 162 | 163 | library.copyright=(c) 2023 164 | library.dependencies=? 165 | library.keywords=DMX,lighting,hardware 166 | 167 | 168 | # Include javadoc references into your project's javadocs. 169 | 170 | #javadoc.java.href=http://docs.oracle.com/javase/7/docs/api/ 171 | javadoc.java.href=http://docs.oracle.com/javase/8/docs/api/ 172 | javadoc.processing.href=http://processing.github.io/processing-javadocs/core/ -------------------------------------------------------------------------------- /resources/code/ExampleTaglet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/resources/code/ExampleTaglet.class -------------------------------------------------------------------------------- /resources/code/ExampleTaglet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * -Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * -Redistribution in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of Sun Microsystems, Inc. or the names of 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * This software is provided "AS IS," without a warranty of any 21 | * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND 22 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY 24 | * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY 25 | * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR 26 | * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR 27 | * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE 28 | * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, 29 | * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER 30 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF 31 | * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 33 | * 34 | * You acknowledge that Software is not designed, licensed or 35 | * intended for use in the design, construction, operation or 36 | * maintenance of any nuclear facility. 37 | */ 38 | 39 | import com.sun.tools.doclets.Taglet; 40 | import com.sun.javadoc.*; 41 | import java.util.Map; 42 | import java.io.*; 43 | /** 44 | * A sample Taglet representing @example. This tag can be used in any kind of 45 | * {@link com.sun.javadoc.Doc}. It is not an inline tag. The text is displayed 46 | * in yellow to remind the developer to perform a task. For 47 | * example, "@example Hello" would be shown as: 48 | *
49 | *
50 | * To Do: 51 | *
Fix this! 52 | *
53 | *
54 | * 55 | * @author Jamie Ho 56 | * @since 1.4 57 | */ 58 | 59 | public class ExampleTaglet implements Taglet { 60 | 61 | private static final String NAME = "example"; 62 | private static final String HEADER = "example To Do:"; 63 | 64 | /** 65 | * Return the name of this custom tag. 66 | */ 67 | public String getName() { 68 | return NAME; 69 | } 70 | 71 | /** 72 | * Will return true since @example 73 | * can be used in field documentation. 74 | * @return true since @example 75 | * can be used in field documentation and false 76 | * otherwise. 77 | */ 78 | public boolean inField() { 79 | return true; 80 | } 81 | 82 | /** 83 | * Will return true since @example 84 | * can be used in constructor documentation. 85 | * @return true since @example 86 | * can be used in constructor documentation and false 87 | * otherwise. 88 | */ 89 | public boolean inConstructor() { 90 | return true; 91 | } 92 | 93 | /** 94 | * Will return true since @example 95 | * can be used in method documentation. 96 | * @return true since @example 97 | * can be used in method documentation and false 98 | * otherwise. 99 | */ 100 | public boolean inMethod() { 101 | return true; 102 | } 103 | 104 | /** 105 | * Will return true since @example 106 | * can be used in method documentation. 107 | * @return true since @example 108 | * can be used in overview documentation and false 109 | * otherwise. 110 | */ 111 | public boolean inOverview() { 112 | return true; 113 | } 114 | 115 | /** 116 | * Will return true since @example 117 | * can be used in package documentation. 118 | * @return true since @example 119 | * can be used in package documentation and false 120 | * otherwise. 121 | */ 122 | public boolean inPackage() { 123 | return true; 124 | } 125 | 126 | /** 127 | * Will return true since @example 128 | * can be used in type documentation (classes or interfaces). 129 | * @return true since @example 130 | * can be used in type documentation and false 131 | * otherwise. 132 | */ 133 | public boolean inType() { 134 | return true; 135 | } 136 | 137 | /** 138 | * Will return false since @example 139 | * is not an inline tag. 140 | * @return false since @example 141 | * is not an inline tag. 142 | */ 143 | 144 | public boolean isInlineTag() { 145 | return false; 146 | } 147 | 148 | /** 149 | * Register this Taglet. 150 | * @param tagletMap the map to register this tag to. 151 | */ 152 | public static void register(Map tagletMap) { 153 | ExampleTaglet tag = new ExampleTaglet(); 154 | Taglet t = (Taglet) tagletMap.get(tag.getName()); 155 | if (t != null) { 156 | tagletMap.remove(tag.getName()); 157 | } 158 | tagletMap.put(tag.getName(), tag); 159 | } 160 | 161 | /** 162 | * Given the Tag representation of this custom 163 | * tag, return its string representation. 164 | * @param tag the Tag representation of this custom tag. 165 | */ 166 | public String toString(Tag tag) { 167 | return createHTML(readFile(tag.text())); 168 | } 169 | 170 | 171 | /** 172 | * Given an array of Tags representing this custom 173 | * tag, return its string representation. 174 | * @param tags the array of Tags representing of this custom tag. 175 | */ 176 | public String toString(Tag[] tags) { 177 | if (tags.length == 0) { 178 | return null; 179 | } 180 | return createHTML(readFile(tags[0].text())); 181 | } 182 | 183 | 184 | 185 | String createHTML(String theString) { 186 | if(theString!=null) { 187 | String dd = ""; 193 | 194 | return dd+"\n
" + 195 | "
+Example
" + 196 | "
"+theString+"
" + 197 | "
"; 198 | } 199 | return ""; 200 | } 201 | 202 | 203 | /** 204 | * check if the examples directory exists and return the example as given in the tag. 205 | * @param theExample the name of the example 206 | */ 207 | String readFile(String theExample) { 208 | String record = ""; 209 | String myResult = ""; 210 | int recCount = 0; 211 | String myDir = "../examples"; 212 | File file=new File(myDir); 213 | if(file.exists()==false) { 214 | myDir = "./examples"; 215 | } 216 | try { 217 | FileReader fr = new FileReader(myDir+"/"+theExample+"/"+theExample+".pde"); 218 | BufferedReader br = new BufferedReader(fr); 219 | record = new String(); 220 | while ((record = br.readLine()) != null) { 221 | myResult += record+"\n"; 222 | } 223 | } catch (IOException e) { 224 | System.out.println(e); 225 | return null; 226 | } 227 | return myResult; 228 | } 229 | } 230 | 231 | 232 | -------------------------------------------------------------------------------- /resources/code/ant-contrib-1.0b3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/resources/code/ant-contrib-1.0b3.jar -------------------------------------------------------------------------------- /resources/library.properties: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your Library as you want it formatted. 5 | name = ##library.name## 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [##author.name##](##author.url##) 9 | 10 | # A web page for your Library, NOT a direct link to where to download it. 11 | url = ##library.url## 12 | 13 | # The category (or categories) of your Library, must be from the following list: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your Library will listed as 20 | # "Other". Many categories must be comma-separated. 21 | categories = ##library.categories## 22 | 23 | # A short sentence (or fragment) to summarize the Library's function. This will 24 | # be shown from inside the PDE when the Library is being installed. Avoid 25 | # repeating the name of your Library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a Library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = ##library.sentence## 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your Library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = ##library.paragraph## 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | # A version number that increments once with each release. This is used to 41 | # compare different versions of the same Library, and check if an update is 42 | # available. You should think of it as a counter, counting the total number of 43 | # releases you've had. 44 | version = ##library.version## # This must be parsable as an int 45 | 46 | # The version as the user will see it. If blank, the version attribute will be 47 | # used here. This should be a single word, with no spaces. 48 | prettyVersion = ##library.prettyVersion## # This is treated as a String 49 | 50 | # The min and max revision of Processing compatible with your Library. 51 | # Note that these fields use the revision and not the version of Processing, 52 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 53 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 54 | # Only use maxRevision (or minRevision), when your Library is known to 55 | # break in a later (or earlier) release. Otherwise, use the default value 0. 56 | minRevision = ##compatible.minRevision## 57 | maxRevision = ##compatible.maxRevision## 58 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/src/.DS_Store -------------------------------------------------------------------------------- /src/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/src/com/.DS_Store -------------------------------------------------------------------------------- /src/com/jaysonh/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaysonh/Dmx4Artists/5b8db5446bb9207f0b12f772613ad05dfb17e5ca/src/com/jaysonh/.DS_Store -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/DMXParam.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // import packages 4 | import static processing.core.PApplet.*; 5 | import processing.core.PApplet; 6 | import processing.*; 7 | import java.util.List; 8 | 9 | /** 10 | * Parent class for all DMXParams 11 | * @author Jayson Haebich 12 | * @author www.jaysonh.com 13 | * @version 0.1 14 | * @since 0.1 15 | */ 16 | public abstract class DMXParam 17 | { 18 | /************************************************************************************ 19 | * Public Methods 20 | ************************************************************************************/ 21 | 22 | /** 23 | * Constructor 24 | * 25 | * @return nothing 26 | */ 27 | public DMXParam() 28 | { 29 | } 30 | 31 | public abstract DMXParam getCopy(); 32 | 33 | /** 34 | * Has the param finished running 35 | * 36 | * @return true/false if has finished 37 | */ 38 | public boolean hasFinished() 39 | { 40 | return this.started && this.finished; 41 | } 42 | 43 | public void stop() 44 | { 45 | started = true; 46 | finished = true; 47 | autoStart = false; 48 | } 49 | 50 | void reset() 51 | { 52 | started = false; 53 | finished = false; 54 | } 55 | 56 | /** 57 | * Constructor 58 | * 59 | * @return nothing 60 | */ 61 | public DMXParam getLaunchTrigger() 62 | { 63 | return triggerParam; 64 | } 65 | 66 | /** 67 | * abstract function that is implemented by each individual param 68 | */ 69 | public abstract void update(); 70 | 71 | /** 72 | * This adds a param that is started when the current param finishes 73 | * 74 | * @param param to add that triggers when this param finishes running 75 | * @return nothing 76 | */ 77 | public void addTrigger( DMXParam triggerParam ) 78 | { 79 | this.triggerParam = triggerParam; // store the param trigger 80 | 81 | // By default set the trigger param to not auto start, since it should start when 82 | // it's parent DMXParam has finished 83 | this.triggerParam.setAutoStart( false ); 84 | 85 | } 86 | 87 | /** 88 | * Start running the thread for this param 89 | * 90 | * @return nothing 91 | */ 92 | public void start() 93 | { 94 | if( !started ) 95 | { 96 | startTime = appRef.millis(); 97 | started = true; 98 | } 99 | } 100 | 101 | /** 102 | * Stop running the thread for this param 103 | */ 104 | 105 | 106 | 107 | /** 108 | * Set the value of the param 109 | * 110 | * @param value to set 111 | * @return nothing 112 | */ 113 | public void setValue( int value ) 114 | { 115 | this.value = value; 116 | } 117 | 118 | /** 119 | * Set the value of the param 120 | * 121 | * @param value to set 122 | * @return nothing 123 | */ 124 | public void setValue( float value ) 125 | { 126 | this.value = value; 127 | } 128 | 129 | /** 130 | * Set whether the param will autostart 131 | * 132 | * @param autoStart do we autostart the param 133 | * @return nothing 134 | */ 135 | public void setAutoStart( boolean autoStart ) 136 | { 137 | this.autoStart=autoStart; 138 | } 139 | 140 | /** 141 | * Get if the param has started 142 | * 143 | * @return if the param has started 144 | */ 145 | public boolean getStarted() 146 | { 147 | return started; 148 | } 149 | 150 | 151 | /** 152 | * Get the value of the param 153 | * 154 | * @return value of the param 155 | */ 156 | 157 | public float getValue() 158 | { 159 | return value; 160 | } 161 | 162 | /** 163 | * Get the auto start 164 | * 165 | * @return if the param will auto start 166 | */ 167 | public boolean getAutoStart() 168 | { 169 | return autoStart; 170 | } 171 | 172 | /** 173 | * Set the finished state of the Param 174 | * @param finished 175 | */ 176 | public void setFinished( boolean finished ) 177 | { 178 | this.finished = finished; 179 | } 180 | 181 | public void setStartVal( int startVal ) 182 | { 183 | this.startVal = startVal; 184 | } 185 | 186 | /** 187 | * Get the type of the param as a string (used for debugging) 188 | * 189 | * @return type of the param as a string 190 | */ 191 | abstract public String getType(); 192 | 193 | 194 | /************************************************************************************ 195 | * Protected Variables 196 | ************************************************************************************/ 197 | 198 | protected float value = 0; // Value that this param holds 199 | protected long startTime; // Time that the param started 200 | protected boolean autoStart = true; // Will this param start automatically when program starts or will need to be triggered manually to start 201 | protected boolean started = false; // has the param started or not 202 | protected boolean finished = false; // has the param finsihed 203 | protected int startVal = 0; 204 | protected DMXParam triggerParam; // Param to trigger when this one finishes 205 | protected PApplet appRef; // Reference to processing app 206 | 207 | } 208 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/DMXParamOsc.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import static processing.core.PApplet.*; 5 | import static processing.core.PApplet.*; 6 | import processing.core.PApplet; 7 | import processing.*; 8 | 9 | /** 10 | * OSC Param, oscillates between a max and min range 11 | * 12 | * @author Jayson Haebich 13 | * @author www.jaysonh.com 14 | * @version 0.1 15 | * @since 0.1 16 | */ 17 | public class DMXParamOsc extends DMXParam 18 | { 19 | /************************************************************************************ 20 | * Public Methods 21 | ************************************************************************************/ 22 | 23 | /** 24 | * Constructor 25 | * 26 | * @param appRef Reference to parent processing sketch to access processing methods 27 | * @param period how long the oscilliation will occur (seconds) 28 | * @param min minimum value of the oscillation 29 | * @param max maximum value of the oscillation 30 | * @param moveType behaviour of the movement, how it will go from min to max 31 | * @param repeat how many times the oscillation will repeat (0 means infinite repeat) 32 | * @return nothing 33 | */ 34 | public DMXParamOsc( PApplet appRef, float period, int min, int max, MoveBehaviour moveType, int repeat, boolean autoStart ) 35 | { 36 | this.appRef = appRef; 37 | this.period = period; 38 | this.min = min; 39 | this.max = max; 40 | this.moveType = moveType; 41 | this.repeat = repeat; 42 | this.finished = false; 43 | this.autoStart = autoStart; 44 | } 45 | 46 | 47 | public DMXParam getCopy() 48 | { 49 | return new DMXParamOsc( appRef, period, min, max, moveType, repeat, autoStart ); 50 | } 51 | /** 52 | * updates the oscillation values 53 | * 54 | * @return nothing 55 | */ 56 | public void update() 57 | { 58 | if( !finished && !started && autoStart) 59 | started = true; 60 | 61 | if( started && !finished ) 62 | { 63 | float t = 0.0f; 64 | 65 | if( repeat == 0 ) // infinite repeat 66 | { 67 | t = ( ( ( float )( appRef.millis() - startTime ) / 1000.0f ) % period ) / period; 68 | }else 69 | { 70 | t = ( ( ( float )( appRef.millis() - startTime ) / 1000.0f ) ) / period; 71 | 72 | if( t >= ( float ) repeat ) 73 | { 74 | finished = true; 75 | t=1.0f; 76 | } 77 | } 78 | 79 | value = map( getMovement(t), 0.0f, 1.0f, min, max ); // get the value from specific movement type 80 | } 81 | } 82 | 83 | /** 84 | * get the type of this param 85 | * 86 | * @return type of param 87 | */ 88 | public String getType() 89 | { 90 | return "osc"; 91 | } 92 | 93 | 94 | /************************************************************************************ 95 | * Private Methods 96 | ************************************************************************************/ 97 | 98 | // Get an up and down value 99 | private float getOscSine( float t ) 100 | { 101 | float offset = 0.0f; 102 | 103 | if( startVal > 0.0) 104 | { 105 | offset = (float)(startVal - min ) / (float)(max-min); 106 | } 107 | return abs( sin( t * PI + offset * PI) ); 108 | } 109 | 110 | private float getOscLinearRamp( float t ) 111 | { 112 | return t; // goes up then resets to 0 113 | } 114 | 115 | private float getOscLinear( float t ) 116 | { 117 | // uses a triangle wave, up then down 118 | return 1.0f- abs( 0.5f - t) * 2.0f; 119 | } 120 | 121 | private float getExp( float t ) 122 | { 123 | return (float)Math.exp( (t / 1.0) * PI ) / (float)Math.exp(PI); 124 | } 125 | private float getMovement( float t ) 126 | { 127 | float result = 0.0f; 128 | 129 | switch( moveType ) 130 | { 131 | case OSC_LINEAR: 132 | result = getOscLinear( t ); 133 | break; 134 | 135 | case OSC_SINE: 136 | result = getOscSine( t ); 137 | break; 138 | 139 | case OSC_LINEAR_RAMP: 140 | result = getOscLinearRamp( t ); 141 | break; 142 | 143 | case OSC_EXP: 144 | result = getExp( t ); 145 | break; 146 | } 147 | 148 | return result; 149 | } 150 | 151 | 152 | 153 | /************************************************************************************ 154 | * Private Variables 155 | ************************************************************************************/ 156 | 157 | private int repeat; 158 | private int min; 159 | private int max; 160 | private float period; 161 | private MoveBehaviour moveType; 162 | 163 | } 164 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/DMXParamStatic.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import static processing.core.PApplet.*; 5 | import static processing.core.PApplet.*; 6 | import processing.core.PApplet; 7 | import processing.*; 8 | 9 | /** 10 | * Static Param, is set directly and does not change 11 | * 12 | * @author Jayson Haebich 13 | * @author www.jaysonh.com 14 | * @version 0.1 15 | * @since 0.1 16 | */ 17 | public class DMXParamStatic extends DMXParam 18 | { 19 | /************************************************************************************ 20 | * Public Methods 21 | ************************************************************************************/ 22 | public DMXParamStatic( PApplet appRef ) 23 | { 24 | this.appRef = appRef; 25 | this.value = 0; 26 | } 27 | 28 | public DMXParamStatic( PApplet appRef, int value ) 29 | { 30 | this.appRef = appRef; 31 | this.value = value; 32 | } 33 | 34 | public DMXParamStatic( PApplet appRef, float value ) 35 | { 36 | this.appRef = appRef; 37 | this.value = value; 38 | } 39 | 40 | public DMXParam getCopy() 41 | { 42 | return new DMXParamStatic( appRef, value ); 43 | } 44 | 45 | public String getType() 46 | { 47 | return "static"; 48 | } 49 | 50 | public void update() 51 | { 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/FTDIDmx.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import com.sun.jna.*; 5 | import com.sun.jna.Memory; 6 | import com.sun.jna.ptr.*; 7 | import com.sun.jna.Pointer; 8 | import java.util.*; 9 | 10 | /** 11 | * Class used to interact directly with an FTDI based USB DMX Device 12 | * 13 | * @author Jayson Haebich 14 | * @author www.jaysonh.com 15 | * @version 0.1 16 | * @since 0.1 17 | */ 18 | public class FTDIDmx 19 | { 20 | /************************************************************************************ 21 | * Public Methods 22 | ************************************************************************************/ 23 | 24 | /** 25 | * Constructs an empty dmx device 26 | */ 27 | public FTDIDmx( ) throws FTDIException 28 | { 29 | // Check if system is ssetup ok 30 | if( (new SystemValidator()).isValid() ) 31 | { 32 | // load dmx devices into the list 33 | loadFTDIDevices(); 34 | } 35 | } 36 | /** 37 | * Constructs an OpenDmx object on the given device number. If you only have 1 OpenDMX 38 | * device connected, then you should just input 0. 39 | * 40 | * @param deviceNum number of the connected OpenDMX device. Input 0 if you have only 1 such device. 41 | * @return nothing 42 | */ 43 | public FTDIDmx( int deviceNum ) throws FTDIException 44 | { 45 | // Check if system is ssetup ok 46 | if( (new SystemValidator()).isValid() ) 47 | { 48 | // load dmx devices into the list 49 | loadFTDIDevices(); 50 | 51 | // Open the device 52 | openDevice( deviceNum ); 53 | } 54 | } 55 | /** 56 | * Constructs an OpenDmx object on the given device number. If you only have 1 OpenDMX 57 | * device connected, then you should just input 0. 58 | * 59 | * @param serialNumber serial number of the connected OpenDMX device. 60 | * @return nothing 61 | */ 62 | public FTDIDmx( String serialNumber ) throws FTDIException 63 | { 64 | if( (new SystemValidator()).isValid() ) 65 | { 66 | // load dmx devices into the list 67 | loadFTDIDevices(); 68 | 69 | boolean foundDevice = false; 70 | 71 | // Now find the deviceIndx for the specified serialNumber 72 | for( FTDevice device : deviceList ) 73 | { 74 | if( device.getSerial().equals( serialNumber ) ) 75 | { 76 | openDevice( device.getDeviceIndx() ); 77 | foundDevice = true; 78 | } 79 | } 80 | 81 | // If we can't find a device throw an exception 82 | if(!foundDevice) 83 | { 84 | throw new FTDIException("Cannot find " + serialNumber); 85 | } 86 | } 87 | 88 | } 89 | 90 | /** 91 | * FTDI Commands to connect to device 92 | * 93 | * @param deviceNum number of the connected OpenDMX device. Input 0 if you have only 1 such device. 94 | * @return nothing 95 | */ 96 | private void openDevice( int deviceNum ) throws FTDIException 97 | { 98 | 99 | PointerByReference portRef = new PointerByReference(); 100 | 101 | // these methods are wrapped by runFTDI which does error checking 102 | 103 | runFTDI( FTDI_D2XX.INSTANCE.FT_Open( (short)deviceNum, portRef ) ); 104 | 105 | this.port = portRef.getValue(); // save the port 106 | 107 | FTDI_D2XX.INSTANCE.FT_ListDevices( port, port, 0); // list devices 108 | runFTDI( FTDI_D2XX.INSTANCE.FT_ResetDevice( port ) ); // reset device 109 | runFTDI( FTDI_D2XX.INSTANCE.FT_SetDivisor( port, 12 ) ); // set device divisor 110 | runFTDI( FTDI_D2XX.INSTANCE.FT_SetDataCharacteristics( port, 111 | FTDI_D2XX.FT_BITS_8, 112 | FTDI_D2XX.FT_STOP_BITS_2, 113 | FTDI_D2XX.FT_PARITY_NONE ) ); // set data characteristics 114 | 115 | runFTDI( FTDI_D2XX.INSTANCE.FT_SetFlowControl( port, 116 | FTDI_D2XX.FT_FLOW_NONE, 117 | (byte)0, 118 | 119 | (byte)0) ); // set flow control 120 | runFTDI( FTDI_D2XX.INSTANCE.FT_ClrRts( port ) ); // clear rts 121 | runFTDI( FTDI_D2XX.INSTANCE.FT_Purge( port, FTDI_D2XX.FT_PURGE_TX ) ); // purge ftdi tx 122 | runFTDI( FTDI_D2XX.INSTANCE.FT_Purge( port, FTDI_D2XX.FT_PURGE_RX ) ); // purge ftdi rx 123 | } 124 | /** 125 | * Load list of ftdi devices 126 | * 127 | * @return nothing 128 | */ 129 | public void loadFTDIDevices() throws FTDIException 130 | { 131 | deviceList = new ArrayList< FTDevice >(); // create empty list for devices 132 | deviceList.clear(); 133 | 134 | IntByReference devNum = new IntByReference(); 135 | runFTDI( FTDI_D2XX.INSTANCE.FT_CreateDeviceInfoList( devNum ) ); 136 | 137 | System.out.println( "number devices: " + devNum.getValue() ); 138 | 139 | for( int i = 0; i < devNum.getValue(); i++ ) 140 | { 141 | // Get the ith device and print 142 | FTDevice ftDevice = new FTDevice( i ); 143 | ftDevice.printInfo(); 144 | 145 | deviceList.add( ftDevice ); // Add it to the device list 146 | } 147 | } 148 | 149 | /** 150 | * Closes the currently open OpenDMX devices. 151 | * 152 | * @return An error code. Returns FTDI_D2XX.FT_OK if everything is fine, otherwise an error. See FTDI_D2XX class. 153 | */ 154 | public int close() { 155 | assert( port != null ); 156 | return FTDI_D2XX.INSTANCE.FT_Close( port ); 157 | } 158 | 159 | /** 160 | * Sends data to the OpenDMX device. 161 | * 162 | * @param data An array of data for channels 1->N, where N is no greater than 512. 163 | * @param len_data The number of bytes to send, read from the beginning of the array. Must be between 0 and 512 164 | * 165 | * @return An error code. Returns FTDI_D2XX.FT_OK if everything is fine, otherwise an error. See FTDI_D2XX class. 166 | */ 167 | public int sendData( byte[] data, int dataLength ) throws FTDIException 168 | { 169 | // check the data is ok 170 | assert( port != null ); 171 | assert( dataLength >= 0 && dataLength <= 512 ); 172 | 173 | runFTDI( FTDI_D2XX.INSTANCE.FT_SetBreakOn( port ) ); 174 | runFTDI( FTDI_D2XX.INSTANCE.FT_SetBreakOff( port ) ); 175 | 176 | IntByReference written = new IntByReference(); 177 | 178 | byte[] code = {0}; 179 | 180 | FTDI_D2XX.INSTANCE.FT_Write( port, code, 1, written ) ; 181 | FTDI_D2XX.INSTANCE.FT_Write( port, data, dataLength, written ); 182 | 183 | return 1; 184 | } 185 | /** 186 | * Checks the error code of an FTDI commands 187 | * used for wrapping ftdi commands 188 | * 189 | * @param checkResult return code of an FTDI method 190 | * 191 | * @return nothing 192 | */ 193 | private void runFTDI( int checkResult ) throws FTDIException 194 | { 195 | if ( checkResult != FTDI_D2XX.FT_OK ) 196 | { 197 | String errorMsg = ""; 198 | if( checkResult == 1) 199 | errorMsg = "invalid device"; 200 | else if( checkResult == 2 ) 201 | errorMsg = "no device found"; 202 | else if( checkResult == 3 ) 203 | errorMsg = "cannot open device"; 204 | throw new FTDIException( " error code: " + errorMsg ); 205 | } 206 | } 207 | 208 | 209 | public String [] getDevices() throws FTDIException 210 | { 211 | IntByReference devNum = new IntByReference(); 212 | runFTDI( FTDI_D2XX.INSTANCE.FT_CreateDeviceInfoList( devNum ) ); 213 | 214 | String [] devices = new String[ devNum.getValue() ]; 215 | 216 | for( int i = 0; i < devNum.getValue(); i++ ) 217 | { 218 | FTDevice ftDevice = new FTDevice( i ); 219 | 220 | devices[ i ] = ftDevice.getSerial(); 221 | } 222 | 223 | return devices; 224 | } 225 | 226 | /************************************************************************************ 227 | * Private Variables 228 | ************************************************************************************/ 229 | 230 | private ArrayList deviceList; // List of ftdi devices 231 | private Pointer port = null; // Pointer to open port 232 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/FTDIException.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | import java.sql.Timestamp; 4 | /** 5 | * Custom Exception for OpenDMX hardware 6 | * 7 | * @author Jayson Haebich 8 | * @version 0.1 9 | */ 10 | public class FTDIException extends Exception 11 | { 12 | /************************************************************************************ 13 | * Public Methods 14 | ************************************************************************************/ 15 | 16 | /** 17 | * Constructs an exception 18 | * 19 | * @param device_number number of the connected OpenDMX device. Input 0 if you have only 1 such device. 20 | */ 21 | public FTDIException( String message ) 22 | { 23 | // Create an error message with timestamp to throw 24 | super( new Timestamp( System.currentTimeMillis() ) + " FTDIException: " + message ); 25 | } 26 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/FTDI_D2XX.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import com.sun.jna.Library; 5 | import com.sun.jna.Native; 6 | import com.sun.jna.Pointer; 7 | import com.sun.jna.ptr.*; 8 | 9 | /** 10 | * Interface for interacting with the DLL driver that controls the OpenDMX hardware. DO NOT DO ANYTHING WITH THIS CLASS DIRECTLY. 11 | * Unless you know what you're doing. 12 | * 13 | * @author Omar Khan 14 | */ 15 | /** 16 | * Interface used to interact directly ftdi library 17 | * adapted from the OpenDMX class By Omar Khan 18 | * 19 | * @author Jayson Haebich 20 | * @author www.jaysonh.com 21 | * @version 0.1 22 | * @since 0.1 23 | */ 24 | public interface FTDI_D2XX extends Library 25 | { 26 | /************************************************************************************ 27 | * Public Constants 28 | ************************************************************************************/ 29 | 30 | final static byte FT_OK = 0; 31 | final static byte FT_INVALID_HANDLE = 1; 32 | final static byte FT_DEVICE_NOT_FOUND = 2; 33 | final static byte FT_DEVICE_NOT_OPENED = 3; 34 | final static byte FT_IO_ERROR = 4; 35 | final static byte FT_INSUFFICIENT_RESOURCES = 5; 36 | 37 | final static byte FT_BITS_8 = 8; // ' Word Lengths 38 | final static byte FT_STOP_BITS_2 = 2; // Stop Bits 39 | final static byte FT_PARITY_NONE = 0; // Parity 40 | final static byte FT_FLOW_NONE = 0; // Flow Control 41 | final static byte FT_PURGE_RX = 1; // Purge rx and tx buffers 42 | final static byte FT_PURGE_TX = 2; 43 | 44 | //FTDI_D2XX INSTANCE = (FTDI_D2XX) Native.loadLibrary("ftd2xx", FTDI_D2XX.class); 45 | // Load the dylib or dll from the Processing DMXForArtist library folder 46 | // This is hopefully more reliable than before 47 | FTDI_D2XX INSTANCE = (FTDI_D2XX) Native.loadLibrary( new PathFinder().getLibraryPath(), FTDI_D2XX.class); 48 | 49 | int FT_Open(short intDeviceNumber, PointerByReference handle); 50 | int FT_Close(Pointer handle); 51 | int FT_ResetDevice (Pointer handle); 52 | int FT_SetDivisor(Pointer handle, int div); 53 | int FT_SetDataCharacteristics(Pointer handle, byte byWordLength, byte byStopBits, byte byParity); 54 | int FT_SetFlowControl(Pointer handle, short intFlowControl, byte byXonChar, byte byXoffChar); 55 | int FT_ClrRts(Pointer handle); 56 | int FT_SetRts(Pointer handle); 57 | int FT_Purge(Pointer handle, int lngMask); 58 | int FT_SetBreakOn(Pointer handle); 59 | int FT_SetBreakOff(Pointer handle); 60 | int FT_Write (Pointer handle, byte[] buffer, int lngBufferSize, IntByReference lngBytesWritten); 61 | 62 | int FT_CreateDeviceInfoList( IntByReference lpdwNumDevs ); 63 | int FT_ListDevices(Pointer pvArg1, Pointer pvArg2, int dwFlags); 64 | int FT_GetDeviceInfoDetail( int dwIndex, 65 | IntByReference lpdwFlags, 66 | IntByReference lpdwType, 67 | IntByReference lpdwID, 68 | IntByReference lpdwLocId, 69 | Pointer pcSerialNumber, 70 | Pointer pcDescription, 71 | IntByReference ftHandle ); 72 | 73 | 74 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/FTDevice.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import com.sun.jna.Memory; 5 | import com.sun.jna.ptr.*; 6 | import com.sun.jna.Pointer; 7 | import java.util.*; 8 | 9 | /** 10 | * Class used to interact directly with an FTDI based USB DMX Device 11 | * 12 | * @author Jayson Haebich 13 | * @author www.jaysonh.com 14 | * @version 0.1 15 | * @since 0.1 16 | */ 17 | public class FTDevice 18 | { 19 | /************************************************************************************ 20 | * Public Methods 21 | ************************************************************************************/ 22 | 23 | /** 24 | * Constructor 25 | */ 26 | FTDevice( int deviceIndx ) 27 | { 28 | this.deviceIndx = deviceIndx; 29 | 30 | // Reference objects passed into FTDI library 31 | IntByReference flagRef = new IntByReference(); 32 | IntByReference devTypeRef = new IntByReference(); 33 | IntByReference devIDRef = new IntByReference(); 34 | IntByReference locIDRef = new IntByReference(); 35 | IntByReference ftHandleRef = new IntByReference(); 36 | Memory devSerNumRef = new Memory(16); 37 | Memory devDescRef = new Memory(64); 38 | 39 | // Load the FTDI device data from the device 40 | FTDI_D2XX.INSTANCE.FT_GetDeviceInfoDetail( deviceIndx, 41 | flagRef, 42 | devTypeRef, 43 | devIDRef, 44 | locIDRef, 45 | devSerNumRef, 46 | devDescRef, 47 | ftHandleRef); 48 | 49 | // Convert references to local variables 50 | this.serialNum = devSerNumRef.getString(0); 51 | this.devDesc = devDescRef.getString(0); 52 | this.devID = devIDRef.getValue(); 53 | this.locID = locIDRef.getValue(); 54 | this.serialNum = devSerNumRef.getString(0); 55 | this.devDesc = devDescRef.getString(0); 56 | this.ftHandle = ftHandleRef.getValue(); 57 | } 58 | 59 | /** 60 | * Prints the info about this FTDevice to the console 61 | */ 62 | public void printInfo() 63 | { 64 | System.out.println( "deviceIndx: " + this.deviceIndx ); 65 | System.out.println( "flag: " + this.flag ); 66 | System.out.println( "devType: " + this.devType ); 67 | System.out.println( "devID: " + this.devID ); 68 | System.out.println( "locID: " + this.locID ); 69 | System.out.println( "serialNum: " + this.serialNum ); 70 | System.out.println( "devDesc: " + this.devDesc ); 71 | System.out.println( "ftHandle: " + this.ftHandle ); 72 | System.out.println( "" ); 73 | } 74 | 75 | /** 76 | * get the device indx 77 | */ 78 | int getDeviceIndx() { return deviceIndx; } 79 | 80 | /** 81 | * get the device serial number 82 | */ 83 | String getSerial() { return serialNum; } 84 | 85 | /************************************************************************************ 86 | * Private Variables 87 | ************************************************************************************/ 88 | 89 | private int deviceIndx; // device index in the list of all FTDI devices 90 | private int flag; 91 | private int devType; 92 | private int devID; 93 | private int locID; 94 | private String serialNum; 95 | private String devDesc; 96 | private int ftHandle; 97 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/HSBColor.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | import processing.core.*; 4 | import java.util.*; 5 | import processing.core.PGraphics; 6 | import processing.core.PApplet; 7 | import static processing.core.PApplet.*; 8 | 9 | /** 10 | * Converts RGB color to HSB color 11 | * 12 | * @author Jayson Haebich 13 | * @author www.jaysonh.com 14 | * @version 0.1 15 | * @since 0.1 16 | */ 17 | 18 | public class HSBColor 19 | { 20 | /************************************************************************************ 21 | * Public Methods 22 | ************************************************************************************/ 23 | 24 | /** 25 | * Constructs a HSBColor 26 | * 27 | * @param appRef reference to the parent object so that we can call Processing functions from our code 28 | * @param h hue 29 | * @param s saturation 30 | * @param b brightness 31 | * 32 | */ 33 | public HSBColor( PApplet appRef, int h, int s, int b ) 34 | { 35 | this.appRef = appRef; 36 | 37 | create( h, s, b ); 38 | } 39 | 40 | /** 41 | * Get the RGB color object 42 | * 43 | * @returns color object 44 | * 45 | */ 46 | public int getRGB() 47 | { 48 | return rgbCol; 49 | } 50 | 51 | /** 52 | * Set the range for the h, s and b 53 | * 54 | * param range max value of the h, s and b 55 | * 56 | */ 57 | public void setRange( int range ) 58 | { 59 | this.range = range; 60 | 61 | create( h, s, b ); // recalculate the hsb values with the new range 62 | } 63 | 64 | /** 65 | * Get the hue 66 | * 67 | * return hue 68 | * 69 | */ 70 | public int getHue() { return h; } 71 | 72 | /** 73 | * Get the brightness 74 | * 75 | * return brightness 76 | * 77 | */ 78 | public int getBri() { return b; } 79 | 80 | /** 81 | * Get the saturation 82 | * 83 | * return saturation 84 | * 85 | */ 86 | public int getSat() { return s; } 87 | 88 | /************************************************************************************ 89 | * Private Methods 90 | ************************************************************************************/ 91 | 92 | /** 93 | * 94 | * @param h hue 95 | * @param s saturation 96 | * @param b brightness 97 | */ 98 | private void create( int h, int s, int b ) 99 | { 100 | this.h = h; 101 | this.s = s; 102 | this.b = b; 103 | 104 | // use processings inbuilt functions to convert from HSB to RGB 105 | appRef.pushStyle(); 106 | 107 | appRef.colorMode( HSB, range, range, range ); 108 | rgbCol = appRef.color( this.h, this.s, this.b ); 109 | 110 | appRef.popStyle(); 111 | } 112 | 113 | /************************************************************************************ 114 | * Constants 115 | ************************************************************************************/ 116 | 117 | public static final int DEFAULT_RANGE = 255; 118 | 119 | /************************************************************************************ 120 | * Private Variables 121 | ************************************************************************************/ 122 | private PApplet appRef; 123 | private int range = DEFAULT_RANGE; 124 | private int rgbCol; 125 | private int h, s, b; 126 | 127 | } 128 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/LinuxValidator.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | public class LinuxValidator 4 | { 5 | boolean isValid() 6 | { 7 | // check that ftdi .so is in the correct place 8 | 9 | OSXCommand lsCommand = new OSXCommand("ls", "-al", "/usr/local/lib/libftd2xx.so"); 10 | 11 | String[] res = lsCommand.getOutput(); 12 | 13 | if(res.length>0) // found libftd2xx.so 14 | { 15 | // now run rmmod to disable VCP ftdi driver 16 | OSXCommand rmmodCmd1 = new OSXCommand("sudo", "rmmod", "ftdi_sio"); 17 | OSXCommand rmmodCmd2 = new OSXCommand("sudo", "rmmod", "usbserial`"); 18 | 19 | if( rmmodCmd1.getOutput().length >0 || 20 | rmmodCmd1.getOutput().length >0 ) 21 | { 22 | System.out.println("cannot disable VCP ftdi driver"); 23 | System.out.println("cannot setup linux drivers"); 24 | return false; 25 | } 26 | System.out.println("linux ok"); 27 | return true; 28 | }else 29 | { 30 | System.out.println("cannot find /usr/local/lib/libftd2xx.so"); 31 | return false; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/MoveBehaviour.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | /** 4 | * Enum for the different types of movement behaviour of a DMXParamOsc 5 | * 6 | * @author Jayson Haebich 7 | * @author www.jaysonh.com 8 | * @version 0.1 9 | * @since 0.1 10 | */ 11 | public enum MoveBehaviour{ OSC_LINEAR, // straight up and down 12 | OSC_LINEAR_RAMP, // straight up, then restart at 0, saw wave 13 | OSC_SINE, // up and down with a sin wave (rounded shape) 14 | OSC_EXP // Exponential ramp up, then restart at zero 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/OSXCommand.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.io.IOException; 6 | import java.lang.Process; 7 | import java.util.List; 8 | import java.util.ArrayList; 9 | import processing.core.PApplet; 10 | 11 | /** 12 | * 13 | * 14 | */ 15 | 16 | public class OSXCommand 17 | { 18 | OSXCommand(String... args) 19 | { 20 | Process p = PApplet.exec(args); 21 | try 22 | { 23 | int result = p.waitFor(); 24 | BufferedReader stdInput = new BufferedReader(new 25 | InputStreamReader(p.getInputStream())); 26 | 27 | BufferedReader stdError = new BufferedReader(new 28 | InputStreamReader(p.getErrorStream())); 29 | 30 | // Read the output from the command 31 | String s = null; 32 | outputRes = ""; 33 | 34 | while ((s = stdInput.readLine()) != null) 35 | { 36 | s = s.trim(); 37 | if( s.length() > 0 ) 38 | { 39 | outputLines.add( s ); 40 | } 41 | } 42 | } 43 | catch (InterruptedException e) { e.printStackTrace(); } 44 | catch (IOException e) { e.printStackTrace(); } 45 | } 46 | 47 | String [] getOutput() 48 | { 49 | String [] lines = new String[ outputLines.size() ]; 50 | 51 | lines = outputLines.toArray( lines ); 52 | 53 | return lines; 54 | } 55 | 56 | ArrayList outputLines = new ArrayList(); 57 | 58 | String outputRes = ""; 59 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/OSXValidator.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | /** 4 | * Checks an OSX system to see if it has the correct settings to run the library 5 | * 6 | * @author Jayson Haebich 7 | * @author www.jaysonh.com 8 | * @version 0.1 9 | * @since 1.1 10 | */ 11 | 12 | public class OSXValidator 13 | { 14 | public boolean isValid() 15 | { 16 | OSXCommand commandDylib = new OSXCommand("ls", "-al", "/usr/local/lib/libftd2xx.1.4.24.dylib"); 17 | 18 | String[] res = commandDylib.getOutput(); 19 | 20 | boolean dylibOK = true; 21 | boolean permsOK = true; 22 | 23 | /*if(res.length > 0) 24 | { 25 | String []cols = res[0].split(" "); 26 | 27 | if( cols[ cols.length-1].trim().equals("/usr/local/lib/libftd2xx.1.2.2.dylib") ) 28 | { 29 | String dylibLink = cols[cols.length-1].trim(); 30 | dylibOK = true; 31 | 32 | // now check permissions for dylib 33 | String permissions = cols[0]; 34 | 35 | char rUser = permissions.charAt(1); 36 | char xUser = permissions.charAt(3); 37 | char rGroup = permissions.charAt(4); 38 | char xGroup = permissions.charAt(6); 39 | char rOther = permissions.charAt(7); 40 | char xOther = permissions.charAt(9); 41 | 42 | // check that user, group and other has r and x permission 43 | if( rUser == 'r' && rGroup == 'r' && rOther == 'r' && 44 | xUser == 'x' && xGroup == 'x' && xOther == 'x' ) 45 | { 46 | permsOK = true; 47 | } 48 | } 49 | }*/ 50 | 51 | OSXCommand kextstatCmd = new OSXCommand("kextstat"); 52 | 53 | String[] kextstatRes = kextstatCmd.getOutput(); 54 | boolean foundAppleFTDI = false; 55 | 56 | for(int i =0;i < kextstatRes.length; i++) 57 | { 58 | if( kextstatRes[i].contains("AppleUSBFTDI") ) 59 | foundAppleFTDI = true; 60 | } 61 | 62 | if( !dylibOK ) 63 | { 64 | System.err.println("missing libftd2xx.1.4.24.dylib in /usr/local/lib"); 65 | System.err.println("move libftd2xx.1.4.24.dylib from osxDependencies to /usr/local/lib (requires sudo)"); 66 | System.err.println(""); 67 | } 68 | 69 | if( !permsOK ) 70 | { 71 | System.err.println("invalid permissions for libftd2xx.dylib"); 72 | System.err.println("please run these commands in terminal: "); 73 | System.err.println("sudo chmod a+r /usr/local/lib/libftd2xx.1.4.24.dylib"); 74 | System.err.println("sudo chmod a+r /usr/local/lib/libftd2xx.dylib"); 75 | System.err.println(""); 76 | } 77 | 78 | if( foundAppleFTDI ) 79 | { 80 | System.err.println("error, conflicting FTDI driver found, please remove:"); 81 | System.err.println("sudo kextunload -b com.apple.driver.AppleUSBFTDI"); 82 | System.err.println(""); 83 | } 84 | 85 | if( dylibOK && permsOK && !foundAppleFTDI ) 86 | { 87 | System.out.println("library setup ok"); 88 | 89 | return true; 90 | }else 91 | { 92 | System.out.println("cannot load FTDI driver, see instructions above to fix") ; 93 | 94 | return false; 95 | } 96 | 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/PathFinder.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | public class PathFinder 4 | { 5 | String getLibraryPath() 6 | { 7 | String res = System.getProperty("java.class.path"); 8 | 9 | String [] comps; 10 | 11 | int os = new SystemValidator().checkOS(); 12 | 13 | // if osx then need to split by : 14 | // if win then need to split by ; 15 | if(os == SystemValidator.OS_OSX) 16 | { 17 | comps = res.split(":"); 18 | }else if(os == SystemValidator.OS_WIN) 19 | { 20 | comps = res.split(";"); 21 | }else 22 | { 23 | comps = null; //empty 24 | } 25 | 26 | boolean foundLibPath = false; 27 | String dmxLibPath = ""; 28 | 29 | for(int i = 0; i < comps.length && !foundLibPath;i++) 30 | { 31 | if( comps[i].contains("Dmx4Artists")) 32 | { 33 | String [] paths =comps[i].split("Dmx4Artists"); 34 | 35 | if(os == SystemValidator.OS_OSX) 36 | { 37 | dmxLibPath = paths[0] + "Dmx4Artists/dependencies/osx/" + osxLib; 38 | }else if(os == SystemValidator.OS_WIN) 39 | { 40 | dmxLibPath = paths[0] + "Dmx4Artists/dependencies/win/" + winLib; 41 | } 42 | System.out.println("found path: " + dmxLibPath); 43 | foundLibPath = true; 44 | } 45 | } 46 | 47 | return dmxLibPath; 48 | } 49 | 50 | private String osxLib = "libftd2xx.1.4.24.dylib"; 51 | private String winLib = "ftd2xx.dll"; 52 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/SystemValidator.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | /** 4 | * Checks to see if the system is valid 5 | * 6 | * @author Jayson Haebich 7 | * @author www.jaysonh.com 8 | * @version 0.1 9 | * @since 1.1 10 | */ 11 | 12 | public class SystemValidator 13 | { 14 | public boolean isValid() 15 | { 16 | if( checkOS() == OS_OSX ) 17 | { 18 | return new OSXValidator().isValid(); 19 | }else if(checkOS() == OS_WIN ) 20 | { 21 | return new WINValidator().isValid(); 22 | }else if(checkOS() == OS_LINUX) 23 | { 24 | return new LinuxValidator().isValid(); 25 | }else 26 | { 27 | System.err.println("Unsupported operating system"); 28 | return false; 29 | } 30 | } 31 | 32 | int checkOS() 33 | { 34 | String osName = System.getProperty("os.name").toLowerCase(); 35 | 36 | //mac os x 37 | //windows 10 38 | if(osName.startsWith("windows")) 39 | return OS_WIN; 40 | else if(osName.startsWith("mac os x")) 41 | return OS_OSX; 42 | else if(osName.startsWith("linux")) 43 | return OS_LINUX; 44 | else 45 | { 46 | System.err.println( "Unsupported OS:" + osName ); 47 | return OS_UNK; 48 | } 49 | } 50 | 51 | /* 52 | * Get the operating string as a 3 letter string 53 | */ 54 | String getOS() 55 | { 56 | if( checkOS() == OS_OSX ) 57 | { 58 | return "osx"; 59 | }else if(checkOS() == OS_WIN ) 60 | { 61 | return "win"; 62 | }else if(checkOS() == OS_LINUX ) 63 | { 64 | return "linux"; 65 | }else 66 | { 67 | System.err.println("Unsupported operating system"); 68 | return ""; 69 | } 70 | } 71 | 72 | static final int OS_UNK = 0; 73 | static final int OS_OSX = 1; 74 | static final int OS_WIN = 2; 75 | static final int OS_LINUX = 3; 76 | 77 | } -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/Timeline.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import java.util.*; 5 | import java.util.ArrayList; 6 | import static processing.core.PApplet.*; 7 | import processing.core.PApplet; 8 | import processing.*; 9 | 10 | /** 11 | * Timeline for adding params to 12 | * 13 | * @author Jayson Haebich 14 | * @author www.jaysonh.com 15 | * @version 0.1 16 | * @since 0.1 17 | */ 18 | public class Timeline extends Thread 19 | { 20 | /************************************************************************************ 21 | * Public Methods 22 | ************************************************************************************/ 23 | 24 | /** 25 | * Constructor 26 | * 27 | * @param appRef reference to processing sketch 28 | * @param duration total length of the timeline 29 | */ 30 | public Timeline( PApplet appRef , float duration ) 31 | { 32 | this.duration = duration; 33 | this.appRef = appRef; 34 | timelineEvents = new ArrayList < TimelineEvent >(); 35 | } 36 | 37 | /** 38 | * Start the timeline 39 | * 40 | * @return nothing 41 | */ 42 | public void begin() 43 | { 44 | start = ( float ) appRef.millis() / 1000.0f; // get the current time in seconds 45 | end = start + duration; // calculate the end time 46 | running = true; 47 | 48 | this.start(); // start thread running 49 | } 50 | 51 | /** 52 | * Reset the timeline 53 | * 54 | * @return nothing 55 | */ 56 | public void resetTimeline() 57 | { 58 | float currTime = ( ( float ) appRef.millis() ) / 1000.0f; // current time as seconds 59 | 60 | start = start + duration; // move new start 61 | position = currTime - start; // recalc start 62 | 63 | // reset everything on timeline 64 | for( TimelineEvent t : timelineEvents ) 65 | { 66 | t.reset(); 67 | } 68 | } 69 | 70 | /** 71 | * Thread function, continously runs until thread ends 72 | * 73 | * @return nothing 74 | */ 75 | public void run() 76 | { 77 | while(running) 78 | { 79 | float currTime = ( ( float ) appRef.millis() ) / 1000.0f; // get current time as second 80 | position = currTime - start; 81 | 82 | if( repeat && position > duration ) // if we are past the end 83 | { 84 | resetTimeline( ); 85 | 86 | } 87 | 88 | // Update each event in this timeline 89 | for( TimelineEvent t : timelineEvents ) 90 | { 91 | t.update( position ); 92 | } 93 | 94 | // Sleep the thread to allow other processes to run 95 | try 96 | { 97 | Thread.sleep( THREAD_SLEEP_TIME ); 98 | }catch( InterruptedException e ) 99 | { 100 | e.printStackTrace(); 101 | } 102 | } 103 | } 104 | /** 105 | * Add a event to this timeline 106 | * 107 | * @param parentFixture fixture for the event to processing sketch 108 | * @param param param for the event 109 | * @param paramChannel channel that is effected 110 | * @param start start time for the event 111 | * @param end end time for the event 112 | * 113 | * @return nothing 114 | */ 115 | public void add( DMXFixture parentFixture, // fixture to assign this timeline event to 116 | DMXParam param, // dmx param to assign this timeline event to 117 | int paramChannel, // param indx to assign to 118 | float start, // start time (seconds) 119 | float end // end time (seconds) 120 | ) 121 | { 122 | // add a new event to timeline with all the parameters 123 | timelineEvents.add( new TimelineEvent( parentFixture, 124 | param, 125 | paramChannel, 126 | start, 127 | end ) ); 128 | } 129 | 130 | /** 131 | * Add a event to this timeline 132 | * 133 | * @param parentFixture fixture for the event to processing sketch 134 | * @param param param for the event 135 | * @param paramChannel channel that is effected 136 | * @param start start time for the event 137 | * @param end end time for the event 138 | * @return nothing 139 | */ 140 | public void add( DMXFixture parentFixture, // fixture to assign this timeline event to 141 | DMXParam param, // dmx param to assign this timeline event to 142 | int paramChannel, // param indx to assign to 143 | float start, // start time (seconds) 144 | float end, // end time (seconds) 145 | boolean contValue // continue value after event (not implemented) 146 | ) 147 | { 148 | // add a new event to timeline with all the parameters 149 | timelineEvents.add( new TimelineEvent( parentFixture, 150 | param, 151 | paramChannel, 152 | start, 153 | end, 154 | contValue) ); 155 | } 156 | 157 | 158 | /** 159 | * Set the event to repeat or not 160 | * 161 | * @param repeat if the param will repeat 162 | * @return nothing 163 | */ 164 | public void setRepeat( boolean repeat ) 165 | { 166 | this.repeat = repeat; 167 | } 168 | 169 | /** 170 | * Get the events from this timeline 171 | * 172 | * @return arraylist of events 173 | */ 174 | public ArrayList < TimelineEvent > getEvents() 175 | { 176 | return timelineEvents; 177 | } 178 | 179 | /** 180 | * Get the ptotal duration as seconds 181 | * 182 | * @return duration fo the timeline as seconds 183 | */ 184 | public float getDuration() 185 | { 186 | return duration; 187 | } 188 | 189 | /** 190 | * Get the position of the timeline as second 191 | * 192 | * @return position of the timeline in seconds 193 | */ 194 | public float getPosition() 195 | { 196 | return position; 197 | } 198 | 199 | /** 200 | * Get the position of the timeline as a percentage (0.0-1.0) 201 | * 202 | * @return position of the timeline as percentage 203 | */ 204 | public float getPositionPerc() 205 | { 206 | return position / duration; 207 | } 208 | /************************************************************************************ 209 | * Public Constants 210 | ************************************************************************************/ 211 | 212 | public final int THREAD_SLEEP_TIME = 50; 213 | 214 | /************************************************************************************ 215 | * Private Variables 216 | ************************************************************************************/ 217 | 218 | private boolean repeat = true; // If the timeline repeats when finished 219 | private float start = 0.0f; // start time of timeline 220 | private float end = 0.0f; // end time of timeline 221 | private float duration = 0.0f; // total duration of timeline 222 | private boolean running = false; // is the thread running 223 | private float position = 0.0f; // current position of timeline 224 | private PApplet appRef; // reference to the parent processing sketch to access processing methods 225 | 226 | private ArrayList < TimelineEvent > timelineEvents; // list of all the timeline events 227 | } 228 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/TimelineDisplay.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | // Import packages 4 | import processing.core.*; 5 | import java.util.*; 6 | import processing.core.PGraphics; 7 | import processing.core.PApplet; 8 | import static processing.core.PApplet.*; 9 | 10 | /** 11 | * Class to display a timeline to the screen, useful for debugging and visually seeing your dmx timeline 12 | * 13 | * @author Jayson Haebich 14 | * @author www.jaysonh.com 15 | * @version 0.1 16 | * @since 0.1 17 | */ 18 | public class TimelineDisplay 19 | { 20 | /************************************************************************************ 21 | * Public methods 22 | ************************************************************************************/ 23 | 24 | /** 25 | * Constructor 26 | * 27 | * @param width width of the canvas 28 | * @param height height of the canvas 29 | * @param appRef reference to processing sketch 30 | */ 31 | public TimelineDisplay( int width, int height, PApplet appRef ) 32 | { 33 | this.appRef = appRef; // need to store this so that we can use some in built processing functions 34 | 35 | resizeCanvas( width, height ); 36 | } 37 | 38 | /** 39 | * update and return the canvas of the timeline display 40 | * 41 | * @param timeline timeline that is being drawn 42 | * @param width width of the canvas to draw 43 | * @param height height of the canvas to draw 44 | * @return canvas that has been drawn into 45 | */ 46 | public PGraphics update( Timeline timeline, int width, int height ) 47 | { 48 | // Resize canvas if necessary 49 | if( width != this.width || height != this.height ) 50 | { 51 | resizeCanvas( width, height ); 52 | } 53 | 54 | canvas.beginDraw(); 55 | 56 | canvas.background( 0 ); 57 | 58 | // draw all the fixtures 59 | ArrayList < TimelineEvent > timelineEvents = timeline.getEvents(); 60 | 61 | canvas.noStroke(); 62 | appRef.randomSeed(0); 63 | 64 | float eventHeight = this.height / (float)timelineEvents.size(); 65 | 66 | // Draw all our events 67 | int numEvents = 0; 68 | for( TimelineEvent event : timelineEvents ) 69 | { 70 | float start = event.getStart(); 71 | float end = event.getEnd(); 72 | 73 | float xPosStart = PApplet.map( start, 0, timeline.getDuration(), 0, this.width ); 74 | float xPosEnd = PApplet.map( end, 0, timeline.getDuration(), 0, this.width ); 75 | 76 | canvas.fill( 255 ); 77 | canvas.text( "fix addr:" + event.getFixture().getAddress(), xPosStart, (float)numEvents * eventHeight + 10 ); 78 | canvas.text( "type:" + event.getParam().getType() + ":" + (int)event.getParam().getValue(), xPosStart, (float)numEvents * eventHeight + 20 ); 79 | canvas.text( "channel: " + event.getParamChannel(), xPosStart, (float)numEvents * eventHeight + 30 ); 80 | canvas.fill( appRef.random( 0.0f, 255.0f ), 125.0f ); 81 | canvas.rect( xPosStart,(float)numEvents * eventHeight, xPosEnd-xPosStart, eventHeight ); 82 | 83 | numEvents++; 84 | } 85 | 86 | // Write the timeline position 87 | canvas.fill( 255 ); 88 | canvas.text( (int)timeline.getPosition() + "/" + (int)timeline.getDuration(), 0, this.height-10); 89 | 90 | float timePos = map( timeline.getPositionPerc(), 0.0f, 1.0f, 0.0f, (float)this.width); 91 | 92 | // Draw a line showing the timleine position 93 | canvas.stroke( 255, 255, 255); 94 | canvas.line( timePos, 0, timePos, this.height ); 95 | canvas.endDraw(); 96 | 97 | return canvas; 98 | } 99 | 100 | /************************************************************************************ 101 | * Private Methods 102 | ************************************************************************************/ 103 | 104 | /** 105 | * resize the canvas of the timeline display 106 | * 107 | * @param w width of window to resize to 108 | * @param h heigh tof window to resize to 109 | * @return nothing 110 | */ 111 | private void resizeCanvas( int w, int h ) 112 | { 113 | this.width = w; 114 | this.height = h; 115 | 116 | canvas = appRef.createGraphics( w, h ); // recreate canvas with new dimensions 117 | } 118 | 119 | /************************************************************************************ 120 | * Private Variables 121 | ************************************************************************************/ 122 | 123 | private int width; // width of canvas 124 | private int height; // height of canvas 125 | private PGraphics canvas; // canvas that this dispaly is drawn into 126 | private PApplet appRef; // reference to parent object 127 | } 128 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/TimelineEvent.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | 4 | /** 5 | * Timeline event for adding to a timeline 6 | * 7 | * @author Jayson Haebich 8 | * @author www.jaysonh.com 9 | * @version 0.1 10 | * @since 0.1 11 | */ 12 | public class TimelineEvent 13 | { 14 | /************************************************************************************ 15 | * Public Methods 16 | ************************************************************************************/ 17 | 18 | /** 19 | * Setup this Timeline event 20 | * @param parentFixture fixture that this event applies on 21 | * @param param param that is used 22 | * @param paramChannel channel of param that is affected 23 | * @param start start time in seconds 24 | * 25 | * @return nothing 26 | */ 27 | public TimelineEvent( DMXFixture parentFixture, // fixture to assign this timeline event to 28 | DMXParam param, // dmx param to assign this timeline event to 29 | int paramChannel, // param indx to assign to 30 | float start // start time (seconds) 31 | ) 32 | { 33 | setup(parentFixture,param, paramChannel, start, -1.0f, false); // -1.0 signifies that the param should continue until it 34 | // completes it's behaviour, useful for OSCParams 35 | } 36 | 37 | /** 38 | * Constructor 39 | * 40 | * @param parentFixture fixture that this event applies on 41 | * @param param param that is used 42 | * @param paramChannel channel of param that is affected 43 | * @param start start time in seconds 44 | * @param end end time in seconds 45 | * 46 | * @return nothing 47 | */ 48 | public TimelineEvent( DMXFixture parentFixture, // fixture to assign this timeline event to 49 | DMXParam param, // dmx param to assign this timeline event to 50 | int paramChannel, // param indx to assign to 51 | float start, // start time (seconds) 52 | float end // end time (seconds) 53 | ) 54 | { 55 | setup( parentFixture, param, paramChannel, start, end, false ); 56 | } 57 | 58 | public TimelineEvent( DMXFixture parentFixture, // fixture to assign this timeline event to 59 | DMXParam param, // dmx param to assign this timeline event to 60 | int paramChannel, // param indx to assign to 61 | float start, // start time (seconds) 62 | float end, // end time (seconds) 63 | boolean contValue 64 | ) 65 | { 66 | setup( parentFixture, param, paramChannel, start, end, contValue ); 67 | } 68 | 69 | /** 70 | * Setup this Timeline event 71 | * 72 | * @param parentFixture fixture that this event applies on 73 | * @param param param that is used 74 | * @param paramChannel channel of param that is affected 75 | * @param start start time in seconds 76 | * @param end end time in seconds 77 | * 78 | * @return nothing 79 | */ 80 | public void setup( DMXFixture parentFixture, // fixture to assign this timeline event to 81 | DMXParam param, // dmx param to assign this timeline event to 82 | int paramChannel, // param indx to assign to 83 | float start, // start time (seconds) 84 | float end, // end time (seconds) 85 | boolean contValue // continue value 86 | ) 87 | { 88 | this.start = start; 89 | this.end = end; 90 | this.paramChannel = paramChannel; 91 | this.param = param.getCopy(); 92 | this.fixture = parentFixture; 93 | this.contValue = contValue; 94 | } 95 | 96 | /** 97 | * Reset the param of the timeline 98 | * 99 | * @return nothing 100 | */ 101 | public void reset() 102 | { 103 | param.reset(); 104 | } 105 | 106 | /** 107 | * Update the timeline event 108 | * 109 | * @param timer the current time of the parent timeline 110 | * @return nothing 111 | */ 112 | public void update( float parentTime ) 113 | { 114 | // start the param if it hasn't been started and after start time 115 | if( parentTime >= start && parentTime < end && !param.getStarted() ) 116 | { 117 | // This is for the next version 118 | /*if( contValue ) 119 | { 120 | 121 | int lastVal = ( int )fixture.getParam( paramChannel ).getValue(); 122 | 123 | param.setStartVal( lastVal ); 124 | }*/ 125 | 126 | fixture.setParam( paramChannel, param ); 127 | 128 | 129 | param.start(); 130 | } 131 | 132 | if( parentTime > end ) 133 | { 134 | param.stop(); 135 | } 136 | 137 | /*if( parentTime >= start && parentTime < end && !param.getStarted() && !param.hasFinished() ) 138 | { 139 | // assign param to fixture 140 | fixture.setParam( paramChannel, param ); 141 | param.start(); 142 | } 143 | 144 | // Need to end the param here 145 | if( parentTime >= end ) 146 | { 147 | System.out.println("Ending param"); 148 | param.setFinished( true ); 149 | } */ 150 | } 151 | 152 | /** 153 | * get the start time of this event 154 | * 155 | * @return The start time of this event as seconds as a float 156 | */ 157 | public float getStart() { return start; } 158 | 159 | /** 160 | * get the end time of this event 161 | * 162 | * @return The end time of this event as seconds as a float 163 | */ 164 | public float getEnd() { return end; } 165 | 166 | /** 167 | * get the fixture 168 | * 169 | * @return The fixture of this timeline event 170 | */ 171 | public DMXFixture getFixture() { return fixture; } 172 | 173 | /** 174 | * get the param 175 | * 176 | * @return The param of this timeline event 177 | */ 178 | public DMXParam getParam() { return param; } 179 | 180 | /** 181 | * get the param channel 182 | * 183 | * @return The param channel of this timeline event 184 | */ 185 | public int getParamChannel() { return paramChannel; } 186 | 187 | /** 188 | * Set status to continue from previous value 189 | * if true then the timeline event will continue, 190 | * if false it will restart from 0 191 | * 192 | * @param status 193 | */ 194 | public void setContinueValue( boolean status ) 195 | { 196 | this.contValue = status; 197 | } 198 | 199 | /************************************************************************************ 200 | * Private Variables 201 | ************************************************************************************/ 202 | 203 | private float start; // start time of this timeline event 204 | private float end; // end time of this timleine event 205 | private DMXParam param; // param that is affected 206 | private DMXFixture fixture; // fixture that is controlled 207 | private int paramChannel; // param channel that is affected 208 | private boolean contValue; // continue from the previous value, if false it 209 | // will restart from 0 210 | } 211 | -------------------------------------------------------------------------------- /src/com/jaysonh/dmx4artists/WINValidator.java: -------------------------------------------------------------------------------- 1 | package com.jaysonh.dmx4artists; 2 | 3 | import java.io.File; 4 | import java.util.StringTokenizer; 5 | 6 | /** 7 | * Checks a Windows system to see if it has the correct settings to run the library 8 | * 9 | * @author Jayson Haebich 10 | * @author www.jaysonh.com 11 | * @version 0.1 12 | * @since 1.1 13 | */ 14 | 15 | public class WINValidator 16 | { 17 | /** 18 | * Check if windows can find the ftd2xx.dll file 19 | * 20 | * @return boolean if the function can find the ftd2x.dll file 21 | */ 22 | public boolean isValid() 23 | { 24 | boolean exists = true; 25 | String foundPath = ""; 26 | 27 | /* 28 | // Get the system paths for DLL files 29 | String property = System.getProperty("java.library.path"); 30 | StringTokenizer parser = new StringTokenizer(property, ";"); 31 | 32 | // Loop through all the folders that the system searches for dll files in 33 | while (parser.hasMoreTokens()) 34 | { 35 | // Check if ftd2xx.dll is in this folder 36 | String searchPath = parser.nextToken() + "\\ftd2xx.dll"; 37 | 38 | if( new File( searchPath ).exists() ) 39 | { 40 | exists = true; 41 | foundPath = searchPath; 42 | } 43 | } 44 | 45 | if(exists) 46 | { 47 | System.out.println("found in: " + foundPath); 48 | 49 | return true; 50 | } else 51 | { 52 | System.err.println("Cannot find ftd2xx.dll, please copy from winDependencies to one of these folders:"); 53 | 54 | StringTokenizer dllFolders = new StringTokenizer( property, ";" ); 55 | 56 | // If there are no folders in the System path 57 | if( dllFolders.countTokens() <= 0 ) 58 | { 59 | System.err.println( "Error! No search paths for DLL files?" ); 60 | } 61 | 62 | // Print each folder to the console 63 | while ( dllFolders.hasMoreTokens()) 64 | { 65 | System.err.println( dllFolders.nextToken() ); 66 | } 67 | 68 | return false; 69 | }*/ 70 | return true; 71 | } 72 | } -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | ##library.name## 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 25 | 26 | 38 | 39 |
40 | 41 |
42 |

##library.name##

43 |

44 | A Library by ##author.name## for the Processing programming environment.
45 | Last update, ##date##. 46 |

47 |

48 | ##library.sentence##
49 | ##library.paragraph##
50 | Feel free to replace this paragraph with a description of the Library.
51 | Contributed Libraries are developed, documented, and maintained by members of the Processing community. Further directions are included with each Library. For feedback and support, please post to the Discourse. We strongly encourage all Libraries to be open source, but not all of them are. 52 |

53 |
54 | 55 | 56 | 57 |
58 |

Download

59 |

60 | Download ##library.name## version ##library.prettyVersion## (##library.version##) in 61 | .zip format. 62 |

63 |

Installation

64 |

65 | Unzip and put the extracted ##project.name## folder into the libraries folder of your Processing sketches. Reference and examples are included in the ##project.name## folder. 66 |

67 |
68 | 69 | 70 |
71 |

Keywords. ##library.keywords##

72 |

Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.

73 |

Source. The source code of ##library.name## is available at ##source.host##, and its repository can be browsed here.

74 |
75 | 76 | 77 |
78 |

Examples

79 |

Find a list of examples in the current distribution of ##library.name##, or have a look at them by following the links below.

80 |
    81 | ##examples## 82 |
83 |
84 | 85 | 86 |
87 |

Tested

88 |

89 | 90 | Platform ##tested.platform## 91 | 92 | 93 |
Processing ##tested.processingVersion## 94 | 95 | 96 |
Dependencies ##library.dependencies## 97 |

98 |
99 | 100 | 101 | 102 | 114 | 115 | 116 | 121 | 122 | 123 | 127 | 128 | 129 |
130 |
131 | 132 | 135 |
136 | 137 | -------------------------------------------------------------------------------- /web/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* processingLibs style by andreas schlegel, sojamo. */ 2 | 3 | 4 | * { 5 | margin:0; 6 | padding:0; 7 | border:0; 8 | } 9 | 10 | 11 | body { 12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; 13 | font-size : 100%; 14 | font-size : 0.70em; 15 | font-weight : normal; 16 | line-height : normal; 17 | } 18 | 19 | 20 | 21 | #container { 22 | margin-left:64px; 23 | background-color:#fff; 24 | } 25 | 26 | #header { 27 | float:left; 28 | padding-top:24px; 29 | padding-bottom:48px; 30 | } 31 | 32 | #menu { 33 | margin-top:16px; 34 | float:left; 35 | margin-bottom:64px; 36 | } 37 | 38 | 39 | #about, 40 | #download, 41 | #examples, 42 | #demos, 43 | #misc { 44 | width:480px; 45 | float:left; 46 | margin-right:24px; 47 | } 48 | 49 | 50 | #resources, #info { 51 | width:320px; 52 | float:left; 53 | } 54 | 55 | 56 | .clear { 57 | clear:both; 58 | } 59 | 60 | #footer { 61 | margin-top:300px; 62 | height:20px; 63 | margin-bottom:32px; 64 | } 65 | 66 | 67 | ul { 68 | list-style:none; 69 | padding:0; 70 | margin:0; 71 | } 72 | 73 | 74 | #menu ul li, #subMenu ul li { 75 | float:left; 76 | padding-right:6px; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | /* Headings */ 85 | 86 | h1 { 87 | font-size:2em; 88 | font-weight:normal; 89 | } 90 | 91 | 92 | h2, h3, h4, h5, th { 93 | font-size:1.3em; 94 | font-weight:normal; 95 | margin-bottom:4px; 96 | } 97 | 98 | 99 | 100 | p { 101 | font-size:1em; 102 | width:90%; 103 | margin-bottom:32px; 104 | } 105 | 106 | 107 | pre, code { 108 | font-family:"Courier New", Courier, monospace; 109 | font-size:1em; 110 | line-height:normal; 111 | } 112 | 113 | 114 | 115 | 116 | hr { 117 | border:0; 118 | height:1px; 119 | margin-bottom:24px; 120 | } 121 | 122 | 123 | a { 124 | text-decoration: underline; 125 | font-weight: normal; 126 | } 127 | 128 | 129 | a:hover, 130 | a:active { 131 | text-decoration: underline; 132 | font-weight: normal; 133 | } 134 | 135 | 136 | a:visited, 137 | a:link:visited { 138 | text-decoration: underline; 139 | font-weight: normal; 140 | } 141 | 142 | 143 | 144 | img { 145 | border: 0px solid #000000; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | /* COLORS */ 153 | 154 | 155 | body { 156 | color : #333; 157 | background-color :#fff; 158 | } 159 | 160 | 161 | #header { 162 | background-color:#fff; 163 | color:#333; 164 | } 165 | 166 | 167 | 168 | h1, h2, h3, h4, h5, h6 { 169 | color:#666; 170 | } 171 | 172 | 173 | pre, code { 174 | color: #000000; 175 | } 176 | 177 | 178 | a,strong { 179 | color: #333; 180 | } 181 | 182 | 183 | a:hover, 184 | a:active { 185 | color: #333; 186 | } 187 | 188 | 189 | a:visited, 190 | a:link:visited { 191 | color: #333; 192 | } 193 | 194 | 195 | #footer, #menu { 196 | background-color:#fff; 197 | color:#333; 198 | } 199 | 200 | 201 | #footer a, #menu a { 202 | color:#333; 203 | } 204 | --------------------------------------------------------------------------------