Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dynamic generation of neuron buttons, added neuron preview
- Loading branch information
Zachary Kim
committed
May 7, 2009
1 parent
79fa223
commit c7dd80c
Showing
7 changed files
with
217 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,83 +1,70 @@ | |||
package napplelabs.dbssim; | package napplelabs.dbssim; | ||
|
|
||
/* | /* | ||
MockDBS: Deep Brain Stimulation Simulator | MockDBS: Deep Brain Stimulation Simulator | ||
Copyright (C) 2009 Zachary Kim | Copyright (C) 2009 Zachary Kim | ||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | 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; | |||
import javax.sound.sampled.AudioFormat; | You should have received a copy of the GNU General Public License along | ||
import javax.sound.sampled.AudioSystem; | 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.LineUnavailableException; | ||
import javax.sound.sampled.SourceDataLine; | |||
import javax.sound.sampled.TargetDataLine; | |||
import javax.sound.sampled.DataLine.Info; | |||
import javax.swing.JFrame; | import javax.swing.JFrame; | ||
import javax.swing.JPanel; | |||
import javax.swing.SwingUtilities; | |||
|
|
||
import processing.core.PApplet; | import processing.core.PApplet; | ||
|
|||
import ddf.minim.AudioOutput; | import ddf.minim.AudioOutput; | ||
import ddf.minim.AudioPlayer; | |||
import ddf.minim.Minim; | import ddf.minim.Minim; | ||
import ddf.minim.signals.PinkNoise; | import ddf.minim.signals.PinkNoise; | ||
import ddf.minim.signals.SineWave; | import ddf.minim.signals.SineWave; | ||
|
|
||
public class NeuronPlayer { | public class NeuronPlayer { | ||
|
|||
private PinkNoise pink; | private PinkNoise pink; | ||
private SineWave sin; | private SineWave sin; | ||
private AudioOutput out; | private AudioOutput out; | ||
|
|
||
public NeuronPlayer() throws LineUnavailableException, InterruptedException { | public NeuronPlayer() throws LineUnavailableException, InterruptedException { | ||
|
|||
JFrame frame = new JFrame(""); | JFrame frame = new JFrame(""); | ||
frame.setSize(500, 300); | frame.setSize(500, 300); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
|
|||
Minim minim = new Minim(new PApplet()); | Minim minim = new Minim(new PApplet()); | ||
out = minim.getLineOut(Minim.MONO); | // out = minim.getLineOut(Minim.MONO); | ||
pink = new PinkNoise(0.2f); | // pink = new PinkNoise(0.2f); | ||
|
|
||
//out.addSignal(pink); | // 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()); | ||
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(); | ||
|
|
||
player.play(); | // TracePanel panel = new TracePanel(out); | ||
|
// frame.setContentPane(panel); | ||
|
|
||
|
|||
//TracePanel panel = new TracePanel(out); | |||
//frame.setContentPane(panel); | |||
|
|||
frame.setVisible(true); | 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(); | new NeuronPlayer(); | ||
} | } | ||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.