internal void Restart() { for (int i = 0; i < sList.Length; i++) { sList[i] = new SoundEffectSong(sList[i].parentSE, sList[i].parent.IsLooped, false, sList[i]); } }
public void StartCombat() { if (sL1 != null && !SoundEffectSong.IsPlaying(currentLayer)) { SoundEffectSong.ClearSongs(); currentLayer = regionLayerCombatSong.StartPlay(); } }
public void StartNonCombat() { if (nonCombatSES != null) { SoundEffectSong.ClearSongs(); SoundEffectSong.Start(nonCombatSES); } //if (nonCombatSong != null && lastNonCombatSong != nonCombatSong) //{ // MediaPlayer.Play(nonCombatSong); // lastNonCombatSong = nonCombatSong; // MediaPlayer.IsRepeating = true; //} }
public void getSoundReady() { if (sL1 == null && !SongLocL1.Equals("")) { try { sL1 = Game1.contentManager.Load <SoundEffect>(SongLocL1); //EditorFileWriter.SongToFileTest(SongLocL1); } catch (Exception e) { } if (!SongLocL2.Equals("")) { try { sL2 = Game1.contentManager.Load <SoundEffect>(SongLocL2); } catch (Exception e) { } } } if (!SongNonCombat.Equals("") && nonCombatSong == null) { try { nonCombatSong = Game1.contentManager.Load <SoundEffect>(SongNonCombat); nonCombatSES = new SoundEffectSong(nonCombatSong, true, false); } catch (Exception e) { } } if (sL1 != null && sL2 != null) { regionLayerCombatSong = new LayeredSong(new SoundEffectSong(sL1, true), new SoundEffectSong(sL2, true)); } else if (sL1 != null) { regionLayerCombatSong = new LayeredSong(new SoundEffectSong(sL1, true)); } }
internal void SwitchLayer() { if (currentLayer == null) { currentLayer = SoundEffectSong.soundEffectSongs[0]; } if (sL2 != null && currentLayer.parentSE == sL1 && (BattleGUI.bIsRunning || GameProcessor.bStartCombatZoom)) { //regionLayerCombatSong.SwitchLayer(1,100,500); currentLayer = regionLayerCombatSong.SwitchLayer(1, 100, 2500); } else if (currentLayer.parentSE == sL2 && sL1 != null && sL1 != currentLayer.parentSE) { regionLayerCombatSong.SwitchLayer(1, 0, 2500); currentLayer = SoundEffectSong.soundEffectSongs[0]; } }
internal static void Update(GameTime gt) { for (int i = 0; i < soundEffectSongs.Count; i++) { //soundEffectSongs[i].timeSpendPlaying += gt.ElapsedGameTime.Milliseconds; //soundEffectSongs[i].timePassed += gt.ElapsedGameTime.Milliseconds; if (soundEffectSongs[i].timePassed < soundEffectSongs[i].timeToVolume) { soundEffectSongs[i].timePassed += gt.ElapsedGameTime.Milliseconds; SoundEffectSong temp = soundEffectSongs[i]; if (temp.timePassed > temp.timeToVolume) { temp.timePassed = temp.timeToVolume; } if (temp.timeToVolume != 0) { var tempf = temp.startVolume + ((float)temp.deltaVolume * ((float)temp.timePassed / (float)temp.timeToVolume) / 100f); if (tempf < 0) { tempf = 0; } else if (tempf > 1) { tempf = 1f; } temp.parent.Volume = tempf; temp.parent.Volume *= SceneUtility.masterVolume * SceneUtility.musicVolume / 100f / 100f; } else { temp.SetVolume(temp.targetVolume); } if (temp.parent.State != SoundState.Playing) { temp.parent.Play(); } } } }
internal SoundEffectSong(SoundEffect se = null, bool bLoop = true, bool bRemoveRemainingSoundEffectSongs = false, SoundEffectSong disposable = null) { if (bRemoveRemainingSoundEffectSongs) { ClearSongs(); } parent = se.CreateInstance(); parent.Volume *= SceneUtility.masterVolume * SceneUtility.musicVolume / 100f / 100f; parent.IsLooped = bLoop; parentSE = se; if (disposable != null) { disposable.parent.Stop(); disposable.parent.Dispose(); } }
internal static bool IsPlaying(SoundEffectSong currentLayer) { return(soundEffectSongs.Contains(currentLayer)); }
static internal void Start(SoundEffectSong SES) { soundEffectSongs.Add(SES); soundEffectSongs.Last().SetFade(100, 2000); soundEffectSongs.Last().Start(); }
private static void CleanUpResources() { Microsoft.Xna.Framework.Media.MediaPlayer.Stop(); SoundEffectSong.End(); }