diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0091cd3..1923f86 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,35 +7,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + - + - - + + + + @@ -66,7 +54,7 @@ - + @@ -74,11 +62,11 @@ - + - - + + @@ -140,7 +128,7 @@ - + @@ -149,7 +137,7 @@ - + @@ -157,8 +145,8 @@ - - + + @@ -170,7 +158,7 @@ - + @@ -179,7 +167,7 @@ - + @@ -192,7 +180,7 @@ - + @@ -285,17 +273,17 @@ @@ -306,10 +294,10 @@ - @@ -436,18 +424,7 @@ - - - + + + @@ -534,19 +522,19 @@ - + + - @@ -564,8 +552,7 @@ - - + @@ -573,7 +560,7 @@ - + @@ -874,16 +861,6 @@ - - - - - - - - - - @@ -908,7 +885,7 @@ - + @@ -926,41 +903,31 @@ - - - - - - - - - - - + - + - + - + @@ -971,7 +938,7 @@ - + @@ -995,8 +962,8 @@ - - + + @@ -1033,6 +1000,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 3cdac0a..5d45795 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ Music player library in pure Java. # 0.6.1 Beta ## Se añade funcion para agregar más musica al reproductor -## 0.7 +## 0.7 Release ## Se logra obtener duracion de archivos de audio para todos los formatos disponibles ## Se añade opcion para obtener la caratula de un archivo de audio cualquiera +## 0.7.1 Release + ## Se corrige el error que se produce al momento de dirigirse a una carpeta sin canciones diff --git a/bin/OrangePlayer.jar b/bin/OrangePlayer.jar index 21db588..63aec69 100644 Binary files a/bin/OrangePlayer.jar and b/bin/OrangePlayer.jar differ diff --git a/out/production/OrangePlayer/org/orangeplayer/audio/Player.class b/out/production/OrangePlayer/org/orangeplayer/audio/Player.class index e71221e..fee215c 100644 Binary files a/out/production/OrangePlayer/org/orangeplayer/audio/Player.class and b/out/production/OrangePlayer/org/orangeplayer/audio/Player.class differ diff --git a/out/production/OrangePlayer/org/orangeplayer/ontesting/TestPlayer.class b/out/production/OrangePlayer/org/orangeplayer/ontesting/TestPlayer.class index d296350..fca104a 100644 Binary files a/out/production/OrangePlayer/org/orangeplayer/ontesting/TestPlayer.class and b/out/production/OrangePlayer/org/orangeplayer/ontesting/TestPlayer.class differ diff --git a/src/org/orangeplayer/audio/Player.java b/src/org/orangeplayer/audio/Player.java index d295b9b..1af4059 100644 --- a/src/org/orangeplayer/audio/Player.java +++ b/src/org/orangeplayer/audio/Player.java @@ -23,6 +23,7 @@ public class Player extends Thread implements PlayerControls { private int trackIndex; private float currentVolume; private boolean on; + private boolean hasSounds; public static float DEFAULT_VOLUME = 80.0f; @@ -51,6 +52,7 @@ public Player() { trackIndex = 0; currentVolume = DEFAULT_VOLUME; on = false; + hasSounds = false; setName("ThreadPlayer "+getId()); } public Player(File rootFolder) throws FileNotFoundException { @@ -59,13 +61,14 @@ public Player(File rootFolder) throws FileNotFoundException { listListeners = new ArrayList<>(); trackIndex = 0; currentVolume = DEFAULT_VOLUME; + on = false; + hasSounds = false; if (!rootFolder.exists()) throw new FileNotFoundException(); else { loadTracks(rootFolder); sortTracks(); } - on = false; setName("ThreadPlayer "+getId()); } @@ -227,14 +230,20 @@ private void waitForSongs() { } void loadNextTrack() { + // Se debe verificar que no es un archivo de audio porque + // cuando solo hay archivos que no son audio se lanza un + // nullpointerexception + waitForSongs(); Track cur = current; current = getNextTrack(); finishTrack(cur); - startNewTrackThread(); + if (current != null) { + startNewTrackThread(); + System.out.println("Song: "+trackIndex); + System.out.println(current.getInfoSong()); + } loadListenerMethod("onSongChange", current); - System.out.println("Song: "+trackIndex); - System.out.println(current.getInfoSong()); } // Test @@ -278,7 +287,7 @@ public Track getCurrent() { return current; } - public SourceDataLine getTrackLine() { + public synchronized SourceDataLine getTrackLine() { if (current == null) System.out.println("Current is null"); else { diff --git a/src/org/orangeplayer/ontesting/TestPlayer.java b/src/org/orangeplayer/ontesting/TestPlayer.java index 97faef2..f2899f9 100644 --- a/src/org/orangeplayer/ontesting/TestPlayer.java +++ b/src/org/orangeplayer/ontesting/TestPlayer.java @@ -13,7 +13,11 @@ public class TestPlayer { public static void main(String[] args) throws IOException { boolean hasArgs = args != null && args.length > 0; - String fPath = hasArgs ? args[0] : "/home/martin/AudioTesting/music/"; + String fPath = hasArgs ? args[0] : "/home/martin/AudioTesting/audio/nosound"; + + // Ver validacion de archivos de audio y que hacer cuando + // la carpeta esta vacia al cargar la carpeta para evitar + // un buble infinito cuando se lee una carpeta sin archivos de audio //Player.newInstance(fPath); //Player player = Player.getPlayer(); @@ -23,9 +27,6 @@ public static void main(String[] args) throws IOException { System.out.println("Sounds total: "+player.getSongsCount()); Scanner scan = new Scanner(System.in); - // /home/martin/AudioTesting/music/Alejandro Silva/1 - 1999/AlbumArtSmall.jpg - // /home/martin/AudioTesting/music/NSYNC/NSYNC - No Strings Attached (2000)/ReadMe.txt - SourceDataLine trackLine = player.getTrackLine(); char c; @@ -43,7 +44,7 @@ public static void main(String[] args) throws IOException { player.jumpTrack(Integer.parseInt(line.substring(2))); player.playNext(); System.err.println("Antes de trackLine"); - trackLine = player.getCurrent().getTrackLine().getDriver(); + trackLine = player.getTrackLine(); System.err.println("Antes de controls"); System.out.println("Controls: "+Arrays.toString(trackLine.getControls())); Control pan = trackLine.getControl(FloatControl.Type.PAN);