Esempio n. 1
0
        public static void StopAll(bool immediate = false)
        {
            AudioCategory c = m_audioEngine.GetCategory("Default");

            c.Stop(immediate ? AudioStopOptions.Immediate : AudioStopOptions.AsAuthored);

            c = m_audioEngine.GetCategory("Music");
            c.Stop(immediate ? AudioStopOptions.Immediate : AudioStopOptions.AsAuthored);
        }
Esempio n. 2
0
        /// <summary>
        /// Stops playing anything from an audio category.
        /// </summary>
        /// <param name="audioCategoryName">The name of the audio category to stop playing from.</param>
        public static void StopAudioCategory(string audioCategoryName)
        {
            AudioCategory category = audioEngine.GetCategory(audioCategoryName);

            if (category.Name != null)
            {
                category.Stop();
            }
        }
Esempio n. 3
0
        public static void StopEffects()
        {
            AudioCategory c = audioEngine.GetCategory("Default");

            c.Stop(AudioStopOptions.AsAuthored);
        }
Esempio n. 4
0
        }         // StartMusic()

        /// <summary>
        /// Stop music
        /// </summary>
        public static void StopMusic()
        {
            musicCategory.Stop(AudioStopOptions.Immediate);
        }                                    // StopMusic()
Esempio n. 5
0
 public void Update(GameTime gameTime)
 {
     if (currentMusic == null)
     {
         currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         //Fake 3D Sound for Surround Effect ;)
         currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
         currentMusic.Play();
         popUpText.Text = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     if (currentMusic.IsStopped)
     {
         currentMusicindex++;
         if (currentMusicindex >= playList.Keys.Count)
         {
             currentMusicindex = 0;
         }
         currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
         currentMusic.Play();
         popUpText.Text = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     if (transition)
     {
         oldVolume     -= gameTime.GetElapsedTotalSecondsFloat();
         oldVolume      = MathHelper.Clamp(oldVolume, 0, options.MusicVolumeFloat);
         currentVolume += gameTime.GetElapsedTotalSecondsFloat();
         if (currentVolume >= options.MusicVolumeFloat)
         {
             transition    = false;
             currentVolume = MathHelper.Clamp(currentVolume, 0, options.MusicVolumeFloat);
             oldCategory.Stop(AudioStopOptions.Immediate);
             oldMusic.Stop(AudioStopOptions.Immediate);
         }
         oldCategory.SetVolume(oldVolume);
         currentCategory.SetVolume(currentVolume);
     }
     if (popUpActive)
     {
         if (popUpFloatIn)
         {
             popUp.Y += (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
             AlignPopUpText();
             if (popUp.Y >= 0)
             {
                 popUpFloatIn = false;
             }
         }
         else
         {
             popUpStillStandelpasedTime += gameTime.GetElapsedTotalSecondsFloat();
             if (popUpStillStandelpasedTime >= popUpStillStandThreshold)
             {
                 popUp.Y -= (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
                 if (popUp.X <= -(int)(options.Resolution.ScreenHeight * 0.1))
                 {
                     popUpActive = false;
                 }
                 AlignPopUpText();
             }
         }
     }
 }