/// <summary> /// Initialize the sound engine. /// </summary> /// <param name="tclient">The backing client.</param> public void Init(GameEngineBase tclient) { if (AudioInternal != null) { AudioInternal.Shutdown(); } if (Context != null) { Context.Dispose(); } Client = tclient; Context = new AudioContext(AudioContext.DefaultDevice, 0, 0, false, true); if (Client.EnforceAudio) { AudioInternal = new AudioEnforcer(); AudioInternal.Init(Context); Context = null; } else { Context.MakeCurrent(); } /*try * { * if (Microphone != null) * { * Microphone.StopEcho(); * } * Microphone = new MicrophoneHandler(this); * } * catch (Exception ex) * { * SysConsole.Output("Loading microphone handling", ex); * }*/ if (Effects != null) { foreach (SoundEffect sfx in Effects.Values) { sfx.Internal = -2; } } Effects = new Dictionary <string, SoundEffect>(); PlayingNow = new List <ActiveSound>(); //DeafLoop = GetSound("sfx/ringing/earring_loop"); }
public void Init(Client tclient, ClientCVar cvar) { if (AudioInternal != null) { AudioInternal.Shutdown(); } if (Context != null) { Context.Dispose(); } TheClient = tclient; CVars = cvar; Context = new AudioContext(AudioContext.DefaultDevice, 0, 0, false, true); if (TheClient.CVars.a_enforce.ValueB) { AudioInternal = new AudioEnforcer(); AudioInternal.Init(Context); Context = null; } else { Context.MakeCurrent(); } try { if (Microphone != null) { Microphone.StopEcho(); } Microphone = new MicrophoneHandler(this); } catch (Exception ex) { SysConsole.Output("Loading microphone handling", ex); } if (Effects != null) { foreach (SoundEffect sfx in Effects.Values) { sfx.Internal = -2; } } Effects = new Dictionary <string, SoundEffect>(); PlayingNow = new List <ActiveSound>(); DeafLoop = GetSound("sfx/ringing/earring_loop"); }