Want to play a sound at the end of my program... Having problem...
              in 
             Core Library Questions 
              •  
              5 months ago    
            
 
           
             Hello, 
            
            
I want to play a siren sound at the end of my program. When the playback has finished I want to exit the program with the commands: noLoop(); exit();
My siren gets triggered with the letter 'h' on keyboard. If I dont have the noloop and exit commands it works fine, but sadly it does not exit...
here is my code:
            
 
            
           I want to play a siren sound at the end of my program. When the playback has finished I want to exit the program with the commands: noLoop(); exit();
My siren gets triggered with the letter 'h' on keyboard. If I dont have the noloop and exit commands it works fine, but sadly it does not exit...
here is my code:
- 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;
boolean hault;
void setup() {
size(310, 220);
fill(50);
textSize(30);
text("PABLO", 105, 50);
textSize(20);
text("Press 'H' to hault Program", 25, 100);
// Sound Output Setup
minim = new Minim(this);
alert = minim.loadSample("siren.mp3");
}
void draw() {
if (hault == true) {
alert.trigger();
hault = false;
noLoop();
exit();
}
}
void keyPressed() {
if (key == 'h') {
hault = true;
} 
             You get the idea of what I want to do... 
             
Please Help...
             
Thanks
             
            
 
           Please Help...
Thanks
 
              
              1  
            
 
            