Пример #1
0
        internal override void Update()
        {
            Mogre.Vector3 pos = _node._getDerivedPosition();

            FreeSL.fslSoundSetPosition(_sound, pos.x, pos.y, pos.z);

            AutoDelete();
        }
Пример #2
0
 internal bool RemoveAmbientSound(AmbientSound sound)
 {
     if (sound.HasSound())
     {
         FreeSL.fslFreeSound(sound.SoundID, true);
     }
     return(_ambientSounds.Remove(sound));
 }
Пример #3
0
 internal bool RemoveSoundEntity(SoundEntity sound)
 {
     if (sound.HasSound())
     {
         FreeSL.fslFreeSound(sound.SoundID, true);
     }
     return(_soundEntities.Remove(sound));
 }
Пример #4
0
        /// <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;
        }
Пример #5
0
        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);
        }
Пример #6
0
        /// <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;
        }
Пример #7
0
        /// <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);
        }
Пример #8
0
 /// <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());
 }
Пример #9
0
 /// <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));
 }
Пример #10
0
 /// <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);
 }
Пример #11
0
 internal AmbientSound(string soundFile, string name, bool loop, bool streaming)
     : base(soundFile, name, loop, streaming)
 {
     FreeSL.fslSoundSetSourceRelative(_sound, true);
 }
Пример #12
0
 /// <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);
 }
Пример #13
0
 /// <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);
 }
Пример #14
0
 /// <summary>
 /// Stops all sounds currently playing.
 /// </summary>
 public void StopAllSounds()
 {
     FreeSL.fslSoundStopAllSounds();
 }
Пример #15
0
 /// <summary>
 /// Pauses all sounds currently playing.
 /// </summary>
 public void PauseAllSounds()
 {
     FreeSL.fslSoundPauseAllSounds();
 }
Пример #16
0
 internal void ShutDown()
 {
     FreeSL.fslShutDown();
     _initSound = false;
 }
Пример #17
0
 /// <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);
 }
Пример #18
0
 /// <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);
 }
Пример #19
0
 /// <summary>
 /// Unpauses all sounds currently paused.
 /// </summary>
 public void UnpauseAllSounds()
 {
     FreeSL.fslSoundUnPauseAllSounds();
 }
Пример #20
0
 /// <summary>
 /// Sets the listener environment.
 /// </summary>
 /// <param name="prop">The prop.</param>
 public void SetListenerEnvironment(FSL_EAX_LISTENER_PROPERTIES prop)
 {
     FreeSL.fslSetListenerEnvironment(prop);
 }
Пример #21
0
 /// <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);
 }
Пример #22
0
 /// <summary>
 /// Sets the listener environment preset.
 /// </summary>
 /// <param name="type">The type.</param>
 public void SetListenerEnvironmentPreset(FSL_LISTENER_ENVIRONMENT type)
 {
     FreeSL.fslSetListenerEnvironmentPreset(type);
 }
Пример #23
0
 /// <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);
 }
Пример #24
0
 /// <summary>
 /// Sets the listener default environment.
 /// </summary>
 public void SetListenerDefaultEnvironment()
 {
     FreeSL.fslSetListenerDefaultEnvironment();
 }
Пример #25
0
 /// <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);
 }
Пример #26
0
 /// <summary>
 /// Gets the current listener environment.
 /// </summary>
 /// <returns></returns>
 public FSL_EAX_LISTENER_PROPERTIES GetCurrentListenerEnvironment()
 {
     return(FreeSL.fslGetCurrentListenerEnvironment());
 }
Пример #27
0
 /// <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));
 }
Пример #28
0
 /// <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));
 }
Пример #29
0
 internal AmbientSound(string package, string soundFile, string name, bool loop)
     : base(package, soundFile, name, loop)
 {
     FreeSL.fslSoundSetSourceRelative(_sound, true);
 }
Пример #30
0
 /// <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);
 }