Implemented all csf handling

This commit is contained in:
2015-05-28 23:11:35 +02:00
parent 9ba62993e8
commit c2674ae382
11 changed files with 258 additions and 44 deletions
+54
View File
@@ -0,0 +1,54 @@
package model;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import main.Window;
import audio.Song;
import audio.io.DirScanner;
public class SongHandler {
private List<Song> songs;
private Song currentSong;
private int currentIndex;
private File dir;
public SongHandler()
{
songs = new ArrayList<Song>();
currentSong = null;
currentIndex = 0;
if(Window.ON_RASP)
dir = new File(System.getProperty( "user.home" ) + "/ColorStrike/Songs");
else
dir = new File("Songs");
songs = DirScanner.scanDirectories(dir);
currentSong = songs.get(currentIndex);
for(Song s : songs)
{
System.out.println(s.getTitle());
}
}
public void next()
{
currentIndex++;
currentIndex%=songs.size();
currentSong = songs.get(currentIndex);
}
public void previous()
{
currentIndex--;
currentIndex%=songs.size();
currentSong = songs.get(currentIndex);
}
}