private void __INTERNAL_ChangeRate() { _WaveOut.Stop(); _WaveOut.Dispose(); _WaveOut = null; _BPCMWaveProvider = null; GC.Collect(); __INTERNAL_WaveOutInit(); }
private void __INTERNAL_WaveOutInit() { _BPCMWaveProvider = new BPCMWaveProvider(_BPCMStream, _config.PlaybackRate); _BPCMWaveProvider.volume = 1; _BPCMWaveProvider.readDone = __INTERNAL_UpdatePosition; _WaveOut = new WaveOutEvent(); _WaveOut.DeviceNumber = _config.WaveOutDevice; _WaveOut.DesiredLatency = _config.WaveOutBufferSize * _config.WaveOutBufferCount; _WaveOut.NumberOfBuffers = _config.WaveOutBufferCount; _WaveOut.Volume = _config.Volume; _WaveOut.PlaybackStopped += __INTERNAL_PlaybackStopped; _WaveOut.Init(_BPCMWaveProvider); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _WaveOut.Stop(); _WaveOut.Dispose(); _WaveOut = null; _BPCMFile.Dispose(); _BPCMFile = null; } _BPCMStream = null; _BPCMWaveProvider = null; disposedValue = true; } }