So, you do not want to flush the buffers
This commit is contained in:
@@ -501,7 +501,7 @@ class NativeAudioSource {
|
||||
}
|
||||
|
||||
static function streamUpdate(_:Int) {
|
||||
final acquired = streamMutex.tryAcquire();
|
||||
if (!streamMutex.tryAcquire()) return;
|
||||
|
||||
var i = queuedStreamSources.length, source:NativeAudioSource;
|
||||
while (i-- > 0) streamSources.push(queuedStreamSources[i]);
|
||||
@@ -509,33 +509,25 @@ class NativeAudioSource {
|
||||
|
||||
i = streamSources.length;
|
||||
while (i-- > 0) {
|
||||
if ((source = streamSources[i]).streamRemove) {
|
||||
if (acquired) source.removeStream();
|
||||
else continue;
|
||||
}
|
||||
else if (source.source == null) {
|
||||
if (acquired) source.removeStream();
|
||||
else source.stopStream();
|
||||
}
|
||||
if ((source = streamSources[i]).streamRemove || source.source == null) source.removeStream();
|
||||
else {
|
||||
if (acquired) source.skipBuffers(AL.getSourcei(source.source, AL.BUFFERS_PROCESSED));
|
||||
source.skipBuffers(AL.getSourcei(source.source, AL.BUFFERS_PROCESSED));
|
||||
source.flushBuffers();
|
||||
if (AL.getSourcei(source.source, AL.SOURCE_STATE) == AL.STOPPED) {
|
||||
AL.sourcePlay(source.source);
|
||||
source.updateCompleteTimer();
|
||||
}
|
||||
if (source,streamEnded && source.requestBuffers == source.queuedBuffers) source.removeStream();
|
||||
}
|
||||
}
|
||||
|
||||
if (acquired) {
|
||||
streamMutex.release();
|
||||
if (streamSources.length == 0) {
|
||||
Application.current.onUpdate.remove(streamUpdate);
|
||||
if (threadRunning) streamThread.sendMessage(0);
|
||||
}
|
||||
else if (threadRunning || (threadRunning = (streamThread = Thread.create(streamThreadRun)) != null))
|
||||
streamThread.sendMessage(streamSources.length);
|
||||
streamMutex.release();
|
||||
if (streamSources.length == 0) {
|
||||
Application.current.onUpdate.remove(streamUpdate);
|
||||
if (threadRunning) streamThread.sendMessage(0);
|
||||
}
|
||||
else if (threadRunning || (threadRunning = (streamThread = Thread.create(streamThreadRun)) != null))
|
||||
streamThread.sendMessage(streamSources.length);
|
||||
}
|
||||
|
||||
function removeStream() {
|
||||
|
||||
Reference in New Issue
Block a user