import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;
import java.util.ArrayList;
import framework.Sound;

/**
 * Handles the playing of the sounds inside the list.
 */
public class Player {
    public Player() {
        final AudioFormat af = new AudioFormat(
            SAMPLE_RATE, BITS_PER_SAMPLE, 1, true, true);

        try {
            line = AudioSystem.getSourceDataLine(af);
            line.open();
        } catch(Exception e) {
            e.printStackTrace();
        }

        list = new ArrayList<Sound>();
    }

    private final SourceDataLine    line;
    private ArrayList<Sound>        list;

    // Constants
    private final int SAMPLE_RATE       = 44100;    // CD quality audio
    private final int MAX_16_BITS       = Short.MAX_VALUE;
    private final int BITS_PER_SAMPLE   = 16;
}
@@ -592,24 +592,361 @@
 %3E();%0A    %7D%0A%0A
+    /**%0A     * Add the specified Sound to the list.%0A     * @param s the sound to be added%0A     */%0A    public void addSound(Sound s) %7B%0A        list.add(s);%0A    %7D%0A%0A    /**%0A     * Remove the specified Sound from the list.%0A     * @param s the Sound to be removed%0A     */%0A    public void removeSound(Sound s) %7B%0A        list.remove(s);%0A    %7D%0A%0A
     private 

Add methods to add and remove sounds from the player.