/// <summary> /// Default constructor. /// </summary> /// <param name="device">Audio output device.</param> /// <param name="samplesPerSec">Sample rate, in samples per second (hertz).</param> /// <param name="bitsPerSample">Bits per sample. For PCM 8 or 16 are the only valid values.</param> /// <param name="channels">Number of channels.</param> /// <exception cref="ArgumentNullException">Is raised when <b>device</b> is null reference.</exception> /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception> public AudioOut(AudioOutDevice device,int samplesPerSec,int bitsPerSample,int channels) { if(device == null){ throw new ArgumentNullException("device"); } if(samplesPerSec < 1){ throw new ArgumentException("Argument 'samplesPerSec' value must be >= 1.","samplesPerSec"); } if(bitsPerSample < 8){ throw new ArgumentException("Argument 'bitsPerSample' value must be >= 8.","bitsPerSample"); } if(channels < 1){ throw new ArgumentException("Argument 'channels' value must be >= 1.","channels"); } m_pDevice = device; m_pAudioFormat = new AudioFormat(samplesPerSec,bitsPerSample,channels); m_pWaveOut = new WaveOut(device,samplesPerSec,bitsPerSample,channels); }
/// <summary> /// Default constructor. /// </summary> /// <param name="device">Audio output device.</param> /// <param name="format">Audio output format.</param> /// <exception cref="ArgumentNullException">Is raised when <b>device</b> or <b>format</b> is null reference.</exception> public AudioOut(AudioOutDevice device,AudioFormat format) { if(device == null){ throw new ArgumentNullException("device"); } if(format == null){ throw new ArgumentNullException("format"); } m_pDevice = device; m_pAudioFormat = format; m_pWaveOut = new WaveOut(device,format.SamplesPerSecond,format.BitsPerSample,format.Channels); }