xxxxxxxxxx
29
/*
Must upload doorbell.mp3
Must include sound library in index.html
*/
function preload() {
song = loadSound('sound/media_doorbell.mp3');
}
function setup() {
background(234);
song.play();
}
function draw() {
if (song.isPlaying()) {
print("song is playing")
} else {
print("song is not playing")
noLoop
}
}
function mouseClicked() {
if (song.isPlaying()) {
song.stop();
} else {
song.play();
}
}