当前位置: 首页>>代码示例>>C#>>正文


C# AudioContext.MakeCurrent方法代码示例

本文整理汇总了C#中OpenTK.Audio.AudioContext.MakeCurrent方法的典型用法代码示例。如果您正苦于以下问题:C# AudioContext.MakeCurrent方法的具体用法?C# AudioContext.MakeCurrent怎么用?C# AudioContext.MakeCurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenTK.Audio.AudioContext的用法示例。


在下文中一共展示了AudioContext.MakeCurrent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Sound

        //int NextPlayingBuffer;
        //int numPLayedBuffer;
        /// <summary>
        /// Constructor for Sound class
        /// </summary>
        /// <param name="StartThread">Are we starting the sound thread?</param>
        public Sound(bool StartThread)
        {
            disposed = false;
            SoundList = new Dictionary<string, SoundType>();
            context = new AudioContext(); // default audio device
            lock (context)
            {
                context.MakeCurrent();
            }
            //XRamExtension XRam = new XRamExtension();

            /*SoundBuffers = AL.GenBuffers(4); // number of buffers
            SoundSource = AL.GenSource();
            SoundStreamSource = AL.GenSource();*/
            RunSoundThread = true;

            isPlaying = false;
            NowPlayingName = string.Empty;
            //NowPlayingBuffer = -1;
            NextPlayingName = string.Empty;
            //NextPlayingBuffer = -1;
            //numPLayedBuffer = 0; //??
            /*OpenTK.Vector3 v3 = new OpenTK.Vector3(1, 1, 1);
            AL.Source(AL.GenBuffer(), ALSource3f.Position, ref v3);*/

            //Debug.WriteLine(AL.Get(ALGetString.Version));

            tr = new System.Threading.Thread(new ThreadStart(PlayThread));
            if (StartThread)
            {
                RunThread();
            }
        }
开发者ID:wach78,项目名称:Turbofest,代码行数:39,代码来源:Sound.cs

示例2: Init

 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");
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:33,代码来源:SoundEngine.cs

示例3: Init

        public static void Init()
        {
            ac = new AudioContext();
            ac.CheckErrors();
            ac.MakeCurrent();
            eax_sup = ac.SupportsExtension("EAX3.0");
            if (eax_sup)
                xram = new XRamExtension();

            mp3_sup = ac.SupportsExtension("AL_EXT_mp3");
            devices = Alc.GetString(IntPtr.Zero, AlcGetStringList.AllDevicesSpecifier);
        }
开发者ID:Tarcontar,项目名称:SageCS,代码行数:12,代码来源:AudioSystem.cs

示例4: Init

        public bool Init()
        {
            if (_Initialized)
                CloseAll();

            AC = new AudioContext();
            AC.MakeCurrent();
            

            closeproc = new CLOSEPROC(close_proc);
            _Initialized = true;

            _Streams = new List<AudioStreams>();
            return true;
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:15,代码来源:COpenALPlay.cs

示例5: Init

		/// <summary>
		/// Audio subsystem initialization<para/>
		/// Инициализация аудио подсистемы
		/// </summary>
		public static void Init() {

			// Creating context
			// Создание контекста
			Context = new AudioContext();
			Context.MakeCurrent();

			// Creating streaming sources list
			// Создание списка стримящихся источников
			Streaming = new List<StreamingAudio>();

			thread = new Thread(ThreadedUpdate);
			thread.IsBackground = true;
			thread.Priority = ThreadPriority.BelowNormal;
			//thread.Start();

			Dev.Console.Log("[AudioManager] Audio initialized");
		}
开发者ID:clashbyte,项目名称:openvice,代码行数:22,代码来源:AudioManager.cs

示例6: SDL2GameView

		public SDL2GameView (string title, int width, int height, bool fullscreen = false, bool vsync = true, 
		                     int x = SDL.SDL_WINDOWPOS_CENTERED, int y = SDL.SDL_WINDOWPOS_CENTERED) {
			_refCount++;
			_width = width;
			_height = height;

			_frameArgs = new FrameArgs();
			_frameArgs.Enqueue(new Start(new Vector2(_width, _height), 1.0f));
			_frameArgs.Enqueue(new Resize(new Vector2(_width, _height), 1.0f));
			_sdlEvents = new ConcurrentQueue<SDL.SDL_Event>();

			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 2);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 1);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL.SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DEPTH_SIZE, 24);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_MULTISAMPLEBUFFERS, 1);
			SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_MULTISAMPLESAMPLES, 4);

			_window = SDL.SDL_CreateWindow(
				title,
				x, y,
				width, height,
				SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL
				| (fullscreen ? SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN : 0)
			);
			if (_window == IntPtr.Zero)
				throw new SDL2Exception();

			if (_alContext == null) {
				_alContext = new AudioContext();
				_alContext.MakeCurrent();
			}

			if(vsync)
				SDL.SDL_GL_SetSwapInterval(1);
			_windowId = SDL.SDL_GetWindowID(_window);
		}
开发者ID:jpernst,项目名称:GameStack,代码行数:40,代码来源:SDL2GameView.cs

示例7: AudioDevice

        static AudioDevice()
        {
            // Create audio context (which create the ALCdevice and ALCcontext)
            _context = new AudioContext();
            _context.MakeCurrent();

            // Configure default state of listener
            _listenerVolume = 100f;
            _listenerPosition  = new Vector3(0f, 0f,  0f);
            _listenerDirection = new Vector3(0f, 0f, -1f);
            _listenerUpVector  = new Vector3(0f, 1f,  0f);


            // Apply the listener properties the user might have set
            float[] orientation = {_listenerDirection.X,
                                   _listenerDirection.Y,
                                   _listenerDirection.Z,
                                   _listenerUpVector.X,
                                   _listenerUpVector.Y,
                                   _listenerUpVector.Z};

            ALChecker.Check(() => AL.Listener(ALListenerf.Gain, _listenerVolume * 0.01f));
            ALChecker.Check(() => AL.Listener(ALListener3f.Position, _listenerPosition.X, _listenerPosition.Y, _listenerPosition.Z));
            ALChecker.Check(() => AL.Listener(ALListenerfv.Orientation, ref orientation));

            // Dispose Audio Device when exiting application
            AppDomain.CurrentDomain.ProcessExit += (s, e) => Free();
        }
开发者ID:SirusDoma,项目名称:Cgen.Audio,代码行数:28,代码来源:AudioDevice.cs


注:本文中的OpenTK.Audio.AudioContext.MakeCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。