goxr3plus / java-stream-player

🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
GNU General Public License v3.0
145 stars 33 forks source link

Unused code #2

Open IARI opened 5 years ago

IARI commented 5 years ago

I am currently trying to re-implement a player based on Javax.soundand thus trying to understand the implementation here, In the course of that process, I stumbled upon a piece of code that seems like it isn't used:

In the method createLine() The Assignment In StreamPlayer.java Line 481 makes the two assignments to sourceDataLine in L474 and L478 superfluos.

https://github.com/goxr3plus/java-stream-player/blob/2f7d16dcf689a5335e91fe91bd6bfbdfe173cd6e/src/main/java/goxr3plus/javastreamplayer/stream/StreamPlayer.java#L472-L481

If this kind of comment isn't helpful, or the code here isn't maintained anymore, please let me know - I might just stumble upon something else.

goxr3plus commented 5 years ago

This library is maintained by me and your issues are so so useful.

goxr3plus commented 5 years ago

What this code does is actually trying to get the specific Mixer, if we haven't gave one... i think we never give it has two different approaches of getting the SourceDataLine.... in the first one it gets it from the specific mixer where in the second it gets it directly from the AudioSystem.

I got this library which was in Java4 and passed it to Java8.

I understand it's hard understanding some parts of it so you can ask everything or even improve it, i can make you a collaborator :)

IARI commented 5 years ago

Thank you for the offer of becoming a collaborator - I can however not guarantee that I can do any useful continued work on the repository. I am kind of trying to rewrite the player class in Kotlin currently - at least the parts that I need für my little project.

Another thing I noticed: The field private Future<Void> future; is never assigned a non-null value throughout the class - so that seems unused too. in the awaitTermination(); method it is used, but only if it is not null, which cannot be the case the way I understand it.

goxr3plus commented 5 years ago

Let me have a look at the code it's been time since i wrote it.