コード例 #1
0
 public override void Update()
 {
     FreeSL.fslSoundSetPosition(_sound,
                                _renderable.WorldPosition.x,
                                _renderable.WorldPosition.y,
                                _renderable.WorldPosition.z);
 }
コード例 #2
0
        public bool InitializeSound(CameraListenerBase listener, FreeSL.FSL_SOUND_SYSTEM soundSystem)
        {
            lock (LockSync)
            {
                _listener = new FSLListener(listener);
                if (_initSound)
                {
                    return(true);
                }

                if (!FreeSL.fslInit(soundSystem)) //Change if desire
                {
                    return(false);
                }

                _initSound = true;

                /*FreeSL.ErrorCallbackDelegate ErrorDelegate = new FreeSL.ErrorCallbackDelegate(ErrorCallback);
                 * GCHandle AllocatedDelegate = GCHandle.Alloc(ErrorDelegate);
                 * FreeSL.fslSetErrorCallback(ErrorDelegate);*/


                updaterThread      = new Thread(new ThreadStart((UpdateSoundObjects)));
                updaterThread.Name = "Wof - sound updater thread " + updaterThread.GetHashCode();
                updaterThread.Start();
                return(true);
            }
        }
コード例 #3
0
        public void SetSound(string soundFile, bool loop, bool streaming)
        {
            RemoveSound();
            if (File.Exists(soundFile) == false)
            {
                throw new FileNotFoundException("The sound file at : " + soundFile + " does not exist.");
            }


            lock (SoundManager3D.Instance.LockSync)
            {
                if (streaming)
                {
                    Console.WriteLine("Streaming sound: " + soundFile);
                    _sound = FreeSL.fslStreamSound(soundFile);
                }
                else
                {
                    _sound = FreeSL.fslLoadSound(soundFile);
                }
                _streaming = streaming;
                if (!streaming)
                {
                    LoopSound(loop);
                }
            }

            _loop      = loop;
            _soundFile = soundFile;
            _withSound = true;
        }
コード例 #4
0
        public void Update()
        {
            unsafe
            {
                if (_listener == null || _listener.NativePtr == null)
                {
                    return;
                }
            }

            if (!_listener.IsReady())
            {
                return;
            }
            try
            {
                int zflip = (ZFlipped) ? -1 : 1; // added

                FreeSL.fslSetListenerPosition(_listener.CameraLastRealPosition.Value.x,
                                              _listener.CameraLastRealPosition.Value.y,
                                              _listener.CameraLastRealPosition.Value.z);

                Mogre.Vector3 yVec, zVec;
                yVec = _listener.CameraLastRealOrientation.Value.YAxis;
                zVec = _listener.CameraLastRealOrientation.Value.ZAxis * zflip;// change

                FreeSL.fslSetListenerOrientation(zVec.x, zVec.y, zVec.z, yVec.x, yVec.y, yVec.z);
            }
            catch (Exception exception)
            {
                //   Console.WriteLine("AAAA " + exception.Message + " " + exception.InnerException + " " + exception.Source);
            }
        }
コード例 #5
0
 public void LoopSound(bool loop)
 {
     if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
     {
         return;
     }
     FreeSL.fslSoundSetLooping(_sound, loop);
 }
コード例 #6
0
 public bool IsPaused()
 {
     if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
     {
         return(false);
     }
     return(FreeSL.fslSoundIsPaused(_sound));
 }
コード例 #7
0
 public void Pause()
 {
     if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
     {
         return;
     }
     FreeSL.fslSoundPause(_sound);
 }
コード例 #8
0
 public void RemoveSound()
 {
     if (_withSound)
     {
         FreeSL.fslFreeSound(_sound, true);
         _withSound = false;
     }
 }
コード例 #9
0
 public void ShutDown()
 {
     lock (LockSync)
     {
         FreeSL.fslShutDown();
         _initSound = false;
     }
     // this.updaterThread = new Thread(new ThreadStart(UpdateSoundObjects));
 }
コード例 #10
0
        protected void SetGain(float gain)
        {
            if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
            {
                return;
            }
            //LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "SETTING GAIN: " + this.Name + " Base: " + this.GetBaseGain() + ", final gain:" + gain);

            FreeSL.fslSoundSetGain(_sound, gain);
        }
コード例 #11
0
 public void Stop()
 {
     if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
     {
         return;
     }
     _shouldBePlaying = false;
     FreeSL.fslSoundStop(_sound);
     _playing = false;
 }
コード例 #12
0
 public void Update()
 {
     FreeSL.fslSetListenerPosition(_renderable.Position.x,
                                   _renderable.Position.y,
                                   _renderable.Position.z);
     Mogre.Vector3 yVec, zVec;
     yVec = _renderable.Orientation.YAxis;
     zVec = _renderable.Orientation.ZAxis;
     FreeSL.fslSetListenerOrientation(zVec.x, zVec.y, zVec.z, yVec.x, yVec.y, yVec.z);
 }
コード例 #13
0
 public void SetSound(string package, string soundFile, bool loop)
 {
     RemoveSound();
     if (System.IO.File.Exists(package) == false)
     {
         throw new System.IO.FileNotFoundException("The sound file at : " + soundFile + " does not exist.");
     }
     FreeSL.fslLoadSoundFromZip(package, soundFile);
     LoopSound(loop);
     _withSound = true;
 }
コード例 #14
0
        public bool InitializeSound(Mogre.Camera listener)
        {
            _listener = new FSLListener(listener);
            if (_initSound)
			    return true;

	        if (!FreeSL.fslInit(FreeSL.FSL_SOUND_SYSTEM.FSL_SS_DIRECTSOUND3D)) //Change if desire
			    return false;
            
	        _initSound = true;
	        return true;
        }
コード例 #15
0
 public void SetSound(string package, string soundFile, bool loop)
 {
     RemoveSound();
     if (File.Exists(package) == false)
     {
         throw new FileNotFoundException("The sound file at : " + soundFile + " does not exist.");
     }
     lock (SoundManager3D.Instance.LockSync)
     {
         FreeSL.fslLoadSoundFromZip(package, soundFile);
         LoopSound(loop);
     }
     _withSound = true;
 }
コード例 #16
0
 public void RemoveSound()
 {
     if (_withSound)
     {
         try{
             Console.WriteLine("Destroying: " + this._soundFile);
             FreeSL.fslSoundSetGain(_sound, 0.1f);
             FreeSL.fslFreeSound(_sound, true);
             _withSound = false;
         }
         catch (Exception ex) {
             LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "Exception while trying to remove sound: " + _soundFile + " (" + ex.Message + ") " + ex.StackTrace);
         }
     }
 }
コード例 #17
0
 public override void Update()
 {
     base.Update();
     // if (_renderable != null)
     try
     {
         FreeSL.fslSoundSetPosition(_sound,
                                    _renderable._getDerivedPosition().x,
                                    _renderable._getDerivedPosition().y,
                                    _renderable._getDerivedPosition().z);
     }
     catch (Exception e)
     {
         LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "Error while updating 3D sound object position: " + e.Message + e.StackTrace);
     }
 }
コード例 #18
0
 public virtual void Play()
 {
     if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
     {
         return;
     }
     // dzwieki powinny miec ustawiona lokalna glosnosc (niezalezna od muzyki) przed rozpoczeciem pierwszego odtworzenia
     //  SetGain(GetBaseGain() * EngineConfig.SoundVolume / 100.0f);
     ApplyGain();
     try{
         FreeSL.fslSoundPlay(_sound);
     }
     catch (Exception ex) {
         LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "Exception while trying to play sound: " + _soundFile + " (" + ex.Message + ") " + ex.StackTrace);
     }
     _shouldBePlaying = true;
     _playing         = true;
 }
コード例 #19
0
        public void SetSound(string soundFile, bool loop, bool streaming)
        {
            RemoveSound();
            if (System.IO.File.Exists(soundFile) == false)
            {
                throw new System.IO.FileNotFoundException("The sound file at : " + soundFile + " does not exist.");
            }
            if (streaming)
            {
                _sound = FreeSL.fslStreamSound(soundFile);
            }
            else
            {
                _sound = FreeSL.fslLoadSound(soundFile);
            }

            LoopSound(loop);
            _withSound = true;
        }
コード例 #20
0
        public bool IsPlaying()
        {
            if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
            {
                return(false);
            }
            //return FreeSL.fslSoundIsPlaying(_sound);

            // uwagi na bugi w streamingu w FreeSL trzeba zrobic workaround...

            if (FreeSL.fslSoundIsPlaying(_sound))
            {
                // nie wierzymy freeslowi
                return(_playing);
            }
            else
            {
                // wierzymy ze dzwiek sie zakonczyl
                _playing = false;
                return(false);
            }
        }
コード例 #21
0
 public void SetReferenceDistance(float distance)
 {
     FreeSL.fslSoundSetReferenceDistance(_sound, distance);
 }
コード例 #22
0
 public void SetMaxDistance(float distance)
 {
     FreeSL.fslSoundSetMaxDistance(_sound, distance);
 }
コード例 #23
0
 public bool IsPlaying()
 {
     return(FreeSL.fslSoundIsPlaying(_sound));
 }
コード例 #24
0
 public void Stop()
 {
     FreeSL.fslSoundStop(_sound);
 }
コード例 #25
0
 public void Play()
 {
     FreeSL.fslSoundPlay(_sound);
 }
コード例 #26
0
 public void Pause()
 {
     FreeSL.fslSoundPause(_sound);
 }
コード例 #27
0
 public void SetGain(float gain)
 {
     FreeSL.fslSoundSetGain(_sound, gain);
 }
コード例 #28
0
 public bool IsLooping()
 {
     return(FreeSL.fslSoundIsLooping(_sound));
 }
コード例 #29
0
 public void LoopSound(bool loop)
 {
     FreeSL.fslSoundSetLooping(_sound, loop);
 }
コード例 #30
0
 public bool IsPaused()
 {
     return(FreeSL.fslSoundIsPaused(_sound));
 }