Exemplo n.º 1
0
 //Start playing the wave
 public void Start()
 {
     if (_wave == null)
     {
         //Create a new sine wave provider if not already instantiated
         if (_sineWaveProvider == null)
         {
             _sineWaveProvider = new PortamentoSineWaveProvider32();
         }
         //Set the sample rate, number of channels, frequency and amplitude
         _sineWaveProvider.SetWaveFormat((int)(MAX_FREQ * 2) + (int)MIN_FREQ, 1); //sample rate (2x MAX_FREQ + MIN_FREQ for safety), # channels (only want 1)
         _sineWaveProvider.Frequency = _frequency;
         _sineWaveProvider.Amplitude = _amplitude;
         //Instantiate the wave output object
         _wave = new WaveOut();
         //Initialize and play the sine wave
         _wave.Init(_sineWaveProvider);
         _wave.Play();
     }
 }
Exemplo n.º 2
0
 //Start playing the wave
 public void Start()
 {
     if (_wave == null)
     {
         //Create a new sine wave provider if not already instantiated
         if (_sineWaveProvider == null)
             _sineWaveProvider = new PortamentoSineWaveProvider32();
         //Set the sample rate, number of channels, frequency and amplitude
         _sineWaveProvider.SetWaveFormat((int)(MAX_FREQ * 2) + (int)MIN_FREQ, 1); //sample rate (2x MAX_FREQ + MIN_FREQ for safety), # channels (only want 1)
         _sineWaveProvider.Frequency = _frequency;
         _sineWaveProvider.Amplitude = _amplitude;
         //Instantiate the wave output object
         _wave = new WaveOut();
         //Initialize and play the sine wave
         _wave.Init(_sineWaveProvider);
         _wave.Play();
     }
 }