예제 #1
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Spielt einen Ton ab (ogg)
 /// </summary>
 /// <param name="audiofile">Audiodatei (ogg)</param>
 /// <param name="playLooping">Looped playback?</param>
 /// <param name="volume">Lautstärke</param>
 /// <returns>ID des verwendeten Audiokanals</returns>
 public int SoundPlay(string audiofile, bool playLooping = false, float volume = 1.0f)
 {
     return(GLAudioEngine.SoundPlay(audiofile, playLooping, volume));
 }
예제 #2
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Stoppt die Wiedergabe aller Töne
 /// </summary>
 public void SoundStopAll()
 {
     GLAudioEngine.SoundStopAll();
 }
예제 #3
0
파일: World.cs 프로젝트: vardrop/KWEngine2
        internal void Dispose()
        {
            GLAudioEngine.SoundStopAll();
            lock (_gameObjects)
            {
                _gameObjects.Clear();
                _gameObjectsTBA.Clear();
                _gameObjectsTBR.Clear();
            }

            lock (_particleObjects)
            {
                _particleObjects.Clear();
                _particleObjectsTBA.Clear();
                _particleObjectsTBR.Clear();
            }

            lock (_hudObjects)
            {
                _hudObjects.Clear();
                _hudObjectsTBA.Clear();
                _hudObjectsTBR.Clear();
            }

            lock (_lightObjects)
            {
                _lightObjects.Clear();
                _lightObjectsTBA.Clear();
                _lightObjectsTBR.Clear();
            }

            lock (_explosionObjects)
            {
                _explosionObjects.Clear();
                _explosionObjectsTBA.Clear();
                _explosionObjectsTBR.Clear();
            }

            lock (KWEngine.Models)
            {
                List <string> removableModels = new List <string>();
                foreach (string m in KWEngine.Models.Keys)
                {
                    if (KWEngine.Models[m].AssemblyMode != SceneImporter.AssemblyMode.Internal)
                    {
                        KWEngine.Models[m].Dispose();
                        removableModels.Add(m);
                    }
                }
                foreach (string m in removableModels)
                {
                    KWEngine.Models.Remove(m);
                }
            }

            if (KWEngine.CustomTextures.ContainsKey(this))
            {
                Dictionary <string, int> dict = KWEngine.CustomTextures[this];
                foreach (int texId in dict.Values)
                {
                    GL.DeleteTexture(texId);
                }
                dict.Clear();
                KWEngine.CustomTextures.Remove(this);
            }
        }
예제 #4
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Stoppt einen bestimmten Ton
 /// </summary>
 /// <param name="audiofile">zu stoppender Ton</param>
 public void SoundStop(string audiofile)
 {
     GLAudioEngine.SoundStop(audiofile);
 }
예제 #5
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Stoppt den angegebenen Audiokanal
 /// </summary>
 /// <param name="sourceId">Lanalnummer</param>
 protected static void SoundStop(int sourceId)
 {
     GLAudioEngine.SoundStop(sourceId);
 }
예제 #6
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Ändert die Lautstärke eines Tons
 /// </summary>
 /// <param name="sourceId">id der Audiospur</param>
 /// <param name="gain">Lautstärke (0.0f bis 1.0f)</param>
 public static void SoundChangeGain(int sourceId, float gain)
 {
     GLAudioEngine.SoundChangeGain(sourceId, gain);
 }
예제 #7
0
파일: World.cs 프로젝트: vardrop/KWEngine2
 /// <summary>
 /// Lädt eine Audiodatei in den Arbeitsspeicher
 /// </summary>
 /// <param name="audiofile">Audiodatei</param>
 protected static void SoundPreload(string audiofile)
 {
     GLAudioEngine.SoundPreload(audiofile);
 }
예제 #8
0
 /// <summary>
 /// Stoppt den angegebenen Audiokanal
 /// </summary>
 /// <param name="sourceId">Lanalnummer</param>
 public static void SoundStop(int sourceId)
 {
     GLAudioEngine.SoundStop(sourceId);
 }
예제 #9
0
 /// <summary>
 /// Lädt eine Audiodatei in den Arbeitsspeicher
 /// </summary>
 /// <param name="audiofile">Audiodatei</param>
 public static void SoundPreload(string audiofile)
 {
     GLAudioEngine.SoundPreload(audiofile);
 }
예제 #10
0
파일: World.cs 프로젝트: KWEngine/KWEngine2
        internal void Dispose()
        {
            GLAudioEngine.SoundStopAll();
            lock (_gameObjects)
            {
                _gameObjects.Clear();
                _gameObjectsTBA.Clear();
                _gameObjectsTBR.Clear();
            }

            lock (_particleObjects)
            {
                _particleObjects.Clear();
                _particleObjectsTBA.Clear();
                _particleObjectsTBR.Clear();
            }

            lock (_hudObjects)
            {
                _hudObjects.Clear();
                _hudObjectsTBA.Clear();
                _hudObjectsTBR.Clear();
            }

            lock (_lightObjects)
            {
                CurrentWindow.InitializeFramebuffersLightsList();

                for (int i = 0; i < _lightObjects.Count; i++)
                {
                    if (_lightObjects[i].IsShadowCaster)
                    {
                        _lightObjects[i] = null;
                    }
                }
                _lightObjects.Clear();

                for (int i = 0; i < _lightObjectsTBA.Count; i++)
                {
                    if (_lightObjectsTBA[i].IsShadowCaster)
                    {
                        _lightObjectsTBA[i] = null;
                    }
                }
                _lightObjectsTBA.Clear();

                for (int i = 0; i < _lightObjectsTBR.Count; i++)
                {
                    if (_lightObjectsTBR[i].IsShadowCaster)
                    {
                        _lightObjectsTBR[i] = null;
                    }
                }
                _lightObjectsTBR.Clear();
            }

            lock (_explosionObjects)
            {
                _explosionObjects.Clear();
                _explosionObjectsTBA.Clear();
                _explosionObjectsTBR.Clear();
            }

            lock (KWEngine.Models)
            {
                List <string> removableModels = new List <string>();
                foreach (string m in KWEngine.Models.Keys)
                {
                    if (KWEngine.Models[m].AssemblyMode != SceneImporter.AssemblyMode.Internal)
                    {
                        KWEngine.Models[m].Dispose();
                        removableModels.Add(m);
                    }
                }
                foreach (string m in removableModels)
                {
                    KWEngine.Models.Remove(m);
                }
            }

            if (KWEngine.CustomTextures.ContainsKey(this))
            {
                Dictionary <string, int> dict = KWEngine.CustomTextures[this];
                foreach (int texId in dict.Values)
                {
                    GL.DeleteTexture(texId);
                }
                dict.Clear();

                KWEngine.CustomTextures.Remove(this);
            }
            GL.Flush();
            GL.Finish();
            GC.Collect(GC.MaxGeneration);
        }