jaco-mp3 проблема с плейлистом
Всем привет, пишу плеер с помощью библиотеки jaco-mp3 и появилась проблема с плейлистом. При открытии нового файла в плейлист не добавляется файл а перезаписывается текущий. Как решить проблему?
Код открытия файла:
static boolean loop = false;
static JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
static MP3Player player;
static File[] files = new File[100];
static int currentsongid = 0;
@SuppressWarnings("static-access")
static void openfile() throws LineUnavailableException, IOException, UnsupportedAudioFileException {
FileNameExtensionFilter filter = new FileNameExtensionFilter("MP3 File", "mp3");
chooser.setFileFilter(filter);
chooser.setDialogTitle("Choose file to play");
chooser.setApproveButtonText("Play!");
int c = chooser.showOpenDialog(chooser);
if(c == chooser.APPROVE_OPTION) {
if(player != null && !player.isStopped()) {
player.stop();
}
files[currentsongid] = chooser.getSelectedFile();
player = new MP3Player(files[currentsongid]);
currentsongid++;
window.frmAdvancedaudioplayer.setTitle("AdvancedAudioPlayer 0.1(Alpha)");
window.slider.setValue(0);
window.slider.setEnabled(true);
player.setRepeat(false);
window.btnNewButton.setEnabled(true);
window.mntmNewMenuItem_3.setEnabled(true);
System.out.println(player.getPlayList());
System.out.println(files[0] + ", " + files[1]);
}
}
Извиняюсь если вы нашли плохой код :p