private void updateRepeatMode() { if (Main.getAudioPlayer() != null) { if (repeat) { Main.getAudioPlayer().setNumberOfLoops(-1); } else { Main.getAudioPlayer().setNumberOfLoops(0); } } }
private void stop() { if (Main.getAudioPlayer() != null) { Main.getAudioPlayer().stop(); } if (Main.library.getMusicInfos(songInfo).size() == 0) { playButton.setEnabled(false); repeatButton.setEnabled(false); } else if (Main.library.getMusicInfos(songInfo).size() > 1) { Main.setAudioPlayer(null); } else { Main.setAudioPlayer( AVAudioPlayer.audioPlayerWithContentsOfURL( NSURL.fileURLWithPath( Main.library.getMusicInfos(songInfo).get(0).getMusicPath().getPath()), null)); Main.getAudioPlayer().prepareToPlay(); Main.getAudioPlayer().setNumberOfLoops(repeat ? -1 : 0); } setToolbarItems(new ArrayList<UIBarButtonItem>(buttonsPlay)); }