/*
(sequens) Read to analogInput.
and Stop to reading when mousePressed.
*/
import processing.gainer.*;
import krister.Ess.*; AudioChannel snd ;
Gainer gainer;
PFont myFont;
void setup() {
size(300, 255);
myFont = loadFont("CourierNewPSMT-24.vlw");
textFont(myFont, 24);
Ess.start(this) ; snd = new AudioChannel("railr.mp3") ;
gainer = new Gainer(this,"COM4");
gainer.beginAnalogInput();
}
void draw() {
background(0);
ellipse(100,100,gainer.analogInput[0],gainer.analogInput[0]);
if(gainer.analogInput[0]>70){snd.play() ;
}
}
void mousePressed()
{
//you can't use gainer's function between beginAnalogInput() and endAnalogInput()
//gainer.onLED(); //bad
gainer.endAnalogInput();
gainer.turnOnLED();
}
void mouseReleased()
{
gainer.turnOffLED();
gainer.beginAnalogInput();
// gainer.offLED();//bad
}
目次
2007年12月6日木曜日
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿