Ejemplo n.º 1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     // 窓を閉じる準備。止めて、閉じて、解放する。
     Stop();
     waveOut.Close();
     waveStream.Close();
 }
    protected virtual void Dispose(bool disposing)
    {
        if (_disposed)
        {
            return;
        }

        if (disposing)
        {
        }

        if (_handle != null)
        {
            if (
                !_handle.IsInvalid &&
                !_handle.IsClosed
                )
            {
                _logger.LogInformation("[wave] stop");
                Reset();

                //バッファの開放待ち
                _logger.LogInformation($"[wave] wait busy buffers :{_headerBusyPool.Count}");
                while (_headerBusyPool.Count > 0)
                {
                    Thread.Sleep(1000);
                    _logger.LogInformation($"[wave] wait busy buffers :{_headerBusyPool.Count}");
                }
                _logger.LogInformation($"[wave] wait end :{_headerBusyPool.Count}");

                _releaseAction.Complete();
                _releaseAction.Completion.Wait();

                _handle.Close();
            }
        }

        _headerPool?.Dispose();
        _driverCallBack?.Dispose();

        _disposed = true;
    }
Ejemplo n.º 3
0
 public void Close()
 {
     _waveOut.Close();
 }