internal override void Update() { Mogre.Vector3 pos = _node._getDerivedPosition(); FreeSL.fslSoundSetPosition(_sound, pos.x, pos.y, pos.z); AutoDelete(); }
internal bool RemoveAmbientSound(AmbientSound sound) { if (sound.HasSound()) { FreeSL.fslFreeSound(sound.SoundID, true); } return(_ambientSounds.Remove(sound)); }
internal bool RemoveSoundEntity(SoundEntity sound) { if (sound.HasSound()) { FreeSL.fslFreeSound(sound.SoundID, true); } return(_soundEntities.Remove(sound)); }
/// <summary> /// Sets the sound (read from a file) that will be used. /// </summary> /// <param name="package">A ZIP package containing the soundfile to use.</param> /// <param name="soundFile">Soundfile relative to package. Must be in OGG format.</param> /// <param name="loop">Whether the sound should loop</param> public void SetSound(string package, string soundFile, bool loop) { if (System.IO.File.Exists(package) == false) { throw new System.IO.FileNotFoundException("The sound file : " + soundFile + "in" + package + " does not exist."); } _sound = FreeSL.fslLoadSoundFromZip(package, soundFile); LoopSound(loop); _withSound = true; }
internal void Update() { int zflip = (ZFlipped) ? -1 : 1; // added FreeSL.fslSetListenerPosition(_renderable.RealPosition.x, _renderable.RealPosition.y, _renderable.RealPosition.z); Mogre.Vector3 yVec, zVec; yVec = _renderable.RealOrientation.YAxis; zVec = _renderable.RealOrientation.ZAxis * zflip;// change FreeSL.fslSetListenerOrientation(zVec.x, zVec.y, zVec.z, yVec.x, yVec.y, yVec.z); }
/// <summary> /// Sets the sound (read from a file) that will be used. /// </summary> /// <param name="soundFile">Soundfile relative to current directory. Must be in OGG format.</param> /// <param name="loop">Whether the sound should loop</param> /// <param name="streaming">Whether the sound should be streamed from the disk (true) or read into the RAM and then played (false).</param> public void SetSound(string soundFile, bool loop, bool streaming) { if (System.IO.File.Exists(soundFile) == false) { throw new System.IO.FileNotFoundException("The sound file : " + soundFile + " does not exist."); } if (streaming) { _sound = FreeSL.fslStreamSound(soundFile); } else { _sound = FreeSL.fslLoadSound(soundFile); } LoopSound(loop); _withSound = true; }
/// <summary> /// Initializes the sound system. /// </summary> /// <param name="soundSystem">Enumeration of FSL_SOUND_SYSTEM to use.</param> /// <param name="listener">Camera to use as a listener for 3D sound.</param> /// <returns></returns> public bool InitializeSound(FSL_SOUND_SYSTEM soundSystem, Mogre.Camera listener) { _listener = new Listener(listener); GetListener().ZFlipped = true; if (_initSound) { return(true); } if (!FreeSL.fslInit(soundSystem)) //Change if you desire { return(false); } FreeSL.fslSetAutoUpdate(true); _initSound = true; return(true); }
/// <summary> /// Gets the current memory usage of all non-streaming sounds. This method does not seem to work properly. /// </summary> /// <returns></returns> public long GetMemoryUseage() { return((long)FreeSL.fslGetSoundMemoryUsage()); }
/// <summary> /// Creates the listener environment. /// </summary> /// <param name="strData">The STR data.</param> /// <param name="Size">The size.</param> /// <returns></returns> public FSL_EAX_LISTENER_PROPERTIES CreateListenerEnvironment(string strData, uint Size) { return(FreeSL.fslCreateListenerEnvironment(strData, Size)); }
/// <summary> /// Sets the gain of the current SoundObject. /// </summary> /// <param name="gain">Positive or negative gain to apply to the sound.</param> public void SetGain(float gain) { FreeSL.fslSoundSetGain(_sound, gain); }
internal AmbientSound(string soundFile, string name, bool loop, bool streaming) : base(soundFile, name, loop, streaming) { FreeSL.fslSoundSetSourceRelative(_sound, true); }
/// <summary> /// Sets speed of sound for use by the doppler effect. /// </summary> /// <param name="speed">Speed of sound to assign. The default value is 343.3.</param> public void SetSpeedOfSound(float speed) { FreeSL.fslSetSpeedOfSound(speed); }
/// <summary> /// Sets the gain of all sounds. /// </summary> /// <param name="gain">Positive or negative gain to apply to all sounds.</param> public void SetGainAllSounds(float gain) { FreeSL.fslSoundSetGainAllSounds(gain); }
/// <summary> /// Stops all sounds currently playing. /// </summary> public void StopAllSounds() { FreeSL.fslSoundStopAllSounds(); }
/// <summary> /// Pauses all sounds currently playing. /// </summary> public void PauseAllSounds() { FreeSL.fslSoundPauseAllSounds(); }
internal void ShutDown() { FreeSL.fslShutDown(); _initSound = false; }
/// <summary> /// Sets the distance from the camera at which this sound will be at normal volume. /// </summary> /// <param name="distance">Distance measured in MOGRE units</param> public void SetReferenceDistance(float distance) { FreeSL.fslSoundSetReferenceDistance(_sound, distance); }
/// <summary> /// Sets the distance from the camera at which this sound will no longer be audible. /// </summary> /// <param name="distance">Distance measured in MOGRE units</param> public void SetMaxDistance(float distance) { FreeSL.fslSoundSetMaxDistance(_sound, distance); }
/// <summary> /// Unpauses all sounds currently paused. /// </summary> public void UnpauseAllSounds() { FreeSL.fslSoundUnPauseAllSounds(); }
/// <summary> /// Sets the listener environment. /// </summary> /// <param name="prop">The prop.</param> public void SetListenerEnvironment(FSL_EAX_LISTENER_PROPERTIES prop) { FreeSL.fslSetListenerEnvironment(prop); }
/// <summary> /// Sets the speed of all sounds. /// </summary> /// <param name="pitch">Speed between 0 and 1 at which to play the sound.</param> public void SetSpeedAllSounds(float pitch) { FreeSL.fslSoundSetSpeedAllSounds(pitch); }
/// <summary> /// Sets the listener environment preset. /// </summary> /// <param name="type">The type.</param> public void SetListenerEnvironmentPreset(FSL_LISTENER_ENVIRONMENT type) { FreeSL.fslSetListenerEnvironmentPreset(type); }
/// <summary> /// Sets parameters for the doppler effect. /// </summary> /// <param name="factor">Factor by which to scale the Doppler effect. 0 = off, 1 = normal.</param> /// <param name="velocity">A leftover input variable from OpenAL 1.0. Default value is 1.</param> public void SetDopplerParameters(float factor, float velocity) { FreeSL.fslSetDopplerParameters(factor, velocity); }
/// <summary> /// Sets the listener default environment. /// </summary> public void SetListenerDefaultEnvironment() { FreeSL.fslSetListenerDefaultEnvironment(); }
/// <summary> /// Sets the distance-based sound attenuation model. Controls how the gain of sound sources is affected by distance from the listener. /// </summary> /// <param name="model">Model to apply as the distance sound attenuation model. The default attenuation model is AL_INVERSE_DISTANCE_CLAMPED.</param> public void SetLinearDistanceModel(AL_DISTANCE_MODEL model) { FreeSL.fslSetListenerDistanceModel(model); }
/// <summary> /// Gets the current listener environment. /// </summary> /// <returns></returns> public FSL_EAX_LISTENER_PROPERTIES GetCurrentListenerEnvironment() { return(FreeSL.fslGetCurrentListenerEnvironment()); }
/// <summary> /// Loads the listener environment. /// </summary> /// <param name="strFile">The STR file.</param> /// <returns></returns> public FSL_EAX_LISTENER_PROPERTIES LoadListenerEnvironment(string strFile) { return(FreeSL.fslLoadListenerEnvironment(strFile)); }
/// <summary> /// Loads the listener environment from zip. /// </summary> /// <param name="strFile">The STR file.</param> /// <param name="strPackage">The STR package.</param> /// <returns></returns> public FSL_EAX_LISTENER_PROPERTIES LoadListenerEnvironmentFromZip(string strFile, string strPackage) { return(FreeSL.fslLoadListenerEnvironmentFromZip(strPackage, strFile)); }
internal AmbientSound(string package, string soundFile, string name, bool loop) : base(package, soundFile, name, loop) { FreeSL.fslSoundSetSourceRelative(_sound, true); }
/// <summary> /// Sets the playback speed of the current SoundObject. /// </summary> /// <param name="speed">Speed between 0 and 1 at which to play the sound.</param> public void SetSpeed(float speed) { FreeSL.fslSoundSetSpeed(_sound, speed); }