import ddf.minim.*; Minim minim; AudioPlayer song; boolean playing; void setup() { size(500, 500); playing = false; minim = new Minim(this); song = minim.loadFile("song1.mp3"); } void draw() { // draw background. drawSongList(); drawSongSlider(); if (playing) { drawPause(); } else { drawPlay(); } } // Draw the list of available songs. // Indicate the playing song. void drawSongList() { } // Draw a progress slider visually indicating our position in the playing song. void drawSongSlider() { int currentSongPos = song.position(); } // draw a play button at the centre of the screen. void drawPlay() { } // draw a pause button at the centre of the screen. void drawPause() { } // songNum is a value between 0 and 2 (inclusive). // load song songNum + 1 from disk and start playing it from the beginning. void loadAndPlaySong(int songNum) { } // complete this function to obtain the music player functionality as described // on the assignment website void keyPressed() { if (key != CODED) { // deal with spacebar, 'r', 'n'. dealWithNonCodedKeys(); } else { // key == CODED means it's one of the special keyboard keys // we must use the keyCode variable instead of key. dealWithCodedKeys(); } } // Deal with the user pressing the spacebar, 'r', or 'n' void dealWithNonCodedKeys() { } // Deal with the user pressing left arrow or right arrow. // In Processing, left arrow has code 37, and right arrow has code 39 // Further note that the global variable keyCode is used here instead of key. void dealWithCodedKeys() { if (keyCode == 37) { // Left arrow pressed } else if (keyCode == 39) { // Right arrow pressed } } void exit() { song.close(); minim.stop(); super.exit(); }