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
147 stars 33 forks source link

Question about Status enum and play() #71

Open HelgeStenstrom opened 2 years ago

HelgeStenstrom commented 2 years ago

What is the purpose of Status.OPENING? It seems to be written to status, but never read.

https://github.com/goxr3plus/java-stream-player/blob/7caf2f34fafd1504f25c9910750e841469f66a07/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L333-L335

There seem to be three values in Status that are never used; neither for write nor for read: INIT, BUFFERING and GAIN. I think they can be removed.

In the play() method, the status is tested. It returns silently if status != Status.OPENED. Is that a desirable feature?

https://github.com/goxr3plus/java-stream-player/blob/7caf2f34fafd1504f25c9910750e841469f66a07/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L554-L572

That is why https://github.com/goxr3plus/java-stream-player/blob/7caf2f34fafd1504f25c9910750e841469f66a07/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerFutureImprovementTest.java#L49-L54 fails. What is the best alternative: Changing the behaviour to make the test pass, or remove the test?

OK, there is a third alternative: to change the behaviour such that the error situation is indicated by some other means, and change the test correspondingly.