Category5.SoundClip.Play C# (CSharp) Method

Play() public method

public Play ( float volume, bool loopPlayback ) : void
volume float
loopPlayback bool
return void
        public void Play(float volume, bool loopPlayback)
        {
            this.volume = volume;
            if (!Playing)
            {
                clipInstance = clipSound.Play(volume, 0, 0, loopPlayback);
            }
            if (clipInstance != null && clipInstance.State != SoundState.Playing)
            {
                clipInstance.Play();
            }
        }

Usage Example

Example #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();
 }
All Usage Examples Of Category5.SoundClip::Play