Catch potential errors from PortAudio Close() and Dispose()
This commit is contained in:
1 parent
4784e57370
commit
ad5ffd7578
1 file changed
+18
-2
@@ -79,7 +79,16 @@ namespace Vocaluxe.Lib.Sound
|
|||||||
Debug.Assert(_RefCount > 0);
|
Debug.Assert(_RefCount > 0);
|
||||||
_RefCount--;
|
_RefCount--;
|
||||||
if (_RefCount == 0)
|
if (_RefCount == 0)
|
||||||
PortAudio.Pa_Terminate();
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PortAudio.Pa_Terminate();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
CLog.LogError(errorText: $"Error disposing PortAudio: {ex.Message}", e: ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +173,14 @@ namespace Vocaluxe.Lib.Sound
|
|||||||
if (_Disposed)
|
if (_Disposed)
|
||||||
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
||||||
|
|
||||||
PortAudio.Pa_CloseStream(stream);
|
try
|
||||||
|
{
|
||||||
|
PortAudio.Pa_CloseStream(stream);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
CLog.LogError(errorText:$"Error closing stream: {ex.Message}", e:ex);
|
||||||
|
}
|
||||||
_Streams.Remove(stream);
|
_Streams.Remove(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user