コード例 #1
0
		/// <summary>
		/// Stops playing sound
		/// </summary>
		/// <param name="immediate"></param>
		public void StopSound ( bool immediate )
		{
			if (soundInstance!=null) {
				soundInstance.Stop( immediate );
				soundInstance	=	null;
			}
		}
コード例 #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(); 
		}
コード例 #3
0
ファイル: SoundEffect.cs プロジェクト: demiurghg/FusionEngine
		/// <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;
        }