package fr.utc.leapband.sma.sound;

import java.io.File;
import java.io.IOException;

import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;

public class MIDIMusicPlayer extends MusicPlayer {
	
	private Sequencer sequencer;
	
	public MIDIMusicPlayer(String filename) throws MidiUnavailableException, InvalidMidiDataException, IOException {
		super(filename);
		
		sequencer = MidiSystem.getSequencer();
        sequencer.open();
        
        Sequence sequence = MidiSystem.getSequence(new File(filename));
		sequencer.setSequence(sequence);
	}

	@Override
	public void Start() {
		sequencer.start();
	}

	@Override
	public void Pause() {
		sequencer.stop();
	}

	@Override
	public void Restart() {
		sequencer.stop();
		sequencer.setTickPosition(0);
		sequencer.start();	
	}
}

@@ -923,10 +923,494 @@
 ();%09%0A%09%7D%0A
+%09%0A%09@Override%0A%09public void SetVolume(int volume) %7B%0A%09%09if(volume %3C 0)%0A%09%09%09volume = 0;%0A%09%09%0A%09%09if(volume %3E 255)%0A%09%09%09volume = 255;%0A%09%09%0A%09%09try %7B%0A%09            ShortMessage volumeMessage = new ShortMessage();%0A%09            for (int i = 0; i %3C 16; i++) %7B%0A%09            %09volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 7, volume);%0A%09                MidiSystem.getReceiver().send(volumeMessage, -1);%0A%09            %7D%0A%09        %7D catch (Exception e) %7B%0A%09            e.printStackTrace();%0A%09        %7D%0A%09%7D%0A
 %7D%0A

Update MIDIMusicPlayer.java