public void loadTrack(string trackName) { currentTrack = trackName; System.IO.Stream stream = TitleContainer.OpenStream(BeatShift.contentManager.RootDirectory + "/BFF/" + trackName + ".bff"); LoadBFF(new StreamReader(stream)); stream.Dispose(); waveBank = new WaveBank(BeatShift.engine, "Content\\XACT\\" + trackName + "Map.xwb"); if (track != null && !track.IsStopped) { track.Stop(AudioStopOptions.AsAuthored); } try { track.Dispose(); } catch (NullReferenceException e) { } track = soundBank.GetCue(trackName); tick.Reset(); GC.Collect(); }
/// <summary> /// Stops playing this sound as authored /// </summary> #endregion public void Stop() { if (mCue.IsPlaying || mCue.IsPaused) { mCue.Stop(AudioStopOptions.AsAuthored); } }
/// <summary> /// Stop playing as authored. /// </summary> public void Stop() { if (cue != null) { cue.Stop(AudioStopOptions.AsAuthored); } }
void Tower_ZeroHealth(object sender, EventArgs e) { if(heartbeatCue.IsPlaying) heartbeatCue.Stop(AudioStopOptions.Immediate); audioEngine.GetCategory("Drums").Stop(AudioStopOptions.Immediate); outroCue = soundBank.GetCue("Outro"); outroCue.Play(); }
private void ChangeBgm(string bgmName) { if (bgm != null && bgm.IsPlaying) { bgm.Stop(AudioStopOptions.AsAuthored); } bgm = AudioManager.GetCue(bgmName); PlayBGM(); }
public virtual void StopSound() { if (cue != null && cue.IsPlaying) { cue.Stop(AudioStopOptions.Immediate); cue = null; audioEmitter = null; } }
public override void OnExit() { if (m_seagullCue != null && m_seagullCue.IsPlaying) { m_seagullCue.Stop(AudioStopOptions.Immediate); m_seagullCue.Dispose(); } base.OnExit(); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } //Блок управления проигрыванием по нажатию клавиш //При нажатии клавиши A приостанавливаем проигрывание KeyboardState kbState = Keyboard.GetState(); if (kbState.IsKeyDown(Keys.A)) { musicCue.Pause(); } //При нажатии клавиши S продолжаем проигрывание музыки if (kbState.IsKeyDown(Keys.S)) { musicCue.Resume(); } //При нажатии клавиши D переходим на следующую песню if (kbState.IsKeyDown(Keys.D)) { countDPress++; if (countDPress == 1) //Для того, чтобы переключение происходило только 1 раз при нажатии { if (curSong < numberOfSongs) { curSong++; } else { curSong = 1; } musicCue.Stop(AudioStopOptions.Immediate); musicCue = soundBank.GetCue(curSong.ToString()); musicCue.Play(); } } if (kbState.IsKeyUp(Keys.D)) { countDPress = 0; } if (!isGameRun) { musicCue.Stop(AudioStopOptions.Immediate); } audioEngine.Update(); base.Update(gameTime); }
public void Stop() { if (modMusic != null) { modMusic.Stop(); } else { cue.Stop(AudioStopOptions.Immediate); } }
public override void Dispose() { if (currentState == CLOUD_STATE.LIGHTNING) { if (rumbleSound != null) { rumbleSound.Stop(AudioStopOptions.AsAuthored); rumbleSound = null; } } base.Dispose(); }
private void PlayNarrator() { if (narrator != null && narrator.IsPlaying) { narrator.Stop(AudioStopOptions.Immediate); } if (audioIndex < narratorLines.Length) { narrator = AudioManager.GetCue(narratorLines[audioIndex]); narrator.Play(); } }
public void Finish() { if (sound != null && stopSoundOnFinalize && (!sound.IsStopped || !sound.IsStopping)) { sound.Stop(AudioStopOptions.AsAuthored); } animationStatus = AnimationStatus.Finished; if (OnFinalize == OnFinalize.Hide) { IsVisible = false; } }
/// <summary> /// Start Playing BackGround Music /// </summary> /// <param name="bgmusic_cue"></param> public void StartBgMusic(string bgmusic_cue) { if (!isInitialized) { MessageBox.Show("Audio System Not Initialized !", "Error !"); } if (bgMusic != null && !bgMusic.IsStopped) { bgMusic.Stop(AudioStopOptions.AsAuthored); } bgMusic = soundBank.GetCue(bgmusic_cue); bgMusic.Play(); activeCues.Add(bgMusic); }
public void EndBossEvent() { mBossEvent = false; mMusicName = mMusic.Name; mBossMusic.Stop(AudioStopOptions.Immediate); mMusic.Resume(); }
public static void StopMainTheme() { if (mainTheme != null) { mainTheme.Stop(AudioStopOptions.Immediate); } }
public void StopBackgroundMusic() { if (backgroundCue != null) { backgroundCue.Stop(AudioStopOptions.Immediate); } }
private void PlayAnim() { switch (currentState) { case CLOUD_STATE.LIGHTNING: m_anim.PlaySequence(m_lightning); rumbleSound = Sound.PlayCue("rumble1", this); break; case CLOUD_STATE.THUNDER: m_anim.PlaySequence(m_thunder); if (rumbleSound != null) { rumbleSound.Stop(AudioStopOptions.AsAuthored); rumbleSound = null; } break; case CLOUD_STATE.NORM: m_anim.PlaySequence(m_norm); break; case CLOUD_STATE.RAIN: m_anim.PlaySequence(m_rain); break; case CLOUD_STATE.HAIL: m_anim.PlaySequence(m_hail); break; } }
public override void OnExit() { if (m_rainSFX != null && !m_rainSFX.IsDisposed) { m_rainSFX.Stop(AudioStopOptions.Immediate); } }
protected override void Update(GameTime gameTime) { GamePadState gamePadState = GamePad.GetState(PlayerIndex.One); if (gamePadState.Buttons.Back == ButtonState.Pressed) { this.Exit(); } KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Space) || (gamePadState.Buttons.B == ButtonState.Pressed)) { if ((cue1 == null) || (cue1.IsStopped)) { cue1 = soundBank.GetCue("audio1"); cue1.Play(); } } if (keyState.IsKeyDown(Keys.Enter) || (gamePadState.Buttons.A == ButtonState.Pressed)) { if (cue1 != null) { cue1.Stop(AudioStopOptions.Immediate); } } audioEngine.Update(); base.Update(gameTime); }
public void StopBeamSounds() { if (turretWeapon.firetype != Weapon.fireType.Beam) { return; } if (laserCue == null) { return; } if (!laserCue.IsPlaying) { return; } if (laserCue.IsStopped) { return; } try { laserCue.Stop(AudioStopOptions.AsAuthored); laserCue.Dispose(); } catch { } }
public void StopCue(Cue cue, AudioStopOptions option) { if (cue != null) { cue.Stop(option); } }
/// <summary> /// Stop background music /// </summary> public static void StopBackgroundMusic() { if (backgroundMusic.IsPlaying) { backgroundMusic.Stop(AudioStopOptions.Immediate); } }
public override void farmerAdjacentAction(GameLocation location) { if (this.name == null || this.isTemporarilyInvisible) { return; } if (this.name.Contains("Block") && (this.pit != menu.sca + menu.gro || this.dur != menu.dur || this.sou != menu.labels[menu.labelIndex])) { this.pit = musicIndex.ContainsKey(menu.sca + menu.gro) ? menu.sca + menu.gro : null; this.dur = menu.dur; this.sou = menu.labels[menu.labelIndex]; } if ((this.cue == null || Game1.currentGameTime.TotalGameTime.TotalMilliseconds - this.lastNoteBlockSoundTime >= 1000) && sou != null && pit != null && dur != null) { if (cueInternal != null && cueInternal.IsPlaying) { cueInternal.Stop(AudioStopOptions.AsAuthored); } cue = ModEntry.soundBank.GetCue(musicIndex[this.name] + musicIndex[sou] + musicIndex[dur] + musicIndex[pit]); cue.SetVariable("Volume", menu.value / 2.1f); if (menu.whetherToStopNextTime) { cueInternal = cue; cueInternal.Play(); } else { cue.Play(); } this.scale.Y = 1.3f; this.shakeTimer = 200; this.lastNoteBlockSoundTime = (int)Game1.currentGameTime.TotalGameTime.TotalMilliseconds; return; } }
/// <summary> /// Stops a previously playing cue /// </summary> /// <param name="cue">The cue to stop that you got returned from Play(sound) /// </param> public void Stop(Cue cue) { if (cue != null) { cue.Stop(AudioStopOptions.Immediate); } }
public void StopPlayList() { if (currentlyPlaying != null) { currentlyPlaying.Stop(AudioStopOptions.Immediate); currentlyPlaying = null; } }
public void StopMusic(bool transition = true) { if (_music != null) { _music.Stop(transition ? AudioStopOptions.AsAuthored : AudioStopOptions.Immediate); } _music = null; }
public void StopMusic(string i_SoundEffectName) { if (!m_IsMusicMutted) { Cue soundCue = r_SoundBank.GetCue(i_SoundEffectName); soundCue.Stop(AudioStopOptions.Immediate); } }
public void Stop() { if (cue.IsStopped) { return; } cue.Stop(AudioStopOptions.Immediate); }
//stop a 2D cue - AudioStopOptions: AsAuthored and Immediate public void StopCue(string cueName, AudioStopOptions audioStopOptions) { Cue cue = this.soundBank.GetCue(cueName); if ((cue != null) && (cue.IsPlaying)) { cue.Stop(audioStopOptions); } }
private void ControlSound(String fxName, String state) { Song soundEffect = null; Cue soundEffectCue = null; if (strArry != null) { //String check = ""; //int index = -1; for (int i = 0; i < strArry.Length; i++) { if (strArry[i].Contains(fxName)) { if (fxName.Equals("invasion") || fxName.Equals("roughThemeSmall")) { //index = j; soundEffect = soundArray.ElementAt <Song>(i); if (state.Equals(EventList.PlaySound)) { MediaPlayer.Play(soundEffect); } else if (state.Equals(EventList.PauseSound)) // && soundEffect.IsPlaying) { MediaPlayer.Pause(); } else if (state.Equals(EventList.StopSound)) // && soundEffect.IsPlaying) { MediaPlayer.Stop(); } } else { soundEffectCue = soundBank.GetCue(strArry[i]); if (state.Equals(EventList.PlaySound)) { soundEffectCue.Play(); } else if (state.Equals(EventList.PauseSound) && soundEffectCue.IsPlaying) { soundEffectCue.Pause(); } else if (state.Equals(EventList.StopSound) && soundEffectCue.IsPlaying) { soundEffectCue.Stop(AudioStopOptions.AsAuthored); } } } } } }
/// <summary> /// Starts a new combat stage. Called right after the stage changes. /// </summary> /// <remarks>The stage never changes into NotStarted.</remarks> protected override void StartStage() { switch (stage) { case CombatActionStage.Preparing: // called from Start() { // play the animations combatant.CombatSprite.PlayAnimation("SpellCast"); spellSpritePosition = Combatant.Position; spell.SpellSprite.PlayAnimation("Creation"); // remove the magic points Combatant.PayCostForSpell(spell); } break; case CombatActionStage.Advancing: { // play the animations spell.SpellSprite.PlayAnimation("Traveling"); // calculate the projectile destination projectileDirection = Target.Position - Combatant.OriginalPosition; totalProjectileDistance = projectileDirection.Length(); projectileDirection.Normalize(); projectileDistanceCovered = 0f; // determine if the projectile is flipped if (Target.Position.X > Combatant.Position.X) { projectileSpriteEffect = SpriteEffects.FlipHorizontally; } else { projectileSpriteEffect = SpriteEffects.None; } // get the projectile's cue and play it projectileCue = AudioManager.GetCue(spell.TravelingCueName); if (projectileCue != null) { projectileCue.Play(); } } break; case CombatActionStage.Executing: { // play the animation spell.SpellSprite.PlayAnimation("Impact"); // stop the projectile sound effect if (projectileCue != null) { projectileCue.Stop(AudioStopOptions.Immediate); } // apply the spell effect to the primary target bool damagedAnyone = ApplySpell(Target); // apply the spell to the secondary targets foreach (Combatant targetCombatant in CombatEngine.SecondaryTargetedCombatants) { // skip dead or dying targets if (targetCombatant.IsDeadOrDying) { continue; } // apply the spell damagedAnyone |= ApplySpell(targetCombatant); } // play the impact sound effect if (damagedAnyone) { AudioManager.PlayCue(spell.ImpactCueName); if (spell.Overlay != null) { spell.Overlay.PlayAnimation(0); spell.Overlay.ResetAnimation(); } } } break; case CombatActionStage.Returning: // play the animation combatant.CombatSprite.PlayAnimation("Idle"); break; case CombatActionStage.Finishing: // play the animation combatant.CombatSprite.PlayAnimation("Idle"); break; case CombatActionStage.Complete: // play the animation combatant.CombatSprite.PlayAnimation("Idle"); // make sure that the overlay has stopped spell.Overlay.StopAnimation(); break; } }