Can't stop Ess's AudioChannel
in
Contributed Library Questions
•
1 year ago
I can't stop a AudioChannel
filled up with a SineWave
.
When I use AudioChannel.stop
method, the program freezes ("loop" stops being printed).
- import processing.core.PApplet;
- import krister.Ess.AudioChannel;
- import krister.Ess.Ess;
- import krister.Ess.SineWave;
- public class TestApplet extends PApplet {
- AudioChannel myChannel;
- SineWave wave;
- public void setup() {
- size(256,200);
- Ess.start(this);
- myChannel = new AudioChannel();
- myChannel.initChannel(myChannel.frames(100));
- wave = new SineWave(400, 1f);
- wave.generate(myChannel);
- myChannel.play(Ess.FOREVER);
- }
- public void draw() {
- println("loop");
- }
- public void keyPressed() {
- if (myChannel.state == Ess.STOPPED)
- myChannel.play();
- else
- myChannel.stop();
- }
- public void stop() {
- Ess.stop();
- super.stop();
- }
- }
1