Example #1
0
 public void Init(Client tclient, ClientCVar cvar)
 {
     if (Context != null)
     {
         Context.Dispose();
     }
     TheClient = tclient;
     CVars     = cvar;
     Context   = new AudioContext(AudioContext.DefaultDevice, 0, 0, false, true);
     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>();
     Noise      = LoadSound(new DataStream(Convert.FromBase64String(NoiseDefault.NoiseB64)), "noise");
 }
Example #2
0
 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");
 }