Skip to content

Commit

Permalink
Devices Ergaenzt, Touch Handling, 0-Bug fixed, refs #8, #5, #3
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowballThrower committed Feb 14, 2016
1 parent 05acfd5 commit da7563f
Show file tree
Hide file tree
Showing 11 changed files with 407 additions and 82 deletions.
150 changes: 146 additions & 4 deletions DMXSoftware/Data/DeviceTypes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@


<Device Id="2">
<Name>"Renkforce RDM Par_10"</Name>
<Name>"Renkforce RDM Par_5"</Name>
<Type>"Par"</Type>
<Power>"60"</Power>
<Symbol>"https://www.conrad.de/medias/global/ce/6000_6999/6400/6440/6448/1301624_LB_00_FB.EPS_1000.jpg"</Symbol>
<Symbol>""</Symbol>

<Channels No="10">
<Channels No="5">
<Channel Nr="1" F="Red">
<ChName>"Red"</ChName>
<Values case="0">
Expand All @@ -132,7 +132,7 @@
<Name>"Renkforce RDM Par_10"</Name>
<Type>"Par"</Type>
<Power>"60"</Power>
<Symbol>"Data/Pictures/RenkforceRDM_5.png"</Symbol>
<Symbol>"https://www.conrad.de/medias/global/ce/6000_6999/6400/6440/6448/1301624_LB_00_FB.EPS_1000.jpg"</Symbol>

<Channels No="10">

Expand Down Expand Up @@ -367,4 +367,146 @@
</Channel>
</Channels>
</Device>

<Device Id="5">
<Name>"Outdoor"</Name>
<Type>"Par"</Type>
<Power>"120"</Power>
<Symbol>"https://www.thomann.de/pics/bdb/305314/7974151_800.jpg"</Symbol>

<Channels No="7">


<Channel Nr="1" F="Dimmer">
<ChName>"Dimmer"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="2" F="Red">
<ChName>"Red"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="3" F="Green">
<ChName>"Green"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="4" F="Blue">
<ChName>"Blue"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="5" F="White">
<ChName>"White"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>
</Channels>
</Device>

<Device Id="6">
<Name>"Cameo"</Name>
<Type>"Par"</Type>
<Power>"144"</Power>
<Symbol>"http://www.cameolight.com/out/pictures/generated/product/1/1000_1000_80/CLPST64RGBWAU12W_1.jpg"</Symbol>

<Channels No="9">

<Channel Nr="1" F="Dimmer">
<ChName>"Dimmer"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="3" F="Red">
<ChName>"Red"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="4" F="Green">
<ChName>"Green"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="5" F="Blue">
<ChName>"Blue"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="6" F="White">
<ChName>"White"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="7" F="Amber">
<ChName>"Amber"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="8" F="UV">
<ChName>"UV"</ChName>
<Values case="0">
<conditions>
</conditions>
</Values>
</Channel>

<Channel Nr="9" F="Macro">
<ChName>"Macro"</ChName>
<Values case="0">
<conditions></conditions>
<Name>"Macro"</Name>
<Value low="0" high="4">"Color Mix"</Value>
<Value low="5" high="10">"Red"</Value>
<Value low="11" high="15">"Green"</Value>
<Value low="16" high="20">"Blue"</Value>
<Value low ="21" high="25">"White"</Value>
<Value low="26" high="30">"Amber"</Value>
<Value low ="31" high="35">"Violet"</Value>
<Value low="36" high="40">"Yellow"</Value>
<Value low="41" high="45">"Cyan"</Value>
<Value low="46" high="50">"Lavender"</Value>
<Value low="51" high="55">"LightGreen"</Value>
<Value low="56" high="60">"Magenta"</Value>
<Value low="61" high="65">"Turqoise"</Value>
<Value low="66" high="70">"Orange"</Value>
<Value low="71" high="75">"Cool White"</Value>
<Value low="76" high="80">"Warm White"</Value>
</Values>
</Channel>
</Channels>
</Device>

</ExampleDevices>
21 changes: 18 additions & 3 deletions DMXSoftware/Data/Devices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Additional>"Nicht auf der Deele"</Additional>
</Device>
<Device Id="2" Channel="40">
<Type Id="2"></Type>
<Type Id="3"></Type>
<Name>"Renkforce-Par 1"</Name>
<Additional>"Kuhstall Haus-Seite"</Additional>
</Device>
Expand All @@ -14,6 +14,21 @@
<Name>"Renkforce-Par 2"</Name>
<Additional>"Kuhstall Tor-Seite"</Additional>
</Device>
<Device Id="8" Channel="20">
<Type Id="5"></Type>
<Name>"Outdoor 1"</Name>
<Additional>"Deele Haus"</Additional>
</Device>
<Device Id="9" Channel="10">
<Type Id="6"></Type>
<Name>"Cameo Par"</Name>
<Additional>"Deele Mitte"</Additional>
</Device>
<Device Id="10" Channel="30">
<Type Id="5"></Type>
<Name>"Outdoor 2"</Name>
<Additional>"Deele Tor"</Additional>
</Device>
<Device Id="4" Channel="100">
<Type Id="4"></Type>
<Name>"BAR 1"</Name>
Expand All @@ -27,11 +42,11 @@
<Device Id="6" Channel="148">
<Type Id="4"></Type>
<Name>"BAR 3"</Name>
<Additional>"Kuhstall Haus-Seite Mistfall"</Additional>
<Additional>"Kuhstall Haus-Seite Deele"</Additional>
</Device>
<Device Id="7" Channel="172">
<Type Id="4"></Type>
<Name>"BAR 4"</Name>
<Additional>"Kuhstall Haus-Seite Deele"</Additional>
<Additional>"Kuhstall Haus-Seite Mistfall"</Additional>
</Device>
</Devices>
17 changes: 17 additions & 0 deletions DMXSoftware/nbactions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath SnowballThrower.dmxsoftware.HelloWorldMain</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiDevice.Info;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.ShortMessage;
Expand All @@ -27,6 +26,7 @@ public class MidiConnection extends Thread {
private int[] valOld;
int[] valNew;
boolean stop;
private long SLEEP = 2;

public MidiConnection() {
stop = false;
Expand Down Expand Up @@ -61,8 +61,8 @@ public void change(int channel, int value) {
}

private void send(int channel, int value) {
System.out.println("Midi send: " + channel + " ," + value / 2);
System.out.println("Midi send: " + (CONTROL_CHANGE + channel / 128) + " ," + channel % 128 + " ," + value / 2);
//System.out.println("Midi send: " + channel + " ," + value / 2);
//System.out.println("Midi send: " + (CONTROL_CHANGE + channel / 128) + " ," + channel % 128 + " ," + value / 2);
try {
ShortMessage message = new ShortMessage(CONTROL_CHANGE, channel / 128, channel % 128, value / 2);
try {
Expand All @@ -82,11 +82,17 @@ private void send(int channel, int value) {
private void loop() {
int i;
for (i = 0; i < MAX_CH; i++) {
if (valOld[i] != valNew[i]) {
send(i, valNew[i]);
valOld[i] = valNew[i];
int valBuff = valNew[i];
if (valOld[i] != valBuff) {
valOld[i] = valBuff;
send(i, valOld[i]);
}
}
try {
Thread.sleep(SLEEP);
} catch (InterruptedException ex) {
Logger.getLogger(MidiConnection.class.getName()).log(Level.SEVERE, null, ex);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package SnowballThrower.dmxsoftware.Database;

import java.util.List;
import javafx.scene.text.Text;

/**
*
Expand All @@ -28,6 +29,15 @@ String getMeaning(int value, int[] values) {
return value + "";
}

public String getStandardMeaning(int value) {
if (meanings != null) {
if (meanings.get(0) != null) {
return meanings.get(0).getMeaning(value);
}
}
return null;
}

public Function getFunction() {
return function;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ int getValue(int channel) {
return values[channel];
}

String getMeaning(int channel) {
public String getMeaning(int channel) {
return type.getMeaning(channel, values);
}

String getChannelName(int channel) {
public String getChannelName(int channel) {
return type.channels[channel].name;
}

Expand All @@ -54,4 +54,8 @@ public String getImagePath() {
public int getStartCh() {
return this.startChannel;
}

public String getAdditon() {
return this.addition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Manage() {
}

public void send(int channel, int value) {
if (channel < 16 * 12 && channel > 0 && value > 0 && value < 256) {
if (channel < 16 * 12 && channel >= 0 && value >= 0 && value < 256) {
mc.change(channel, value);
}
}
Expand All @@ -33,12 +33,11 @@ public void handle(String id, int value) {
try {
int ch = Integer.parseInt(id);
if (ch < 1000) {
System.out.println("Change: " + id + " ," + value);
//System.out.println("Change: " + id + " ," + value);
send(ch - 1, value);
return;
}
} catch (Exception ex) {

System.out.println("no id: " + id);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SnowballThrower.dmxsoftware.Database.Function;
import java.awt.Color;
import javafx.scene.paint.Paint;

/**
*
Expand Down Expand Up @@ -35,4 +36,10 @@ int getColorFor(int hue, int sat, int vol, Function func) {
return -1;
}
}

public Color stringToColor(String string){
string = string.toUpperCase();
Color color = Color.getColor(string, Color.LIGHT_GRAY);
return color;
}
}
Loading

0 comments on commit da7563f

Please sign in to comment.