public void playLoop() { if (sequence != null) { double playStartTime = (player.getSeekTime() / 100) * (playGetLength()); sequencer.setMicrosecondPosition((long) playStartTime); if (playState != PLAYING) { sequencer.start(); playState = PLAYING; } } }
public boolean play() { try { if (playState != STOPPED) playStop(); if (sequence == null) return false; if (sequencer == null) return false; sequencer.open(); sequencer.setSequence(sequence); double playStartTime = (player.getSeekTime() / 100) * (playGetLength()); sequencer.setMicrosecondPosition((long) playStartTime); sequencer.start(); playState = PLAYING; return true; } catch (Exception ex) { ex.printStackTrace(); playState = STOPPED; return false; } }
/** Para o seqüenciador e reinicia sua posição para 0. */ public void stop() { if (sequencer != null && sequencer.isOpen()) { sequencer.stop(); sequencer.setMicrosecondPosition(0); } }
public void playSetSeek(double seekTime) { if (sequence != null) { sequencer.setMicrosecondPosition((long) (seekTime * 1000.0)); } }