Exemplo n.º 1
0
		/// <summary>
		/// Stops playing sound
		/// </summary>
		/// <param name="immediate"></param>
		public void StopSound ( bool immediate )
		{
			if (soundInstance!=null) {
				soundInstance.Stop( immediate );
				soundInstance	=	null;
			}
		}
Exemplo n.º 2
0
		/// <summary>
		/// Starts playing sound
		/// </summary>
		/// <param name="soundEffect"></param>
		/// <param name="options"></param>
		/// <param name="volume"></param>
		/// <param name="pitch"></param>
		public void PlaySound ( SoundEffect soundEffect, PlayOptions options = PlayOptions.None )
		{
			soundInstance	=	soundEffect.CreateInstance();

			soundInstance.IsLooped	=	options.HasFlag(PlayOptions.Looped);

			soundInstance.Play(); 
		}
Exemplo n.º 3
0
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
        internal SoundEffectInstance CreateInstance()
        {
            SourceVoice voice = null;
            if (device.Device != null) {
                voice = new SourceVoice(device.Device, _format, VoiceFlags.UseFilter, XAudio2.MaximumFrequencyRatio);
			}

            var instance = new SoundEffectInstance(device, this, voice);
            return instance;
        }