public void play(Sequence midi, boolean loop)
    {
        if (sequencer == null || midi == null)
            return;

        try
        {
            sequencer.setSequence(midi);
            sequencer.setMicrosecondPosition(0);
            if (loop)
                sequencer.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
            setPaused(false);
        }
        catch (InvalidMidiDataException e)
        {
            e.printStackTrace();
        }
    }