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

Test with reset() behaves oddly #39

Open HelgeStenstrom opened 5 years ago

HelgeStenstrom commented 5 years ago

reset() is a public method. If it's called when the player is playing, it seems to not return. I cannot really see what is executing when I run the test in the debugger.

The test print "play()", and goes on to play the song. It never prints "reset()"

Expected behavior: The player is stopped so quickly, that no music is heard. Maxium one frame of sound samples. The word "reset() should be printed after "play()".

What can be learnt from this behavior?

HelgeStenstrom commented 5 years ago

This is more of a bug report than a real pull request. The PR has one test, and the test doesn't end quickly as tests should, so it's useless as a unit test. But it might be good for illustrating a problem.

goxr3plus commented 5 years ago

Reset never returns because (audiolock) is already locked by call method when the sound is playing, so it stuck on synchronized(audiolock) until the sound stops or pauses and the lock is getting free. One thing could be that reset internally calls stop first but actually we can make reset private if it's not needed.

goxr3plus commented 5 years ago

Should i merge this :)?

HelgeStenstrom commented 5 years ago

No, that wasn't the intention. It's more of documentation for the bug report.

goxr3plus commented 5 years ago

Good

goxr3plus commented 5 years ago

I need to redesign then