-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
added setMixerName #65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great first PR :) 🎉🎉
I suggest also adding a test for this new feature. This will ensure the feature works correctly & won’t break with future contributions. If you need help with this just let me know :)
@@ -529,7 +529,8 @@ private void createLine() throws LineUnavailableException, StreamPlayerException | |||
outlet.setSourceDataLine((SourceDataLine) mixer.getLine(lineInfo)); | |||
} | |||
|
|||
outlet.setSourceDataLine((SourceDataLine) AudioSystem.getLine(lineInfo)); | |||
//Had to comment this because it overwrites the data line we just set, thus making code above useless (this line is already run when there is no mixer name set) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just remove the line instead of deleting it. Maybe mention this in the commit message so that this note is tracked (instead of having the message in the code)
@@ -529,7 +529,8 @@ private void createLine() throws LineUnavailableException, StreamPlayerException | |||
outlet.setSourceDataLine((SourceDataLine) mixer.getLine(lineInfo)); | |||
} | |||
|
|||
outlet.setSourceDataLine((SourceDataLine) AudioSystem.getLine(lineInfo)); | |||
//Had to comment this because it overwrites the data line we just set, thus making code above useless (this line is already run when there is no mixer name set) | |||
//outlet.setSourceDataLine((SourceDataLine) AudioSystem.getLine(lineInfo)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d Remove this line
@@ -257,6 +257,13 @@ | |||
*/ | |||
void setLineBufferSize(int size); | |||
|
|||
/** | |||
* Set the name of the mixer. This should be called before opening a Line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add this note to the java doc for the implementation function in Stream Player, as most clients calling the function will be calling it from StreamPlayer
Great job guys @AObuchow when you feel this will be ready you can merge it :). I am thinking of remaking the repository code more simple as it was before... There are too many classes now and no documentation. |
removed line 532 because it overwrites the SourceDataLine
Alright so I changed the things that @AObuchow mentioned, I'm trying to write a test (I just recently started to use tests myself so just still figuring it out). Right now (I think) there is no possibility to check the mixer that is currently being used, so also no way to check if it correspond to the set mixer. |
@JellevanAbbema Yes add that function it will be useful. |
This looks good to me but @HelgeStenstrom might want to have a look. One thing I noticed is there's no actual dedicated test for get/set mixer? It seems the implementation of the StreamPlayerTest was just modified. It might be nicer to setup a dedicated JUnit test for get/set mixer, so that if it fails we know what "feature" is broken. |
Looks good to me also. @JellevanAbbema have you tested that it works correctly, you runned some files and all good? If yes I merge. |
Yes I did do a couple of tests, played it on the speakers of my second monitor (which is not the default audio device) without a problem. |
You the best :) |
I think many improvements can be done on this library. |
I just made a new release feel free to check and use :) https://github.com/goxr3plus/java-stream-player/releases |
10.0.2 |
Thanks @goxr3plus ! :) |
Description
Alright this is my first pull request so I hope I'm doing everything right. (Any feedback is welcome!)
I came across issue #64 which is something I fixed a while back for a program I'm writing (note: I'm not a software engineer and just doing this as a hobby) at that time I didn't know GitHub that well and had no idea how to share that code the right way, but thought it would be useful to share now for @RinAndShizuka
The only changes I made was add a function to set the mixerName and remove 1 line of code that overwrites the SourceDataLine (which I believe was useless anyway). Overall quite simple since almost all the necessary code is already there.
The setMixerName function should be called BEFORE creating a line and thus before opening a file.
Fixes #64
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Has This Been Tested?
Checklist: