added airflow/breath
This commit is contained in:
parent
7e0bc24273
commit
f396266715
|
@ -6,6 +6,8 @@
|
||||||
<artifactId>psychose</artifactId>
|
<artifactId>psychose</artifactId>
|
||||||
<groupId>psy</groupId>
|
<groupId>psy</groupId>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.illposed.osc</groupId>
|
<groupId>com.illposed.osc</groupId>
|
||||||
|
@ -33,4 +35,23 @@
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>MainForm</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ActorDisplay">
|
<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">
|
<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"/>
|
<margin top="4" left="6" bottom="4" right="6"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="20" y="20" width="220" height="220"/>
|
<xy x="20" y="20" width="220" height="250"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<background color="-16777216"/>
|
<background color="-16777216"/>
|
||||||
<foreground color="-1"/>
|
<foreground color="-1"/>
|
||||||
<minimumSize width="220" height="220"/>
|
<minimumSize width="220" height="250"/>
|
||||||
<preferredSize width="0" height="0"/>
|
<preferredSize width="0" height="0"/>
|
||||||
</properties>
|
</properties>
|
||||||
<border type="line">
|
<border type="line">
|
||||||
|
@ -22,12 +22,12 @@
|
||||||
<properties>
|
<properties>
|
||||||
<font name="Droid Sans Mono" size="20"/>
|
<font name="Droid Sans Mono" size="20"/>
|
||||||
<foreground color="-1"/>
|
<foreground color="-1"/>
|
||||||
<text value="Pulse"/>
|
<text value="Puls"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<vspacer id="1290">
|
<vspacer id="1290">
|
||||||
<constraints>
|
<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>
|
</constraints>
|
||||||
</vspacer>
|
</vspacer>
|
||||||
<component id="d0a2" class="javax.swing.JLabel" binding="lblPulse">
|
<component id="d0a2" class="javax.swing.JLabel" binding="lblPulse">
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<font name="Droid Sans Mono" size="20"/>
|
<font name="Droid Sans Mono" size="20"/>
|
||||||
<foreground color="-1"/>
|
<foreground color="-1"/>
|
||||||
<text value="Heart"/>
|
<text value="Herz"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="e1c6d" class="javax.swing.JLabel" binding="lblOxy">
|
<component id="e1c6d" class="javax.swing.JLabel" binding="lblOxy">
|
||||||
|
@ -120,16 +120,6 @@
|
||||||
<text value="-"/>
|
<text value="-"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</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">
|
<component id="4d72a" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<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"/>
|
<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="-"/>
|
<text value="-"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</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>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class ActorDisplay {
|
||||||
private JLabel lblEkg;
|
private JLabel lblEkg;
|
||||||
private JLabel lblEmg;
|
private JLabel lblEmg;
|
||||||
private JLabel lblTemperature;
|
private JLabel lblTemperature;
|
||||||
|
private JLabel lblBreath;
|
||||||
|
|
||||||
private int counterHeartbeat = 0;
|
private int counterHeartbeat = 0;
|
||||||
private int counterPulse = 0;
|
private int counterPulse = 0;
|
||||||
|
@ -26,6 +27,7 @@ public class ActorDisplay {
|
||||||
private int counterEkg = 0;
|
private int counterEkg = 0;
|
||||||
private int counterEmg = 0;
|
private int counterEmg = 0;
|
||||||
private int counterTemperature = 0;
|
private int counterTemperature = 0;
|
||||||
|
private int counterBreath = 0;
|
||||||
|
|
||||||
private int timeout = 20; // 20 * 100ms
|
private int timeout = 20; // 20 * 100ms
|
||||||
|
|
||||||
|
@ -33,6 +35,11 @@ public class ActorDisplay {
|
||||||
lblCaption.setText(caption);
|
lblCaption.setText(caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBreath(String breath) {
|
||||||
|
lblBreath.setText(breath);
|
||||||
|
counterBreath = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTemperature(String temperature) {
|
public void setTemperature(String temperature) {
|
||||||
lblTemperature.setText(temperature);
|
lblTemperature.setText(temperature);
|
||||||
counterTemperature = 0;
|
counterTemperature = 0;
|
||||||
|
@ -108,6 +115,12 @@ public class ActorDisplay {
|
||||||
lblHeartbeat.setForeground(onColor);
|
lblHeartbeat.setForeground(onColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(++counterBreath > timeout) {
|
||||||
|
lblBreath.setForeground(offColor);
|
||||||
|
} else {
|
||||||
|
lblBreath.setForeground(onColor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
timer.setRepeats(true);
|
timer.setRepeats(true);
|
||||||
|
|
|
@ -24,9 +24,9 @@ public class MainForm {
|
||||||
osCclient = client;
|
osCclient = client;
|
||||||
osCclient.startReceiver();
|
osCclient.startReceiver();
|
||||||
|
|
||||||
addActor("merle", "Merle", actor1);
|
addActor("merle", "Proband 1", actor1);
|
||||||
addActor("uwe", "Uwe", actor2);
|
addActor("uwe", "Proband 2", actor2);
|
||||||
addActor("bjoern", "Björn", actor3);
|
addActor("bjoern", "Proband 3", actor3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,12 +69,21 @@ public class MainForm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
osCclient.addListener("/" + actor.toLowerCase() + "/airFlow", new OSCListener() {
|
||||||
|
@Override
|
||||||
|
public void acceptMessage(Date time, OSCMessage message) {
|
||||||
|
if (message.getArguments().length == 1) {
|
||||||
|
actorDisplay.setBreath(message.getArguments()[0].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final ChaOSCclient chaOSCclient = new ChaOSCclient("localhost", 7110);
|
final ChaOSCclient chaOSCclient = new ChaOSCclient("chaosc", 7110);
|
||||||
|
|
||||||
final MainForm mainForm = new MainForm(chaOSCclient);
|
final MainForm mainForm = new MainForm(chaOSCclient);
|
||||||
final JFrame frame = new JFrame("MainForm");
|
final JFrame frame = new JFrame("MainForm");
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import javax.sound.midi.*;
|
import javax.sound.midi.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class Test {
|
public class Test {
|
||||||
public static final int NOTE_ON = 0x90;
|
public static final int NOTE_ON = 0x90;
|
||||||
public static final int NOTE_OFF = 0x80;
|
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"};
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Sequence sequence = MidiSystem.getSequence(new File("/home/lucas/jake-avril_14th.mid"));
|
Sequence sequence = MidiSystem.getSequence(new File("/home/lucas/jake-avril_14th.mid"));
|
||||||
|
|
||||||
|
HashSet<String> notes = new HashSet<String>();
|
||||||
|
|
||||||
int trackNumber = 0;
|
int trackNumber = 0;
|
||||||
for (Track track : sequence.getTracks()) {
|
for (Track track : sequence.getTracks()) {
|
||||||
trackNumber++;
|
trackNumber++;
|
||||||
|
@ -28,6 +31,9 @@ public class Test {
|
||||||
String noteName = NOTE_NAMES[note];
|
String noteName = NOTE_NAMES[note];
|
||||||
int velocity = sm.getData2();
|
int velocity = sm.getData2();
|
||||||
System.out.println("Note on, " + noteName + octave + " key=" + key + " velocity: " + velocity);
|
System.out.println("Note on, " + noteName + octave + " key=" + key + " velocity: " + velocity);
|
||||||
|
|
||||||
|
notes.add(noteName+octave);
|
||||||
|
|
||||||
} else if (sm.getCommand() == NOTE_OFF) {
|
} else if (sm.getCommand() == NOTE_OFF) {
|
||||||
int key = sm.getData1();
|
int key = sm.getData1();
|
||||||
int octave = (key / 12)-1;
|
int octave = (key / 12)-1;
|
||||||
|
@ -44,6 +50,12 @@ public class Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(notes);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue