|
|
@ -157,22 +157,22 @@ public class MusicHandler implements AudioSendHandler, Closeable |
|
|
|
// System.out.println("SAMPLES from player: " + Util.printSamples(read));
|
|
|
|
// System.out.println("SAMPLES from player: " + Util.printSamples(read));
|
|
|
|
// System.out.println("Wanted: " + byteCount + " Space:" + space + " Available: " + din.available() + " To read: " + bytesToRead + " Read: " + read);
|
|
|
|
// System.out.println("Wanted: " + byteCount + " Space:" + space + " Available: " + din.available() + " To read: " + bytesToRead + " Read: " + read);
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("Read: " + read.remaining()); |
|
|
|
// System.out.println("Read: " + read.remaining());
|
|
|
|
ret.put(read); |
|
|
|
ret.put(read); |
|
|
|
} catch (TrackPlayer.OutOfInputException | IOException ex) |
|
|
|
} catch (TrackPlayer.OutOfInputException | IOException ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
System.out.println("Track ended, starting next."); |
|
|
|
// System.out.println("Track ended, starting next.");
|
|
|
|
boolean foundNext = nextSong(); |
|
|
|
boolean foundNext = nextSong(); |
|
|
|
|
|
|
|
|
|
|
|
if (!foundNext) |
|
|
|
if (!foundNext) |
|
|
|
{ |
|
|
|
{ |
|
|
|
System.out.println("Out of tracks!"); |
|
|
|
// System.out.println("Out of tracks!");
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println("Buffer filled, submitting."); |
|
|
|
// System.out.println("Buffer filled, submitting.");
|
|
|
|
ret.rewind(); // required apparently, if returned buf has pos > 0 you get silence
|
|
|
|
ret.rewind(); // required apparently, if returned buf has pos > 0 you get silence
|
|
|
|
assert ret.hasArray(); // output MUST be array backed
|
|
|
|
assert ret.hasArray(); // output MUST be array backed
|
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|