Permalink
Browse files

Added dynamic generation of neuron buttons, added neuron preview

  • Loading branch information...
1 parent 79fa223 commit c7dd80c551d4911500fead11f914ddcb98d3fe69 Zachary Kim committed May 7, 2009
View
@@ -9,8 +9,8 @@
</color>
<mediaFile>./neuron_media_files/thalamus.wav</mediaFile>
<location class="java.awt.geom.Point2D$Double">
- <x>46.468766858290735</x>
- <y>-187.97748109104162</y>
+ <x>-5.531233141709265</x>
+ <y>8.022518908958375</y>
</location>
</napplelabs.dbssim.neuron.NeuronPathRep>
<napplelabs.dbssim.neuron.NeuronPathRep>
@@ -22,8 +22,21 @@
</color>
<mediaFile>./neuron_media_files/stn.wav</mediaFile>
<location class="java.awt.geom.Point2D$Double">
- <x>69.30791570133613</x>
- <y>-184.2738353327099</y>
+ <x>-31.692084298663872</x>
+ <y>104.7261646672901</y>
+ </location>
+ </napplelabs.dbssim.neuron.NeuronPathRep>
+ <napplelabs.dbssim.neuron.NeuronPathRep>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ </color>
+ <mediaFile>./neuron_media_files/thalamus.wav</mediaFile>
+ <location class="java.awt.geom.Point2D$Double">
+ <x>8.0</x>
+ <y>-15.5</y>
</location>
</napplelabs.dbssim.neuron.NeuronPathRep>
</list>
View
@@ -117,6 +117,12 @@
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
+
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc1</version>
+ </dependency>
</dependencies>
<build>
@@ -1,83 +1,70 @@
package napplelabs.dbssim;
/*
- MockDBS: Deep Brain Stimulation Simulator
- Copyright (C) 2009 Zachary Kim
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.io.File;
+ MockDBS: Deep Brain Stimulation Simulator
+ Copyright (C) 2009 Zachary Kim
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioSystem;
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.SourceDataLine;
-import javax.sound.sampled.TargetDataLine;
-import javax.sound.sampled.DataLine.Info;
import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
import processing.core.PApplet;
-
import ddf.minim.AudioOutput;
-import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
import ddf.minim.signals.PinkNoise;
import ddf.minim.signals.SineWave;
public class NeuronPlayer {
-
+
private PinkNoise pink;
private SineWave sin;
private AudioOutput out;
public NeuronPlayer() throws LineUnavailableException, InterruptedException {
-
+
JFrame frame = new JFrame("");
frame.setSize(500, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
+
Minim minim = new Minim(new PApplet());
- out = minim.getLineOut(Minim.MONO);
- pink = new PinkNoise(0.2f);
-
- //out.addSignal(pink);
-
-
-
-
- File file = new File("/Users/zkim/Desktop/Rage Against The Machine - rage against the machine - 06 - Know Your Enemy.mp3");
- AudioPlayer player = minim.loadFile(file.getAbsolutePath());
-
- player.play();
-
-
-
- //TracePanel panel = new TracePanel(out);
- //frame.setContentPane(panel);
-
+ // out = minim.getLineOut(Minim.MONO);
+ // pink = new PinkNoise(0.2f);
+
+ // out.addSignal(pink);
+
+ // File file = new
+ // File("/Users/zkim/Desktop/Rage Against The Machine - rage against the machine - 06 - Know Your Enemy.mp3");
+ // AudioPlayer player = minim.loadFile(file.getAbsolutePath());
+
+ // player.play();
+
+ // TracePanel panel = new TracePanel(out);
+ // frame.setContentPane(panel);
+
frame.setVisible(true);
-
- //new Thread(panel).start();
+
+ // new Thread(panel).start();
+ }
+
+ private void stuff(final String mine) {
+ System.out.println("asdf");
}
-
- public static void main(String[] args) throws LineUnavailableException, InterruptedException {
+
+ public static void main(final String[] args)
+ throws LineUnavailableException, InterruptedException {
new NeuronPlayer();
}
}
@@ -21,9 +21,9 @@
import java.awt.Color;
+import napplelabs.dbssim.neuron.NeuronType;
import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
-
import edu.umd.cs.piccolo.PNode;
import edu.umd.cs.piccolo.nodes.PPath;
@@ -34,13 +34,20 @@
private AudioPlayer player;
private PPath path;
- public NeuronPath(Color color, String mediaFile, Minim minim) {
+ public NeuronPath(final Color color, final String mediaFile, final Minim minim) {
this.color = color;
this.mediaFile = mediaFile;
this.minim = minim;
init();
}
+ public NeuronPath(final NeuronType nt, final Minim minim) {
+ this.mediaFile = nt.getMediaPath();
+ this.minim = minim;
+ this.color = nt.getColor();
+ init();
+ }
+
public void init() {
float d = 50f;
path = PPath.createEllipse(-d/2, -d/2, d, d);
@@ -58,11 +65,11 @@ public void init() {
//player.play();
}
- public void setLevel(float level) {
+ public void setLevel(final float level) {
float gain = (level * (80 + 14)) - 80;
player.setGain(gain);
}
- public void setPlaying(boolean playing) {
+ public void setPlaying(final boolean playing) {
if(playing)
player.play();
else
@@ -72,7 +79,7 @@ public boolean isPlaying() {
return player.isPlaying();
}
- public void setPath(PPath path) {
+ public void setPath(final PPath path) {
this.path = path;
}
Oops, something went wrong.

0 comments on commit c7dd80c

Please sign in to comment.