TarsosDSP
TarsosDSP copied to clipboard
AudioDispatcher stop variable volatile
What is the correct way to stop the dispatcher? I run it in a separate thread and call stop(), but the stop variable is not volatile.
https://github.com/JorenSix/TarsosDSP/blob/master/src/core/be/tarsos/dsp/AudioDispatcher.java#L120 Is it possible to add the volatile modifier? Or is there another way to do it?
The same question. When I called stop() method the program got crash. How can I fix it?
Hello, I had the same challenge. But i resolved it through using the try catch: try { if (!dispatcher.isStopped()) { dispatcher.stop(); } } catch (Exception ex) { Toast.makeText(Scanning_Page.this, "Error: " + ex, Toast.LENGTH_LONG).show(); }
Instead of: // new Thread(dispatcher, "Audio Dispatcher").stop();
And it works well for me