public DirectSoundSoundOutput(Sound sound, IntPtr mainWindowHandle)
		{
			_sound = sound;

			var deviceInfo = DirectSound.GetDevices().FirstOrDefault(d => d.Description == Global.Config.SoundDevice);
			_device = deviceInfo != null ? new DirectSound(deviceInfo.DriverGuid) : new DirectSound();
			_device.SetCooperativeLevel(mainWindowHandle, CooperativeLevel.Priority);
		}
Beispiel #2
0
		public XAudio2SoundOutput(Sound sound)
		{
			_sound = sound;
			_device = new XAudio2();
			int? deviceIndex = Enumerable.Range(0, _device.DeviceCount)
				.Select(n => (int?)n)
				.FirstOrDefault(n => _device.GetDeviceDetails(n.Value).DisplayName == Global.Config.SoundDevice);
			_masteringVoice = deviceIndex == null ?
				new MasteringVoice(_device, Sound.ChannelCount, Sound.SampleRate) :
				new MasteringVoice(_device, Sound.ChannelCount, Sound.SampleRate, deviceIndex.Value);
		}
Beispiel #3
0
		public DummySoundOutput(Sound sound)
		{
			_sound = sound;
		}
Beispiel #4
0
		public OpenALSoundOutput(Sound sound)
		{
			_sound = sound;
			string deviceName = GetDeviceNames().FirstOrDefault(n => n == Global.Config.SoundDevice);
			_context = new AudioContext(deviceName, Sound.SampleRate);
		}