示例#1
0
        /// <summary>
        /// plays a sound in loop.
        /// </summary>
        /// <param name="e">Sound to play in loop</param>
        /// <returns>loopID assigned to the loop.</returns>
        public static int playInLoop(Sound e)
        {
            MemoryStream ms = e.getStream();
            //Can cause out of memory exception.
            SecondaryBuffer buffer = new SecondaryBuffer(ms, device);
            buffer.Play(0, BufferPlayFlags.Looping);

            loops.Add(loopID, buffer);
            return loopID++;
        }
示例#2
0
 /// <summary>
 /// plays the sound with the given soundeffect
 /// </summary>
 /// <param name="soundEffect">the sound effect to play</param>
 public void play(Sound soundEffect)
 {
     SoundPlayer.play(soundEffect);
 }
示例#3
0
 /// <summary>
 /// Plays sound. 
 /// </summary>
 /// <param name="e">Sound to play</param>
 public static void play(Sound e)
 {
     MemoryStream ms = e.getStream();
     SecondaryBuffer buffer = new SecondaryBuffer(ms, device);
     buffer.Play(0, BufferPlayFlags.Default);
 }