Our dictation software hangs on NAudio call as described below. This has been tried to get fixed for ages but no luck. Hope you can help!
Hang happens in WaveIn.cs in CloseWaveInDevice() function, line 336 WaveInterop.waveInClose(waveInHandle), that row is in bold below.
private void CloseWaveInDevice()
{
if (waveInHandle == IntPtr.Zero) return;
_logger.Log(LogLevel.Debug, () => "close wavein");
MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop");
MmException.Try(WaveInterop.waveInReset(waveInHandle), "waveInReset");
if (buffers != null)
{
_logger.Log(LogLevel.Debug, () => "close wavein, buffers=" + buffers.Length.ToString());
for (int n = 0; n < buffers.Length; n++)
{
_logger.Log(LogLevel.Debug, () => "buffers[" + n + "] dispose call");
buffers[n].Dispose();
_logger.Log(LogLevel.Debug, () => "buffers[" + n + "] disposed");
}
buffers = null;
}
_logger.Log(LogLevel.Debug, () => "buffers disposed, try to close waveIn");
var result = WaveInterop.waveInClose(waveInHandle);
_logger.Log(LogLevel.Debug, () => "waveInClose result: " + result.ToString());
waveInHandle = IntPtr.Zero;
// _logger.Log(LogLevel.Debug, () => "close wavein method end");
}
WaveInClose is called every time recording is paused to control recording led on Olympus DR-2X00 mic.
waveInClose is from winmm library ->
[DllImport("winmm.dll")]
public static extern MmResult waveInClose(IntPtr hWaveIn);
msdn -> https://msdn.microsoft.com/en-us/library/dd743840(v=vs.85).aspx
Problem is that it doesn't return error code -> it just never returns from this function in this case.
attached is a debug log from the software. It hangs on the last row.
-Juha
Comments: attachement
Hang happens in WaveIn.cs in CloseWaveInDevice() function, line 336 WaveInterop.waveInClose(waveInHandle), that row is in bold below.
private void CloseWaveInDevice()
{
if (waveInHandle == IntPtr.Zero) return;
_logger.Log(LogLevel.Debug, () => "close wavein");
MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop");
MmException.Try(WaveInterop.waveInReset(waveInHandle), "waveInReset");
if (buffers != null)
{
_logger.Log(LogLevel.Debug, () => "close wavein, buffers=" + buffers.Length.ToString());
for (int n = 0; n < buffers.Length; n++)
{
_logger.Log(LogLevel.Debug, () => "buffers[" + n + "] dispose call");
buffers[n].Dispose();
_logger.Log(LogLevel.Debug, () => "buffers[" + n + "] disposed");
}
buffers = null;
}
_logger.Log(LogLevel.Debug, () => "buffers disposed, try to close waveIn");
var result = WaveInterop.waveInClose(waveInHandle);
_logger.Log(LogLevel.Debug, () => "waveInClose result: " + result.ToString());
waveInHandle = IntPtr.Zero;
// _logger.Log(LogLevel.Debug, () => "close wavein method end");
}
WaveInClose is called every time recording is paused to control recording led on Olympus DR-2X00 mic.
waveInClose is from winmm library ->
[DllImport("winmm.dll")]
public static extern MmResult waveInClose(IntPtr hWaveIn);
msdn -> https://msdn.microsoft.com/en-us/library/dd743840(v=vs.85).aspx
Problem is that it doesn't return error code -> it just never returns from this function in this case.
attached is a debug log from the software. It hangs on the last row.
-Juha
Comments: attachement