Beispiel #1
0
        public void Initialize()
        {
            var format = WaveFormatExtensible.Make(wasapi.AudioClient.MixFormat);

            wasapi.Initialize(format);

            captureClient = wasapi.AudioClient.AudioCaptureClient;
            if (wasapi.EventSync)
            {
                wasapi.AudioClient.SetEventHandle(eventObject.SafeWaitHandle.DangerousGetHandle());
            }

            recordBuffer = new byte[wasapi.AudioClient.BufferSize * wasapi.Format.BlockAlign];
        }
Beispiel #2
0
        public void Initialize(IWaveStream waveStream)
        {
            this.waveStream = waveStream;
            var format = WaveFormatExtensible.Make(waveStream.Format);

            wasapi.Initialize(waveStream.Format);
            if (!format.Equals(OutFormat))
            {
                var e = new ResampleEventArgs(waveStream, OutFormat);
                NotifyResample(e);
                this.waveStream = e.Source;
            }

            renderClient = wasapi.AudioClient.AudioRenderClient;
            if (wasapi.EventSync)
            {
                wasapi.AudioClient.SetEventHandle(eventObject.SafeWaitHandle.DangerousGetHandle());
            }
            bufferFrames = wasapi.AudioClient.BufferSize;
        }