/// <summary> /// Removes an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to remove from the <see cref="XAudio2" /> engine /// callback list. If the given interface is present more than once in the list, only the first instance in the list /// will be removed. /// </param> public override unsafe void UnregisterForCallbacks(IXAudio2EngineCallback callback) { IntPtr ptr = IntPtr.Zero; if (callback != null) { ptr = Marshal.GetComInterfaceForObject(callback, typeof(IXAudio2EngineCallback)); ptr = Utils.Utils.GetComInterfaceForObjectWithAdjustedVtable(ptr, 3, 3); } try { InteropCalls.CallI(UnsafeBasePtr, (void *)ptr, ((void **)(*(void **)UnsafeBasePtr))[7]); } finally { if (ptr != IntPtr.Zero) { //while patching the IUnknown-members out of the vtable, we've made a backup of the release pointer, //which gets called here -> the Marshal.Release method would call any function on index 2 of the vtable //we've patched there Utils.Utils.Release(ptr); //Marshal.Release(ptr); } } }
/// <summary> /// Adds an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to add to the <see cref="XAudio2" /> engine /// callback list. /// </param> /// <returns>HRESULT</returns> public override unsafe int RegisterForCallbacksNative(IXAudio2EngineCallback callback) { IntPtr ptr = IntPtr.Zero; if (callback != null) { ptr = Marshal.GetComInterfaceForObject(callback, typeof(IXAudio2EngineCallback)); ptr = Utils.Utils.GetComInterfaceForObjectWithAdjustedVtable(ptr, 3, 3); } return(InteropCalls.CallI(UnsafeBasePtr, ptr.ToPointer(), ((void **)(*(void **)UnsafeBasePtr))[6])); }
internal static unsafe void CallI6(void *_basePtr, IXAudio2EngineCallback callback, void *p) { throw new NotImplementedException(); }
/// <summary> /// Removes an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to remove from the <see cref="XAudio2" /> engine /// callback list. If the given interface is present more than once in the list, only the first instance in the list /// will be removed. /// </param> public unsafe override void UnregisterForCallbacks(IXAudio2EngineCallback callback) { InteropCalls.CallI6(UnsafeBasePtr, callback, ((void**) (*(void**) UnsafeBasePtr))[7]); }
/// <summary> /// Adds an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to add to the <see cref="XAudio2" /> engine /// callback list. /// </param> /// <returns>HRESULT</returns> public unsafe override int RegisterForCallbacksNative(IXAudio2EngineCallback callback) { IntPtr ptr = IntPtr.Zero; if (callback != null) { ptr = Marshal.GetComInterfaceForObject(callback, typeof (IXAudio2EngineCallback)); ptr = Utils.Utils.GetComInterfaceForObjectWithAdjustedVtable(ptr, 3, 3); } return InteropCalls.CallI(UnsafeBasePtr, ptr.ToPointer(), ((void**) (*(void**) UnsafeBasePtr))[6]); }
/// <summary> /// Removes an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to remove from the <see cref="XAudio2" /> engine /// callback list. If the given interface is present more than once in the list, only the first instance in the list /// will be removed. /// </param> public override unsafe void UnregisterForCallbacks(IXAudio2EngineCallback callback) { InteropCalls.CallI6(UnsafeBasePtr, callback, ((void **)(*(void **)UnsafeBasePtr))[7]); }
/// <summary> /// Removes an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to remove from the <see cref="XAudio2" /> engine /// callback list. If the given interface is present more than once in the list, only the first instance in the list /// will be removed. /// </param> public abstract void UnregisterForCallbacks(IXAudio2EngineCallback callback);
/// <summary> /// Adds an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to add to the <see cref="XAudio2" /> engine /// callback list. /// </param> /// <returns>HRESULT</returns> public abstract int RegisterForCallbacksNative(IXAudio2EngineCallback callback);
/// <summary> /// Adds an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to add to the <see cref="XAudio2" /> engine /// callback list. /// </param> public void RegisterForCallbacks(IXAudio2EngineCallback callback) { XAudio2Exception.Try(RegisterForCallbacksNative(callback), N, "RegisterForCallbacks"); }
/// <summary> /// Removes an <see cref="IXAudio2EngineCallback" /> from the <see cref="XAudio2" /> engine callback list. /// </summary> /// <param name="callback"> /// <see cref="IXAudio2EngineCallback" /> object to remove from the <see cref="XAudio2" /> engine /// callback list. If the given interface is present more than once in the list, only the first instance in the list /// will be removed. /// </param> public unsafe override void UnregisterForCallbacks(IXAudio2EngineCallback callback) { IntPtr ptr = IntPtr.Zero; if (callback != null) { ptr = Marshal.GetComInterfaceForObject(callback, typeof(IXAudio2EngineCallback)); ptr = Utils.Utils.GetComInterfaceForObjectWithAdjustedVtable(ptr, 3, 3); } try { InteropCalls.CallI(UnsafeBasePtr, (void*) ptr, ((void**) (*(void**) UnsafeBasePtr))[7]); } finally { if (ptr != IntPtr.Zero) { //while patching the IUnknown-members out of the vtable, we've made a backup of the release pointer, //which gets called here -> the Marshal.Release method would call any function on index 2 of the vtable //we've patched there Utils.Utils.Release(ptr); //Marshal.Release(ptr); } } }
internal static unsafe void CallI6(void* _basePtr, IXAudio2EngineCallback callback, void* p) { throw new NotImplementedException(); }