Exemplo n.º 1
0
        private void RegisterStreamCallback()
        {
            _streamCallback = (IntPtr handle, uint bytes, IntPtr _) =>
            {
                BufferAvailable?.Invoke(this, new AudioPlaybackBufferAvailableEventArgs((int)bytes));
            };

            AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero)
            .ThrowIfFailed("Failed to set stream changed callback.");
        }
Exemplo n.º 2
0
        private void RegisterStreamCallback()
        {
            _streamCallback = (IntPtr handle, uint bytes, IntPtr _) =>
            {
                BufferAvailable?.Invoke(this, new AudioPlaybackBufferAvailableEventArgs((int)bytes));
            };

            AudioIOUtil.ThrowIfError(
                AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero),
                $"Failed to create {nameof(AudioPlayback)}");
        }