Merge branch 'master' of repos.ctdo.de:psychose
This commit is contained in:
commit
0086d0fd8f
|
@ -25,6 +25,9 @@
|
|||
<module name="healthdisplay" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="healthdisplay" target="1.7" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: asm:asm:3.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm/3.0/asm-3.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: asm:asm-commons:3.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-commons/3.0/asm-commons-3.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: asm:asm-tree:3.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/asm/asm-tree/3.0/asm-tree-3.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: com.intellij:forms_rt:7.0.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/forms_rt/7.0.3/forms_rt-7.0.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: com.jgoodies:forms:1.1-preview">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/jgoodies/forms/1.1-preview/forms-1.1-preview-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: jdom:jdom:1.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/jdom/jdom/1.0/jdom-1.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -119,7 +119,10 @@
|
|||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="ActorDisplay" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="main.java.de.psychose.ActorDisplay" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
|
||||
</item>
|
||||
<item class="de.psychose.StatsDisplay" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
|
||||
</item>
|
||||
</group>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
compile with
|
||||
|
||||
mvn clean compile ideauidesigner:javac2 assembly:single
|
|
@ -1,16 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: com.illposed.osc:javaosc-core:0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.netty:netty:3.2.7.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.intellij:forms_rt:7.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-commons:3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-tree:3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm:3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.jgoodies:forms:1.1-preview" level="project" />
|
||||
<orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<artifactId>psychose</artifactId>
|
||||
<groupId>psy</groupId>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.illposed.osc</groupId>
|
||||
|
@ -18,6 +20,12 @@
|
|||
<artifactId>netty</artifactId>
|
||||
<version>3.2.7.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.intellij</groupId>
|
||||
<artifactId>forms_rt</artifactId>
|
||||
<version>7.0.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -33,4 +41,50 @@
|
|||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>de.psychose.MainForm</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>ideauidesigner-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>javac2</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<debug>true</debug>
|
||||
<failOnError>true</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
</project>
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ActorDisplay">
|
||||
<grid id="27dc6" binding="actorPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.ActorDisplay">
|
||||
<grid id="27dc6" binding="actorPanel" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="4" left="6" bottom="4" right="6"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="220" height="220"/>
|
||||
<xy x="20" y="20" width="316" height="302"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16777216"/>
|
||||
<foreground color="-1"/>
|
||||
<minimumSize width="220" height="220"/>
|
||||
<minimumSize width="220" height="250"/>
|
||||
<preferredSize width="0" height="0"/>
|
||||
</properties>
|
||||
<border type="line">
|
||||
<border type="none">
|
||||
<color color="-11447983"/>
|
||||
</border>
|
||||
<children>
|
||||
|
@ -22,12 +22,12 @@
|
|||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Pulse"/>
|
||||
<text value="Puls"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="1290">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="d0a2" class="javax.swing.JLabel" binding="lblPulse">
|
||||
|
@ -77,7 +77,7 @@
|
|||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Heart"/>
|
||||
<text value="Herz"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e1c6d" class="javax.swing.JLabel" binding="lblOxy">
|
||||
|
@ -120,16 +120,6 @@
|
|||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9b787" class="javax.swing.JLabel" binding="lblCaption">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="28" style="1"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="4d72a" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
|
@ -150,6 +140,36 @@
|
|||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9b787" class="javax.swing.JLabel" binding="lblCaption">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="28" style="1"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="29a78" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Atem"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="bb84f" class="javax.swing.JLabel" binding="lblBreath">
|
||||
<constraints>
|
||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
|
@ -1,3 +1,5 @@
|
|||
package de.psychose;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -19,6 +21,7 @@ public class ActorDisplay {
|
|||
private JLabel lblEkg;
|
||||
private JLabel lblEmg;
|
||||
private JLabel lblTemperature;
|
||||
private JLabel lblBreath;
|
||||
|
||||
private int counterHeartbeat = 0;
|
||||
private int counterPulse = 0;
|
||||
|
@ -26,6 +29,7 @@ public class ActorDisplay {
|
|||
private int counterEkg = 0;
|
||||
private int counterEmg = 0;
|
||||
private int counterTemperature = 0;
|
||||
private int counterBreath = 0;
|
||||
|
||||
private int timeout = 20; // 20 * 100ms
|
||||
|
||||
|
@ -33,6 +37,11 @@ public class ActorDisplay {
|
|||
lblCaption.setText(caption);
|
||||
}
|
||||
|
||||
public void setBreath(String breath) {
|
||||
lblBreath.setText(breath);
|
||||
counterBreath = 0;
|
||||
}
|
||||
|
||||
public void setTemperature(String temperature) {
|
||||
lblTemperature.setText(temperature);
|
||||
counterTemperature = 0;
|
||||
|
@ -72,46 +81,53 @@ public class ActorDisplay {
|
|||
|
||||
// actorPanel.setBackground(new Color(r.nextInt(), false));
|
||||
|
||||
if(++counterTemperature > timeout) {
|
||||
if (++counterTemperature > timeout) {
|
||||
lblTemperature.setForeground(offColor);
|
||||
} else {
|
||||
lblTemperature.setForeground(onColor);
|
||||
}
|
||||
|
||||
if(++counterPulse > timeout) {
|
||||
if (++counterPulse > timeout) {
|
||||
lblPulse.setForeground(offColor);
|
||||
} else {
|
||||
lblPulse.setForeground(onColor);
|
||||
}
|
||||
|
||||
if(++counterOxy > timeout) {
|
||||
if (++counterOxy > timeout) {
|
||||
lblOxy.setForeground(offColor);
|
||||
} else {
|
||||
lblOxy.setForeground(onColor);
|
||||
}
|
||||
|
||||
if(++counterEkg > timeout) {
|
||||
if (++counterEkg > timeout) {
|
||||
lblEkg.setForeground(offColor);
|
||||
} else {
|
||||
lblEkg.setForeground(onColor);
|
||||
}
|
||||
|
||||
if(++counterEmg > timeout) {
|
||||
if (++counterEmg > timeout) {
|
||||
lblEmg.setForeground(offColor);
|
||||
} else {
|
||||
lblEmg.setForeground(onColor);
|
||||
}
|
||||
|
||||
if(++counterHeartbeat > timeout) {
|
||||
if (++counterHeartbeat > timeout) {
|
||||
lblHeartbeat.setForeground(offColor);
|
||||
} else {
|
||||
lblHeartbeat.setForeground(onColor);
|
||||
}
|
||||
|
||||
if (++counterBreath > timeout) {
|
||||
lblBreath.setForeground(offColor);
|
||||
} else {
|
||||
lblBreath.setForeground(onColor);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
timer.setRepeats(true);
|
||||
timer.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
package de.psychose;
|
||||
|
||||
import com.illposed.osc.OSCListener;
|
||||
import com.illposed.osc.OSCMessage;
|
||||
import com.illposed.osc.OSCPortIn;
|
||||
|
@ -21,6 +23,7 @@ public class ChaOSCclient {
|
|||
|
||||
public ChaOSCclient(String host, int port) throws UnknownHostException, SocketException {
|
||||
portOut = new OSCPortOut(InetAddress.getByName(host), port);
|
||||
portIn = new OSCPortIn(OSC_CLIENT_PORT);
|
||||
}
|
||||
|
||||
public void addListener(String address, OSCListener listener) {
|
||||
|
@ -33,17 +36,8 @@ public class ChaOSCclient {
|
|||
}
|
||||
|
||||
public boolean startReceiver() {
|
||||
try {
|
||||
portIn = new OSCPortIn(OSC_CLIENT_PORT);
|
||||
portIn.startListening();
|
||||
|
||||
return changeChaoscSubscription(true);
|
||||
} catch (SocketException e) {
|
||||
System.out.println("could not create listening socket");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
portIn.startListening();
|
||||
return changeChaoscSubscription(true);
|
||||
}
|
||||
|
||||
private boolean changeChaoscSubscription(boolean subscribe) {
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MainForm">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.MainForm">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="5" left="5" bottom="5" right="5"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="720" height="576"/>
|
||||
|
@ -14,36 +14,46 @@
|
|||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="b61d">
|
||||
<hspacer id="f912c">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="5" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<nested-form id="71726" form-file="/ActorDisplay.form" binding="actor1">
|
||||
</hspacer>
|
||||
<hspacer id="6a2b8">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<hspacer id="67192">
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<nested-form id="5519b" form-file="de/psychose/StatsDisplay.form" binding="statDisplay">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
<nested-form id="a01e1" form-file="/ActorDisplay.form" binding="actor2">
|
||||
<vspacer id="ad2ab">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<nested-form id="736bf" form-file="de/psychose/ActorDisplay.form" binding="actor2">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
<nested-form id="914d6" form-file="/ActorDisplay.form" binding="actor3">
|
||||
<nested-form id="7fe82" form-file="de/psychose/ActorDisplay.form" binding="actor3">
|
||||
<constraints>
|
||||
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
<hspacer id="8e2fe">
|
||||
<nested-form id="bd9b" form-file="de/psychose/ActorDisplay.form" binding="actor1">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<hspacer id="f912c">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</nested-form>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
|
@ -1,7 +1,10 @@
|
|||
package de.psychose;
|
||||
|
||||
import com.illposed.osc.OSCListener;
|
||||
import com.illposed.osc.OSCMessage;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.net.SocketException;
|
||||
|
@ -19,14 +22,30 @@ public class MainForm {
|
|||
private ActorDisplay actor1;
|
||||
private ActorDisplay actor2;
|
||||
private ActorDisplay actor3;
|
||||
private StatsDisplay statDisplay;
|
||||
|
||||
private int totalMessageCount = 0;
|
||||
private int messagesTempCounter = 0;
|
||||
|
||||
public MainForm(ChaOSCclient chaOSCclient) {
|
||||
osCclient = chaOSCclient;
|
||||
|
||||
addActor("merle", "Proband 1", actor1);
|
||||
addActor("uwe", "Proband 2", actor2);
|
||||
addActor("bjoern", "Proband 3", actor3);
|
||||
|
||||
public MainForm(ChaOSCclient client) {
|
||||
osCclient = client;
|
||||
osCclient.startReceiver();
|
||||
|
||||
addActor("merle", "Merle", actor1);
|
||||
addActor("uwe", "Uwe", actor2);
|
||||
addActor("bjoern", "Björn", actor3);
|
||||
final Timer timer = new Timer(1000, new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
statDisplay.setMessagesPerSec(String.valueOf(totalMessageCount - messagesTempCounter));
|
||||
statDisplay.setMessageCount(String.valueOf(totalMessageCount));
|
||||
messagesTempCounter = totalMessageCount;
|
||||
}
|
||||
});
|
||||
timer.setRepeats(true);
|
||||
timer.start();
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,6 +55,7 @@ public class MainForm {
|
|||
@Override
|
||||
public void acceptMessage(Date time, OSCMessage message) {
|
||||
if (message.getArguments().length == 3) {
|
||||
totalMessageCount++;
|
||||
actorDisplay.setHeartbeat(message.getArguments()[0].toString());
|
||||
actorDisplay.setPulse(message.getArguments()[1].toString());
|
||||
actorDisplay.setOxy(message.getArguments()[2].toString());
|
||||
|
@ -47,6 +67,7 @@ public class MainForm {
|
|||
@Override
|
||||
public void acceptMessage(Date time, OSCMessage message) {
|
||||
if (message.getArguments().length == 1) {
|
||||
totalMessageCount++;
|
||||
actorDisplay.setEkg(message.getArguments()[0].toString());
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +77,7 @@ public class MainForm {
|
|||
@Override
|
||||
public void acceptMessage(Date time, OSCMessage message) {
|
||||
if (message.getArguments().length == 1) {
|
||||
totalMessageCount++;
|
||||
actorDisplay.setEmg(message.getArguments()[0].toString());
|
||||
}
|
||||
}
|
||||
|
@ -65,22 +87,35 @@ public class MainForm {
|
|||
@Override
|
||||
public void acceptMessage(Date time, OSCMessage message) {
|
||||
if (message.getArguments().length == 1) {
|
||||
totalMessageCount++;
|
||||
actorDisplay.setTemperature(message.getArguments()[0].toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
osCclient.addListener("/" + actor.toLowerCase() + "/airFlow", new OSCListener() {
|
||||
@Override
|
||||
public void acceptMessage(Date time, OSCMessage message) {
|
||||
if (message.getArguments().length == 1) {
|
||||
totalMessageCount++;
|
||||
actorDisplay.setBreath(message.getArguments()[0].toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
final ChaOSCclient chaOSCclient = new ChaOSCclient("localhost", 7110);
|
||||
final String host = args.length > 0 ? args[0] : "chaosc";
|
||||
final int port = args.length > 1 ? Integer.parseInt(args[1]) : 7110;
|
||||
|
||||
try {
|
||||
final ChaOSCclient chaOSCclient = new ChaOSCclient(host, port);
|
||||
final MainForm mainForm = new MainForm(chaOSCclient);
|
||||
final JFrame frame = new JFrame("MainForm");
|
||||
frame.setContentPane(mainForm.mainPanel);
|
||||
frame.setResizable(false);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
|
@ -95,9 +130,7 @@ public class MainForm {
|
|||
|
||||
new Streamer(8888, mainForm.mainPanel).run();
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SocketException e) {
|
||||
} catch (UnknownHostException | SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.psychose.StatsDisplay">
|
||||
<grid id="27dc6" binding="statPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="248" height="180"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16777216"/>
|
||||
<foreground color="-1"/>
|
||||
<minimumSize width="220" height="180"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="69530" class="javax.swing.JLabel" binding="lblCaption">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="28" style="1"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Statistik"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="9a59f">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="1d950" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Events"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="442f5" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Ev/Sek"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="4b993" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="Herz"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="54c59" class="javax.swing.JLabel" binding="lblMessageCount">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="eaaf9" class="javax.swing.JLabel" binding="lblMessagesPerSec">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a2840" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Droid Sans Mono" size="20"/>
|
||||
<foreground color="-1"/>
|
||||
<text value="-"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
|
@ -0,0 +1,23 @@
|
|||
package de.psychose;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author: lucas
|
||||
* @date: 18.04.14 02:19
|
||||
*/
|
||||
public class StatsDisplay {
|
||||
private JLabel lblCaption;
|
||||
private JLabel lblMessageCount;
|
||||
private JLabel lblMessagesPerSec;
|
||||
private JPanel statPanel;
|
||||
|
||||
public void setMessageCount(String count) {
|
||||
lblMessageCount.setText(count);
|
||||
}
|
||||
|
||||
public void setMessagesPerSec(String messagesPerSec) {
|
||||
lblMessagesPerSec.setText(messagesPerSec);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
package de.psychose;
|
||||
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.*;
|
|
@ -1,20 +1,50 @@
|
|||
package de.psychose;
|
||||
|
||||
import javax.sound.midi.*;
|
||||
import java.io.File;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Test {
|
||||
public static final int NOTE_ON = 0x90;
|
||||
public static final int NOTE_OFF = 0x80;
|
||||
public static final String[] NOTE_NAMES = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
|
||||
public static final String[] NOTE_NAMES = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "H"};
|
||||
|
||||
private static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
|
||||
System.out.printf("Display name: %s%n", netint.getDisplayName());
|
||||
System.out.printf("Name: %s%n", netint.getName());
|
||||
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
|
||||
|
||||
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
|
||||
System.out.printf("InetAddress: %s%n", inetAddress);
|
||||
}
|
||||
System.out.printf("%n");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
|
||||
for (NetworkInterface netint : Collections.list(nets)) {
|
||||
displayInterfaceInformation(netint);
|
||||
}
|
||||
|
||||
|
||||
if(true) return;
|
||||
|
||||
Sequence sequence = MidiSystem.getSequence(new File("/home/lucas/jake-avril_14th.mid"));
|
||||
|
||||
HashSet<String> notes = new HashSet<String>();
|
||||
|
||||
int trackNumber = 0;
|
||||
for (Track track : sequence.getTracks()) {
|
||||
for (Track track : sequence.getTracks()) {
|
||||
trackNumber++;
|
||||
System.out.println("Track " + trackNumber + ": size = " + track.size());
|
||||
System.out.println();
|
||||
for (int i=0; i < track.size(); i++) {
|
||||
for (int i = 0; i < track.size(); i++) {
|
||||
MidiEvent event = track.get(i);
|
||||
System.out.print("@" + event.getTick() + " ");
|
||||
MidiMessage message = event.getMessage();
|
||||
|
@ -23,14 +53,17 @@ public class Test {
|
|||
System.out.print("Channel: " + sm.getChannel() + " ");
|
||||
if (sm.getCommand() == NOTE_ON) {
|
||||
int key = sm.getData1();
|
||||
int octave = (key / 12)-1;
|
||||
int octave = (key / 12) - 1;
|
||||
int note = key % 12;
|
||||
String noteName = NOTE_NAMES[note];
|
||||
int velocity = sm.getData2();
|
||||
System.out.println("Note on, " + noteName + octave + " key=" + key + " velocity: " + velocity);
|
||||
|
||||
notes.add(noteName + octave);
|
||||
|
||||
} else if (sm.getCommand() == NOTE_OFF) {
|
||||
int key = sm.getData1();
|
||||
int octave = (key / 12)-1;
|
||||
int octave = (key / 12) - 1;
|
||||
int note = key % 12;
|
||||
String noteName = NOTE_NAMES[note];
|
||||
int velocity = sm.getData2();
|
||||
|
@ -44,6 +77,11 @@ public class Test {
|
|||
}
|
||||
|
||||
System.out.println();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
System.out.println(notes);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue