コード例 #1
0
        public void Run(string[] args)
        {
            using (var window = new DisplayWindowBuilder(args)
                                .BackbufferSize(800, 600)
                                .QuitOnClose()
                                .Build())
            {
                LoopingStream sa = new LoopingStream();
                sa.Frequency = 100;

                StreamingSoundBuffer buf = new StreamingSoundBuffer(sa, SoundFormat.Pcm16(44100), 100);

                buf.Play();

                Stopwatch w = new Stopwatch();
                w.Start();

                var font = Font.AgateSans;

                while (AgateApp.IsAlive)
                {
                    Display.BeginFrame();
                    Display.Clear();

                    font.Color = Color.White;
                    font.DrawText(0, 0, string.Format("Frequency: {0}", sa.Frequency));

                    Display.EndFrame();
                    AgateApp.KeepAlive();

                    if (w.ElapsedMilliseconds > 500)
                    {
                        sa.Frequency += 50;
                        w.Reset();
                        w.Start();
                    }
                }

                buf.Stop();
            }
        }
コード例 #2
0
 public SoundInstance(Device device, WaveFormat format, ISoundDataProvider provider)
 {
     buffer = new StreamingSoundBuffer(device, format, provider);
 }