/// <summary> /// Releases any BASS resources being held by the player. /// </summary> private void Release() { if (stream != 0) { if (!BASSNative.StreamFree(stream)) { throw new BASSException(); } stream = 0; } if (sample != 0) { if (!BASSNative.SampleFree(sample)) { throw new BASSException(); } sample = 0; } channel = 0; promoted = false; playing = null; }
/// <inheritdoc/> protected override void Dispose(Boolean disposing) { if (Disposed) { return; } if (!BASSNative.SampleFree(sample)) { throw new BASSException(); } if (this.data != IntPtr.Zero) { Marshal.FreeHGlobal(this.data); } this.sample = 0; this.data = IntPtr.Zero; base.Dispose(disposing); }