public XnaAudioDriver() { _audioFormat = new AudioFormat(44100); _buffer = new byte[13230 * 2]; _dsei = new DynamicSoundEffectInstance(_audioFormat.SampleRate, _audioFormat.Channels == 2 ? AudioChannels.Stereo : AudioChannels.Mono); _dsei.BufferNeeded += OnBufferNeeded; }
public Mixer(int sampleRate) { Debug.Assert(sampleRate > 0); _channels = new Channel[NumChannels]; soundTypeSettings = new SoundTypeSettings[4]; for (var i = 0; i < soundTypeSettings.Length; i++) { soundTypeSettings[i] = new SoundTypeSettings(MaxMixerVolume); } OutputRate = sampleRate; AudioFormat = new AudioFormat(OutputRate); }
private static WaveFormat ToWaveFormat(AudioFormat format) { return new WaveFormat(format.SampleRate, format.Channels); }