- import ddf.minim.spi.*;
- import ddf.minim.signals.*;
- import ddf.minim.*;
- import ddf.minim.analysis.*;
- import ddf.minim.ugens.*;
- import ddf.minim.effects.*;
- Minim minim;
- AudioSample alert;
- int duration;
- boolean halt, stopping;
- void setup() {
- size(310, 220);
- fill(50);
- textSize(30);
- text("PABLO", 105, 50);
- textSize(20);
- text("Press 'H' to halt Program", 25, 100);
- // Sound Output Setup
- minim = new Minim(this);
- alert = minim.loadSample("G:/Documents divers/Sounds/Huge Metal Door Slam.mp3");
- duration = alert.length();
- }
- void draw() {
- if (halt) {
- alert.trigger();
- halt = false;
- stopping = true;
- duration += millis();
- }
- if (stopping && millis() > duration) {
- exit();
- }
- }
- void keyPressed() {
- if (key == 'h') {
- halt = true;
- }
- }
↧
Re : Want to play a sound at the end of my program... Having problem...
↧