Пример #1
0
        public WpfAudioService(Machine machine, UserControl page) :
            base(machine)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            _directSound = new DirectSound(SampleRate, SampleChannels, SampleBits, SampleSize, OnDirectSoundUpdate);

            page.Loaded += (sender, e) =>
            {
                var window = Window.GetWindow(page);
                _directSound.Start(window.GetHandle());
                window.Closed += (_sender, _e) => _directSound.Stop();
            };
        }