A sound clip takes care of loading a particular clip into the audio library
Exemple #1
0
 public static void Play(string filename, Priority priority)
 {
     if (filename != null && filename != "")
     {
         SoundClip newSound;
         switch (priority)
         {
             case Priority.High:
                 newSound = new SoundClip(GameRef.Content, filename);
                 HighPrioritySounds.Add(newSound);
                 newSound.Play(volume, false);
                 break;
             case Priority.Normal:
                 if (NormalSounds.Count < MaxNormalSounds)
                 {
                     newSound = new SoundClip(GameRef.Content, filename);
                     NormalSounds.Add(newSound);
                     newSound.Play(volume, false);
                 }
                 break;
             case Priority.WindNoise:
                 newSound = new SoundClip(GameRef.Content, filename);
                 WindNoise = newSound;
                 newSound.Play(volume, true);
                 break;
         }
     }
     Update();
 }
Exemple #2
0
 public void PlayCrossFade(int trackindex, TimeSpan duration, bool LoopTrack)
 {
     if (currentClip == null)
     {
         Play(trackindex, LoopTrack);
     }
     else
     {
         currentClip.FadeOut(duration);
         currentClip = clips[trackindex];
         currentClip.Stop();
         currentClip.PlayFadeIn(Volume, duration, LoopTrack);
     }
 }
Exemple #3
0
        public void Play(int trackindex, bool LoopTrack)
        {
            if (currentClip != null)
            {
                Stop();
            }

            currentClip = clips[trackindex];
            currentClip.Play(Volume, LoopTrack);
        }