internal static void CheckForException(IntPtrAction funcMethod) { IntPtr e = IntPtr.Zero; funcMethod.Invoke(ref e); WrapException.CheckAnyException(ref e); }
protected override bool ReleaseHandle() { WrapException.CheckForException((ref IntPtr e) => auxiliaryEffectSlot_destroyPointer(handle, ref e)); SetHandleAsInvalid(); handle = IntPtr.Zero; return(true); }
internal static R CheckForException <R>(IntPtrFunc <R> funcMethod) { IntPtr e = IntPtr.Zero; R result = funcMethod.Invoke(ref e); WrapException.CheckAnyException(ref e); return(result); }
public static void MakeThreadCurrent(Context ctx) { if (ctx == null) { WrapException.CheckForException((ref IntPtr e) => context_makeThreadCurrent(IntPtr.Zero, ref e)); } else if (ctx.IsInvalid == false && ctx.IsClosed == false) { WrapException.CheckForException((ref IntPtr e) => context_makeThreadCurrent(ctx.DangerousGetHandle(), ref e)); } }
public Source[] ToSources() { var list = new List <Source>(); UInt64 size = WrapException.CheckForException((ref IntPtr e) => sourceVector_getSize(handle, ref e)); for (UInt64 i = 0; i < size; ++i) { list.Add(new Source(WrapException.CheckForException((ref IntPtr e) => sourceVector_getAt(handle, i, ref e)), true)); } return(list.ToArray()); }
private static void CheckAnyException(ref IntPtr exceptionPointer) { if (exceptionPointer != IntPtr.Zero) { using (var exception = new WrapException(exceptionPointer, true)) { var type = exception.Type(); var text = $"{type}: {exception.What()}. {exception.Comment()}"; switch (type) { case "std::runtime_error": throw new InvalidOperationException(text); default: throw new Exception(text); } } } }
public static Context GetThreadCurrent() { return WrapException.CheckForException((ref IntPtr e) => context_getThreadCurrent(ref e)); }
public void Resume() { WrapException.CheckForException((ref IntPtr e) => source_resume(handle, ref e)); }
public void Pause() { WrapException.CheckForException((ref IntPtr e) => source_pause(handle, ref e)); }
public void FadeOutToStop(float gain, UInt64 duration) { WrapException.CheckForException((ref IntPtr e) => source_fadeOutToStop(handle, gain, duration, ref e)); }
public void Play(Buffer buffer) { WrapException.CheckForException((ref IntPtr e) => source_play(handle, buffer, ref e)); }
public void Destroy() { WrapException.CheckForException((ref IntPtr e) => auxiliaryEffectSlot_destroy(handle, ref e)); }
public void ApplyEffect(Effect effect) { WrapException.CheckForException((ref IntPtr e) => auxiliaryEffectSlot_applyEffect(handle, effect, ref e)); }
public void Destroy() { WrapException.CheckForException((ref IntPtr e) => effect_destroy(handle, ref e)); }
public void SetChorusProperties(EFXChorusProperties props) { WrapException.CheckForException((ref IntPtr e) => effect_setChorusProperties(handle, ref props, ref e)); }
public Device GetDevice() { return WrapException.CheckForException((ref IntPtr e) => context_getDevice(handle, ref e)); }
public void EndBatch() { WrapException.CheckForException((ref IntPtr e) => context_endBatch(handle, ref e)); }
public void Stop() { WrapException.CheckForException((ref IntPtr e) => source_stop(handle, ref e)); }