/// <summary> /// Add A Sound Effect to the Repo /// Sounds are shared here /// </summary> /// <param name="musicNamePath">filepath</param> /// <param name="musicName">Name used to refer to this effect latter</param> /// <param name="volume">between 0 - 1</param> /// <param name="pitch">between -1 to 1 (octaves)</param> /// <param name="pan">between -1 to 1 (left - right)</param> /// <param name="isLooped">if set to <c>true</c> [is looped].</param> public void AddSoundToRepository(string musicNamePath, String musicName, float volume = 1, float pitch = 0, float pan = 0, bool isLooped = false) { System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(musicNamePath)); System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(musicName)); SimpleSoundEffect sse = new SimpleSoundEffect(manager, musicNamePath, volume, pitch, pan, isLooped); if (musics.ContainsKey(musicName)) { ActiveLogger.LogMessage("Already contains this song " + musicName + " , Overwriting", LogLevel.Warning); } musics[musicName] = sse; }
/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo,factory, contentManager); { ///Create the xml file model extractor ///Loads a XML file that was export by our 3DS MAX plugin ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//"); this.AttachCleanUpAble(ext); ///Extract all the XML info (Model,Cameras, ...) ModelLoaderData data = ext.Load(factory, GraphicInfo, "ilha"); ///Create the WOrld Loader ///Convert the ModelLoaderData in World Entities WorldLoader wl = new WorldLoader(); ///all default wl.LoadWorld(factory, GraphicInfo, World, data); } ///Create and add a sound to the SoundAudioPlayer ap = new SoundAudioPlayer(factory); ap.AddSoundToRepository("Songs/bye", "bye"); ///Create a sound effect without the SoundAudioPlayer (internaly the SoundAudioPlayer is a container of SimpleSoundEffect -- and some stuffs more) se = new SimpleSoundEffect(factory, "Songs/alarm"); ///Load the Sounds that you hear in your Microsoft Media Player ///Just loading the first album found =P lm = new LocalMediaAudioPlayer(); AlbumCollection ac = lm.MediaLibrary.Albums; lm.PlayAlbum(ac[0]); ///Creating a static 3D sound in the 0,0,0 (Bellow the island tree, go there and hear the sound getting louder) sound = new Static3DSound(factory, "Songs/pianosong", Vector3.Zero); this.World.AddSoundEmitter(sound, true); #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.5f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo); this.World.CameraManager.AddCamera(cam); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
/// <summary> /// Add A Sound Effect to the Repo /// Sounds are shared here /// </summary> /// <param name="musicNamePath">filepath</param> /// <param name="musicName">Name used to refer to this effect latter</param> /// <param name="volume">between 0 - 1</param> /// <param name="pitch">between -1 to 1 (octaves)</param> /// <param name="pan">between -1 to 1 (left - right)</param> /// <param name="isLooped">if set to <c>true</c> [is looped].</param> public void AddSoundToRepository(string musicNamePath, String musicName, float volume = 1, float pitch = 0, float pan = 0, bool isLooped = false) { System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(musicNamePath)); System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(musicName)); SimpleSoundEffect sse = new SimpleSoundEffect(manager,musicNamePath, volume, pitch, pan, isLooped); if (musics.ContainsKey(musicName)) { ActiveLogger.LogMessage("Already contains this song " + musicName + " , Overwriting", LogLevel.Warning); } musics[musicName] = sse; }