本文整理汇总了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();
}
}
示例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");
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}
示例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();
}