示例#1
0
文件: Form1.cs 项目: nernst/synth
        private void button1_Click(object sender, System.EventArgs e)
        {
            ErnstTech.SoundCore.WaveForm form = new ErnstTech.SoundCore.WaveForm(new ErnstTech.SoundCore.WaveFormat(2, 44100, 16));
            form.BaseFrequency = 200;

            Point[] points = new Point[this.beatBox1.Points.Count];
            for (int i = 0, length = points.Length; i < length; ++i)
            {
                PointF pt = this.beatBox1.Points[i];
                points[i] = new Point(Convert.ToInt32(pt.X), Convert.ToInt32(pt.Y));
            }

            form.Points.AddRange(points);
            System.IO.Stream s = form.GenerateWave();

#if ERNST_DX_AUDIO
            System.Diagnostics.Debug.Assert(false);

			WavePlayer player = new WavePlayer( this, s );
			player.Play();
#else
            this._Player.Stop();
            this._Player.Stream = s;
            this._Player.Play();
#endif
        }
示例#2
0
文件: Form1.cs 项目: nernst/synth
        private void btnShowWaveForm_Click(object sender, EventArgs e)
        {
            ErnstTech.SoundCore.WaveForm form = new ErnstTech.SoundCore.WaveForm(new ErnstTech.SoundCore.WaveFormat(2, 44100, 16));
            form.BaseFrequency = 100;

            System.IO.Stream s = form.GenerateWave();

            using (WaveFormView view = new WaveFormView(s))
            {
                view.ZoomFactor = 0.25f;
                view.ShowDialog();
            }

            s.Close();
        }