Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused code #2

Open
IARI opened this issue Mar 10, 2019 · 4 comments
Open

Unused code #2

IARI opened this issue Mar 10, 2019 · 4 comments

Comments

@IARI
Copy link

IARI commented Mar 10, 2019

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.

final Mixer mixer = getMixer(mixerName);
if (mixer == null) {
sourceDataLine = (SourceDataLine) AudioSystem.getLine(lineInfo);
mixerName = null;
} else {
logger.info("Mixer: " + mixer.getMixerInfo());
sourceDataLine = (SourceDataLine) mixer.getLine(lineInfo);
}
sourceDataLine = (SourceDataLine) AudioSystem.getLine(lineInfo);

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
Copy link
Owner

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

@goxr3plus
Copy link
Owner

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
Copy link
Author

IARI commented Mar 10, 2019

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants