internal static void CheckForException(IntPtrAction funcMethod)
        {
            IntPtr e = IntPtr.Zero;

            funcMethod.Invoke(ref e);
            WrapException.CheckAnyException(ref e);
        }
Exemplo n.º 2
0
 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);
        }
Exemplo n.º 4
0
 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));
     }
 }
Exemplo n.º 5
0
        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);
                    }
                }
            }
        }
Exemplo n.º 7
0
 public static Context GetThreadCurrent()
 {
     return WrapException.CheckForException((ref IntPtr e) => context_getThreadCurrent(ref e));
 }
Exemplo n.º 8
0
 public void Resume()
 {
     WrapException.CheckForException((ref IntPtr e) => source_resume(handle, ref e));
 }
Exemplo n.º 9
0
 public void Pause()
 {
     WrapException.CheckForException((ref IntPtr e) => source_pause(handle, ref e));
 }
Exemplo n.º 10
0
 public void FadeOutToStop(float gain, UInt64 duration)
 {
     WrapException.CheckForException((ref IntPtr e) => source_fadeOutToStop(handle, gain, duration, ref e));
 }
Exemplo n.º 11
0
 public void Play(Buffer buffer)
 {
     WrapException.CheckForException((ref IntPtr e) => source_play(handle, buffer, ref e));
 }
Exemplo n.º 12
0
 public void Destroy()
 {
     WrapException.CheckForException((ref IntPtr e) => auxiliaryEffectSlot_destroy(handle, ref e));
 }
Exemplo n.º 13
0
 public void ApplyEffect(Effect effect)
 {
     WrapException.CheckForException((ref IntPtr e) => auxiliaryEffectSlot_applyEffect(handle, effect, ref e));
 }
Exemplo n.º 14
0
 public void Destroy()
 {
     WrapException.CheckForException((ref IntPtr e) => effect_destroy(handle, ref e));
 }
Exemplo n.º 15
0
 public void SetChorusProperties(EFXChorusProperties props)
 {
     WrapException.CheckForException((ref IntPtr e) => effect_setChorusProperties(handle, ref props, ref e));
 }
Exemplo n.º 16
0
 public Device GetDevice()
 {
     return WrapException.CheckForException((ref IntPtr e) => context_getDevice(handle, ref e));
 }
Exemplo n.º 17
0
 public void EndBatch()
 {
     WrapException.CheckForException((ref IntPtr e) => context_endBatch(handle, ref e));
 }
Exemplo n.º 18
0
 public void Stop()
 {
     WrapException.CheckForException((ref IntPtr e) => source_stop(handle, ref e));
 }