Exemple #1
0
        public Speaker()
        {
            this.TempBuffer = new byte[0x100]; // must be multiple of 4

            this.ShutDownEvent          = new cShutDownEvent();
            this.ShutDownEvent.ShutDown = false;

            this.Playback = new Thread(() => Play(this.Buffer, this.ShutDownEvent));
        }
Exemple #2
0
        private static void Play(BufferedWaveProvider bf, cShutDownEvent sd)
        {
            WaveOut wo = new WaveOut();

            wo.DesiredLatency  = 20;
            wo.NumberOfBuffers = 25;
            wo.Init(bf);
            wo.Play();
            while (wo.PlaybackState == PlaybackState.Playing && !sd.ShutDown)
            {
                Thread.Sleep(50);
            }
            wo.Dispose();
        }