forwards InterruptException to waiters instead of killing audio task
This commit is contained in:
parent
5854270183
commit
333bbbf8d8
1 changed files with 13 additions and 3 deletions
|
@ -215,7 +215,7 @@ function SampleTypes.unsafe_write(sink::PortAudioSink, buf::SampleBuf)
|
||||||
try
|
try
|
||||||
while written < total
|
while written < total
|
||||||
donecond = wait(c)
|
donecond = wait(c)
|
||||||
n = min(size(sink.pabuf, 2), total-written)
|
n = min(size(sink.jlbuf, 1), total-written)
|
||||||
bufstart = 1+written
|
bufstart = 1+written
|
||||||
bufend = n+written
|
bufend = n+written
|
||||||
@devec sink.jlbuf[1:n, :] = buf[bufstart:bufend, :]
|
@devec sink.jlbuf[1:n, :] = buf[bufstart:bufend, :]
|
||||||
|
@ -308,8 +308,18 @@ function audiotask{T, U}(stream::PortAudioStream{T, U})
|
||||||
|
|
||||||
stream.bufstate = PortAudioPending
|
stream.bufstate = PortAudioPending
|
||||||
catch ex
|
catch ex
|
||||||
|
if isa(ex, InterruptException)
|
||||||
|
for w in stream.source.waiters
|
||||||
|
notify(w, ex; error=true)
|
||||||
|
end
|
||||||
|
for w in stream.sink.waiters
|
||||||
|
notify(w, ex; error=true)
|
||||||
|
end
|
||||||
|
else
|
||||||
warn("Audio Task died with exception: $ex")
|
warn("Audio Task died with exception: $ex")
|
||||||
Base.show_backtrace(STDOUT, catch_backtrace())
|
Base.show_backtrace(STDOUT, catch_backtrace())
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue