예제 #1
0
 private void btnRecord_Click(object sender, System.EventArgs e)
 {
     ob_VuMeter.ScaleFactor      = 2;
     ob_VuMeter.SampleTimeLength = 2000;
     ob_VuMeter.UpperThreshold   = 120;
     ob_VuMeter.LowerThreshold   = 100;
     // Displays the VuMeter form
     ob_VuMeter.ShowForm();
     // assigns the VuMeter object to AudioPlayer property as it is routed through AudioPlayer for integrating it with AudioPlayer
     ar.VuMeterObject = ob_VuMeter;
     try
     {
         AssetManager    aManager = new AssetManager("C:\\Project");
         AudioMediaAsset am       = new AudioMediaAsset(2, 16, 44100);
         aManager.AddAsset(am);
         ar.StartRecording(am);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #2
0
        private void btnPlay_Click(object sender, System.EventArgs e)
        {
            /*
             * OpenFileDialog ofd = new OpenFileDialog();
             * ofd.Filter = "wave files(*.wav|*.wav";
             * ofd.ShowDialog();
             * textBox1.Text = ofd.FileName;
             * textBox2.Text = ofd.FileName;
             *
             * //AudioClip		 ob_Clip = new AudioClip (textBox1.Text) ;
             *
             * AudioMediaAsset am = new AudioMediaAsset (ob_Clip.Channels ,  ob_Clip.BitDepth , ob_Clip.SampleRate) ;
             *
             *
             * am.AddClip (ob_Clip) ;
             *
             * AudioClip		 ob_Clip1 = new AudioClip (textBox2.Text) ;
             * am.AddClip (ob_Clip1) ;
             *
             * AudioClip		 ob_Clip2 = new AudioClip ("F:\\My Documents\\Project\\0.wav" , 0, 5000) ;
             * am.AddClip (ob_Clip2) ;
             */

            VuMeter ob_VuMeter = new VuMeter();

            ob_VuMeter.ScaleFactor      = 2;
            ob_VuMeter.SampleTimeLength = 2000;
            ob_VuMeter.LowerThreshold   = 10;
            ob_VuMeter.UpperThreshold   = 80;
            ob_VuMeter.ShowForm();
            ap.VuMeterObject = ob_VuMeter;

            Microsoft.DirectX.DirectSound.Device dSound = new  Microsoft.DirectX.DirectSound.Device();

            dSound.SetCooperativeLevel(this, CooperativeLevel.Priority);
            ap.OutputDevice = dSound;
            ap.CompFactor   = 1;
            ap.Play(am);
//MessageBox.Show ("Done") ;
        }