diff --git a/README.md b/README.md index 0bf445c..35aa656 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ JSON Parser +Add the libraries to your build path. +Add all the folders EXCEPT the 'songs' folder to your source. +The 'songs' folder should be in your project root. \ No newline at end of file diff --git a/audio/Song.java b/audio/Song.java index 7dc5924..7503818 100644 --- a/audio/Song.java +++ b/audio/Song.java @@ -4,39 +4,39 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import javafx.scene.media.Media; + public class Song { - + private String title; private String subtitle; private String author; private double sample_start; private double BPM; - + private File audio; private File background; private File banner; private File file; - + private List songs; - - public Song() - { + + public Song() { title = ""; subtitle = ""; author = ""; sample_start = 0; BPM = 0.0; - + audio = null; background = null; banner = null; file = null; - + songs = new ArrayList(); } - - public void addSongInstance(SongInstance s) - { + + public void addSongInstance(SongInstance s) { songs.add(s); } diff --git a/audio/io/JSONReader.java b/audio/io/JSONReader.java index b9b946e..31c9390 100644 --- a/audio/io/JSONReader.java +++ b/audio/io/JSONReader.java @@ -10,6 +10,7 @@ import java.io.InputStream; import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; import javax.json.JsonReader; import model.GameModel; diff --git a/jl1.0.1.jar b/jl1.0.1.jar new file mode 100644 index 0000000..bd5fb8b Binary files /dev/null and b/jl1.0.1.jar differ diff --git a/main/Main.java b/main/Main.java index 55f57d6..b9b4a56 100644 --- a/main/Main.java +++ b/main/Main.java @@ -1,11 +1,5 @@ package main; -import java.io.File; -import java.io.IOException; - -import audio.Song; -import audio.io.JSONReader; - public class Main { public static void main(String[] args) { diff --git a/model/SongHandler.java b/model/SongHandler.java index fa1c051..d88d6dd 100644 --- a/model/SongHandler.java +++ b/model/SongHandler.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import javazoom.jl.player.Player; import main.Window; import audio.Song; import audio.io.DirScanner; @@ -16,7 +17,7 @@ public class SongHandler { private int currentIndex; private File dir; - + public SongHandler() { songs = new ArrayList(); @@ -32,11 +33,6 @@ public class SongHandler { songs = DirScanner.scanDirectories(dir); currentSong = songs.get(currentIndex); - - for(Song s : songs) - { - System.out.println(s.getTitle()); - } } public void next() @@ -44,11 +40,18 @@ public class SongHandler { currentIndex++; currentIndex%=songs.size(); currentSong = songs.get(currentIndex); + updatePlayer(); } public void previous() { currentIndex--; currentIndex%=songs.size(); currentSong = songs.get(currentIndex); + updatePlayer(); + } + + private void updatePlayer() + { + } } diff --git a/songs/NAME_OF_SONG/NAME_OF_SONG.csf b/songs/NAME_OF_SONG/NAME_OF_SONG.csf new file mode 100644 index 0000000..2945f7e --- /dev/null +++ b/songs/NAME_OF_SONG/NAME_OF_SONG.csf @@ -0,0 +1,72 @@ +{ + "meta": { + "title": "title of song", + "subtitle": "subtitle of song", + "author": "author of song", + "sample_start": 12.00, + "BPM": 0 + }, + "file": { + "audio": "NAME_OF_SONG.mp3", + "background": "background.png", + "banner": "banner.png" + }, + "data": [ + { + "difficulty": "easy", + "objects": [ + { + "time": 1, + "direction": 1, + "button": 0, + "hold": true, + "length": 1000 + }, + { + "time": 16, + "direction": 6, + "button": 1 + } + ], + "button": [ + { + "time": 0, + "button": 0, + "color": 0 + }, + { + "time": 20, + "button": 6, + "color": 1 + } + ] + }, + { + "difficulty": "medium", + "objects": [ + { + "time": 4, + "direction": 3, + "button": 3 + }, + { + "time": 12, + "direction": 5, + "button": 2 + } + ], + "button": [ + { + "time": 0, + "button": 0, + "color": 0 + }, + { + "time": 20, + "button": 6, + "color": 1 + } + ] + } + ] +} \ No newline at end of file diff --git a/songs/NAME_OF_SONG/NAME_OF_SONG.mp3 b/songs/NAME_OF_SONG/NAME_OF_SONG.mp3 new file mode 100644 index 0000000..5f336f7 Binary files /dev/null and b/songs/NAME_OF_SONG/NAME_OF_SONG.mp3 differ diff --git a/songs/NAME_OF_SONG/background.png b/songs/NAME_OF_SONG/background.png new file mode 100644 index 0000000..6c2bc18 Binary files /dev/null and b/songs/NAME_OF_SONG/background.png differ diff --git a/songs/NAME_OF_SONG/banner.png b/songs/NAME_OF_SONG/banner.png new file mode 100644 index 0000000..7975009 Binary files /dev/null and b/songs/NAME_OF_SONG/banner.png differ diff --git a/songs/SECOND_SONG/NAME_OF_SONG.csf b/songs/SECOND_SONG/NAME_OF_SONG.csf new file mode 100644 index 0000000..60dcf2c --- /dev/null +++ b/songs/SECOND_SONG/NAME_OF_SONG.csf @@ -0,0 +1,72 @@ +{ + "meta": { + "title": "Song #2", + "subtitle": "Some song", + "author": "Kenneth", + "sample_start": 136.000, + "BPM": 44.260 + }, + "file": { + "audio": "NAME_OF_SONG.mp3", + "background": "background.png", + "banner": "banner.png" + }, + "data": [ + { + "difficulty": "easy", + "objects": [ + { + "time": 1, + "direction": 1, + "button": 0, + "hold": true, + "length": 1000 + }, + { + "time": 16, + "direction": 6, + "button": 1 + } + ], + "button": [ + { + "time": 0, + "button": 0, + "color": 0 + }, + { + "time": 20, + "button": 6, + "color": 1 + } + ] + }, + { + "difficulty": "medium", + "objects": [ + { + "time": 4, + "direction": 3, + "button": 3 + }, + { + "time": 12, + "direction": 5, + "button": 2 + } + ], + "button": [ + { + "time": 0, + "button": 0, + "color": 0 + }, + { + "time": 20, + "button": 6, + "color": 1 + } + ] + } + ] +} \ No newline at end of file diff --git a/songs/SECOND_SONG/NAME_OF_SONG.mp3 b/songs/SECOND_SONG/NAME_OF_SONG.mp3 new file mode 100644 index 0000000..5f336f7 Binary files /dev/null and b/songs/SECOND_SONG/NAME_OF_SONG.mp3 differ diff --git a/songs/SECOND_SONG/background.png b/songs/SECOND_SONG/background.png new file mode 100644 index 0000000..6c2bc18 Binary files /dev/null and b/songs/SECOND_SONG/background.png differ diff --git a/songs/SECOND_SONG/banner.png b/songs/SECOND_SONG/banner.png new file mode 100644 index 0000000..7975009 Binary files /dev/null and b/songs/SECOND_SONG/banner.png differ