public void Clear() { DestroyTexture(); if (buffer != IntPtr.Zero) { NativeUtility.Free(buffer); buffer = IntPtr.Zero; } size = Vector2I.Zero; }
protected unsafe override void OnShutdown() { if (directInputDevice != null) { IDirectInputDevice8.Unacquire(directInputDevice); IDirectInputDevice8.Release(directInputDevice); directInputDevice = null; } if (deviceDataBuffer != IntPtr.Zero) { NativeUtility.Free(deviceDataBuffer); deviceDataBuffer = IntPtr.Zero; } }
public void Dispose() { ClearTask(); if (imageData != IntPtr.Zero) { NativeUtility.Free(imageData); imageData = IntPtr.Zero; } texture?.Dispose(); texture = null; viewport = null; textureRead?.Dispose(); textureRead = null; }
unsafe internal protected override void PreDetachVirtualChannel() { OpenALSoundWorld.criticalSection.Enter(); Al.alSourceStop(alSource); OpenALSoundWorld.CheckError(); //never delete buffer because cannot delete. maybe need some time to free buffer internally ////delete al data buffers //if( streamAlDataBuffers != null ) //{ // fixed ( int* pAlDataBuffers = streamAlDataBuffers ) // Al.alDeleteBuffers( streamAlDataBuffers.Length, pAlDataBuffers ); // OpenALSoundWorld.CheckError(); // streamAlDataBuffers = null; //} if (currentSound is OpenALDataBufferSound) { if (currentSound is OpenALFileStreamSound) { OpenALSoundWorld.fileStreamRealChannels.Remove(this); } if (streamBuffer != null) { NativeUtility.Free((IntPtr)streamBuffer); streamBuffer = null; streamBufferSize = 0; } } fileStreamVorbisFile?.Dispose(); fileStreamVorbisFile = null; fileStreamVorbisFileReader?.Dispose(); fileStreamVorbisFileReader = null; Al.alSourcei(alSource, Al.AL_BUFFER, 0); OpenALSoundWorld.CheckError(); currentSound = null; OpenALSoundWorld.criticalSection.Leave(); }