private void DisposeWave()
{
lock (mutex)
{
if (dataStream != null)
{
dataStream.Dispose();
dataStream = null;
}
if (audioBuffer != null)
{
audioBuffer.Dispose();
audioBuffer = null;
}
if (sourceVoice != null)
{
if (currentStream != null)
{
sourceVoice.BufferEnd -= bufferEndCallback;
}
sourceVoice.Stop();
sourceVoice.FlushSourceBuffers();
sourceVoice.Dispose();
sourceVoice = null;
}
current = null;
currentStream = null;
}
}