Skip to content

Commit

Permalink
0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpiz097 committed May 13, 2018
1 parent 45d43df commit cff9b5f
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 103 deletions.
173 changes: 81 additions & 92 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file modified bin/OrangePlayer.jar
Binary file not shown.
Binary file modified out/production/OrangePlayer/org/orangeplayer/audio/Player.class
Binary file not shown.
Binary file not shown.
19 changes: 14 additions & 5 deletions src/org/orangeplayer/audio/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -51,6 +52,7 @@ public Player() {
trackIndex = 0;
currentVolume = DEFAULT_VOLUME;
on = false;
hasSounds = false;
setName("ThreadPlayer "+getId());
}
public Player(File rootFolder) throws FileNotFoundException {
Expand All @@ -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());
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions src/org/orangeplayer/ontesting/TestPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit cff9b5f

Please sign in to comment.