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

AudioDispatcher thread hangs on close() #36

Closed
kizinfo opened this issue Mar 11, 2015 · 2 comments
Closed

AudioDispatcher thread hangs on close() #36

kizinfo opened this issue Mar 11, 2015 · 2 comments

Comments

@kizinfo
Copy link

kizinfo commented Mar 11, 2015

Calling AudioDispatcher.stop() from another thread causes the dispatch audioLoop to hang instead of exit. There is some concurrency issue in there. waiting for the audioLoop to finish before calling AudioDispatcher.stop() seems to be a hack that works but you may need to solve the root cause. (also variables such as 'stopped' that are used as access control between threads should be declared volatile).

Also, just doing a local 'break' instead of 'break audioLoop' in the AudioDispatcher allows you prevent the processor chain from continuing to run without actually stopping the whole process - which you should use stop() for. I found this useful for creating control gates (which return false) that prevent further processing until some threshold etc. has been achieved.

@JorenSix
Copy link
Owner

Hi,

I am working on a better implementation of the AudioDispatcher. It is indeed a bit hacky right now. It contains bugs for the first and last audio buffer, these are very apparent when large buffers are used. There are fixes in the experimental package:

https://github.com/JorenSix/TarsosDSP/blob/master/src/experimental/be/tarsos/dsp/experimental/AudioDispatcher.java

While ironing out the bugs I'm also rethinking the pipeline. Now it has problems when audio buffers change size while processing (e.g. resampling or time stretching).

@JorenSix
Copy link
Owner

JorenSix commented Apr 7, 2015

Hi, with the latest version things got cleaned up quite a lot. There are also some unit tests that check for some marginal conditions. Check it out!

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