public void Dispose() { if (!disposed) { devicecount--; disposed = true; GC.SuppressFinalize(this); try { Alc.MakeContextCurrent(new ContextHandle(IntPtr.Zero)); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body { } if (_hContext.Handle != IntPtr.Zero) { Alc.DestroyContext(_hContext); } if (_hDevice != IntPtr.Zero) { Alc.CloseDevice(_hDevice); } } }
public void Dispose() { Stop(); AL.DeleteSource(SourceHash); AL.DeleteBuffer(BufferHash); Alc.DestroyContext(_handle); }
private void Dispose(bool manual) { if (!disposed) { if (this.IsCurrent) { this.IsCurrent = false; } if (context_handle != ContextHandle.Zero) { available_contexts.Remove(context_handle); Alc.DestroyContext(context_handle); } if (Device != IntPtr.Zero) { Alc.CloseDevice(Device); } if (manual) { } disposed = true; } }
public OpenAlAudioManager(ContentManager content, string audioDirectoryName) { if (content == null) { throw new ArgumentNullException("content"); } if (audioDirectoryName == null) { throw new ArgumentNullException("audioDirectoryName"); } _content = content; _audioDirectoryName = audioDirectoryName; // destroy previous context, specifically because monogame creates one var context = Alc.GetCurrentContext(); Alc.DestroyContext(context); _context = new AudioContext(); _context.MakeCurrent(); _efx = new EffectsExtension(); _sounds = new Dictionary <string, Sound>(); _effects = new Dictionary <string, AudioEffect>(); if (_efx.IsInitialized) { _effects.Add("lowpassfilter", new LowPassFilterAudioEffect(_efx)); } }
private void _shutdownAudio() { foreach (var source in _audioSources.Values.ToArray()) { if (source.TryGetTarget(out var target)) { target.Dispose(); } } foreach (var source in _bufferedAudioSources.Values.ToArray()) { if (source.TryGetTarget(out var target)) { target.Dispose(); } } if (_openALContext != ContextHandle.Zero) { Alc.DestroyContext(_openALContext); } if (_openALDevice != IntPtr.Zero) { Alc.CloseDevice(_openALDevice); } }
protected void Dispose(bool bManagedDispose) { this.e出力デバイス = ESoundDeviceType.Unknown; // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ) if (bManagedDispose) { #region [ 経緯時間計測用サウンドバッファを解放。] //----------------- if (this.sd経過時間計測用サウンドバッファ != null) { this.sd経過時間計測用サウンドバッファ.tサウンドを停止する(); C共通.tDisposeする(ref this.sd経過時間計測用サウンドバッファ); } //----------------- #endregion #region [ 単位繰り上げ用スレッド停止。] //----------------- if (this.th経過時間測定用スレッド != null) { this.th経過時間測定用スレッド.Abort(); this.th経過時間測定用スレッド = null; } //----------------- #endregion C共通.tDisposeする(this.tmシステムタイマ); } if (ctimer != null) { C共通.tDisposeする(ref this.ctimer); } //使わなくなったデータをクリーンアップ Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(this.context); Alc.CloseDevice(this.device); }
protected void Dispose(bool bManagedDispose) { this.eOutputDevice = ESoundDeviceType.Unknown; // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ) if (bManagedDispose) { #region [ 経緯時間計測用サウンドバッファを解放。] //----------------- if (this.sd経過時間計測用サウンドバッファ != null) { this.sd経過時間計測用サウンドバッファ.tサウンドを停止する(); CCommon.tDispose(ref this.sd経過時間計測用サウンドバッファ); } //----------------- #endregion CCommon.tDispose(this.tmSystemTimer); } if (ctimer != null) { CCommon.tDispose(ref this.ctimer); } //使わなくなったデータをクリーンアップ Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(this.context); Alc.CloseDevice(this.device); }
public void Dispose() { AL.DeleteSources(1, ref _source); Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(_context); Alc.CloseDevice(_device); }
internal static void Cleanup() { Window.Close(); GraphicsContext.Dispose(); Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(AudioContext); Alc.CloseDevice(AudioDevice); }
protected override void DisposeBase() { if (object.ReferenceEquals(current, this)) { Alc.MakeContextCurrent(ContextHandle.Zero); } current = null; Alc.DestroyContext(Handle); handle = ContextHandle.Zero; }
void shutDownAudio() { ContextHandle alContext = Alc.GetCurrentContext(); IntPtr alDevice = Alc.GetContextsDevice(alContext); ContextHandle emptyContext = ContextHandle.Zero; Alc.MakeContextCurrent(emptyContext); Alc.DestroyContext(alContext); Alc.CloseDevice(alDevice); }
public void CleanAndExit() { ContextHandle alContext = Alc.GetCurrentContext(); IntPtr alDevice = Alc.GetContextsDevice(alContext); ContextHandle emptyContext = ContextHandle.Zero; Alc.MakeContextCurrent(emptyContext); Alc.DestroyContext(alContext); Alc.CloseDevice(alDevice); }
public static void Shutdown() { for (int i = 0; i < _maxSources; i++) { _sources[i].Source.Dispose(); _sources[i].Owner = null; } Alc.DestroyContext(_context); Alc.CloseDevice(_device); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var device = Alc.OpenDevice(null); var context = Alc.CreateContext(device, (int[])null); Alc.MakeContextCurrent(context); Application.Run(new MainWindow()); Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero); Alc.DestroyContext(context); Alc.CloseDevice(device); }
public void Dispose() { Device = Alc.GetContextsDevice(context); Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero); if (context != OpenTK.ContextHandle.Zero) { Alc.DestroyContext(context); } if (Device != IntPtr.Zero) { Alc.CloseDevice(Device); } }
private void CleanUpOpenAL() { Alc.MakeContextCurrent(ContextHandle.Zero); if (_context != ContextHandle.Zero) { Alc.DestroyContext(_context); _context = ContextHandle.Zero; } if (_device != IntPtr.Zero) { Alc.CloseDevice(_device); _device = IntPtr.Zero; } }
public void Dispose() { Alc.MakeContextCurrent(ContextHandle.Zero); if (alContext != ContextHandle.Zero) { Alc.DestroyContext(alContext); alContext = ContextHandle.Zero; } if (alDevice != IntPtr.Zero) { Alc.CloseDevice(alDevice); alDevice = IntPtr.Zero; } Instance = null; }
// deinitialize internal static void Deinitialize() { if (OpenAlContext != ContextHandle.Zero) { SoundManager.StopAllSounds(true); SoundManager.UnuseAllSoundsBuffers(); Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(OpenAlContext); OpenAlContext = ContextHandle.Zero; } if (OpenAlDevice != IntPtr.Zero) { Alc.CloseDevice(OpenAlDevice); OpenAlDevice = IntPtr.Zero; } }
public void Dispose() { if (_context != ContextHandle.Zero) { Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(_context); } _context = ContextHandle.Zero; if (_device != IntPtr.Zero) { Alc.CloseDevice(_device); } _device = IntPtr.Zero; }
/// <summary>Deinitializes audio.</summary> internal static void Deinitialize() { StopAllSounds(); UnloadAllBuffers(); if (OpenAlContext != ContextHandle.Zero) { Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(OpenAlContext); OpenAlContext = ContextHandle.Zero; } if (OpenAlDevice != IntPtr.Zero) { Alc.CloseDevice(OpenAlDevice); OpenAlDevice = IntPtr.Zero; } }
static void Dispose(ref IntPtr device, ref ContextHandle context) { if (context != ContextHandle.Zero) { Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(context); } context = ContextHandle.Zero; if (device != IntPtr.Zero) { Alc.CloseDevice(device); } device = IntPtr.Zero; }
protected override void Dispose(bool disposing) { _watchThread.Terminate(); if (_context != IntPtr.Zero) { var currentContext = Alc.GetCurrentContext(); if (currentContext == _context) { Alc.MakeContextCurrent(IntPtr.Zero); } Alc.DestroyContext(_context); } _context = IntPtr.Zero; }
public static void Teardown() { foreach (object o in Sounds.Keys) { Sound sound = (Sound)Sounds[o]; AL.SourceStop(sound.SourceId); AL.DeleteSource(sound.SourceId); AL.DeleteBuffer(sound.BufferId); } if (Alc.MakeContextCurrent(ContextHandle.Zero)) { Alc.DestroyContext(AudioCtx); if (Alc.CloseDevice(AudioDevice)) { } } }
/// <summary> /// /// </summary> private void CleanUpOpenAl() { Alc.MakeContextCurrent(NullContext); if (_context != NullContext) { Alc.DestroyContext(_context); _context = NullContext; } if (_device != IntPtr.Zero) { Alc.CloseDevice(_device); _device = IntPtr.Zero; } _bSoundAvailable = false; }
private void Dispose(bool force) { if (INTERNAL_soundAvailable || force) { Alc.MakeContextCurrent(ContextHandle.Zero); if (_context != ContextHandle.Zero) { Alc.DestroyContext(_context); _context = ContextHandle.Zero; } if (_device != IntPtr.Zero) { Alc.CloseDevice(_device); _device = IntPtr.Zero; } INTERNAL_soundAvailable = false; } }
public override void Dispose() { base.Dispose(); ///Dispose if (context != ContextHandle.Zero) { Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(context); } context = ContextHandle.Zero; if (device != IntPtr.Zero) { Alc.CloseDevice(device); } device = IntPtr.Zero; }
public void Dispose() { if (Disabled) { return; } lock (playingChannels) { for (int i = 0; i < playingChannels.Length; i++) { for (int j = 0; j < playingChannels[i].Length; j++) { if (playingChannels[i][j] != null) { playingChannels[i][j].Dispose(); } } } } if (streamingThread != null && !streamingThread.ThreadState.HasFlag(ThreadState.Stopped)) { streamingThread.Join(); } for (int i = loadedSounds.Count - 1; i >= 0; i--) { loadedSounds[i].Dispose(); } sourcePools[(int)SourcePoolIndex.Default]?.Dispose(); sourcePools[(int)SourcePoolIndex.Voice]?.Dispose(); if (!Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero)) { throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")"); } Alc.DestroyContext(alcContext); if (!Alc.CloseDevice(alcDevice)) { throw new Exception("Failed to close ALC device!"); } }
public void Dispose() { lock (playingChannels) { for (int i = 0; i < SOURCE_COUNT; i++) { if (playingChannels[i] != null) { playingChannels[i].Dispose(); } } } if (streamingThread != null && streamingThread.ThreadState == ThreadState.Running) { streamingThread.Join(); } for (int i = loadedSounds.Count - 1; i >= 0; i--) { loadedSounds[i].Dispose(); } for (int i = 0; i < SOURCE_COUNT; i++) { AL.DeleteSource(ref alSources[i]); ALError alError = AL.GetError(); if (alError != ALError.NoError) { throw new Exception("Failed to delete alSources[" + i.ToString() + "]: " + AL.GetErrorString(alError)); } } if (!Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero)) { throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")"); } Alc.DestroyContext(alcContext); if (!Alc.CloseDevice(alcDevice)) { throw new Exception("Failed to close ALC device!"); } }
public void Dispose() { if (Disabled) { return; } ReleaseResources(false); if (!Alc.MakeContextCurrent(IntPtr.Zero)) { throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")"); } Alc.DestroyContext(alcContext); if (!Alc.CloseDevice(alcDevice)) { throw new Exception("Failed to close ALC device!"); } }
internal static void Destroy() { // 全てのゲームオブジェクトを削除する DestroyGameObjects((o) => true); // 全てのアセットを削除する if (assets != null) { foreach (var a in assets) { a.Unload(); } assets = null; } Bullet.Destroy(); Alc.MakeContextCurrent(ContextHandle.Zero); Alc.DestroyContext(ALContext); Alc.CloseDevice(ALDevice); Rift.Dispose(); }