예제 #1
0
 public override void BeginInterruption(AVAudioPlayer player)
 {
     if (cbBeginInterruption != null)
     {
         cbBeginInterruption(player, EventArgs.Empty);
     }
 }
예제 #2
0
 public override void DecoderError(AVAudioPlayer player, NSError error)
 {
     if (cbDecoderError != null)
     {
         cbDecoderError(player, new AVErrorEventArgs(error));
     }
 }
예제 #3
0
 public override void FinishedPlaying(AVAudioPlayer player, bool flag)
 {
     if (cbFinishedPlaying != null)
     {
         cbFinishedPlaying(player, new AVStatusEventArgs(flag));
     }
     if (player.Handle == IntPtr.Zero)
     {
         throw new ObjectDisposedException("player", "the player object was Dispose()d during the callback, this has corrupted the state of the program");
     }
 }
예제 #4
0
        public static AVAudioPlayer FromData(NSData data)
        {
            unsafe {
                var ap = new AVAudioPlayer(data, IntPtr.Zero);
                if (ap.Handle == IntPtr.Zero)
                {
                    return(null);
                }

                return(ap);
            }
        }
예제 #5
0
        public static AVAudioPlayer FromUrl(NSUrl url)
        {
            unsafe {
                var ap = new AVAudioPlayer(url, IntPtr.Zero);
                if (ap.Handle == IntPtr.Zero)
                {
                    return(null);
                }

                return(ap);
            }
        }
예제 #6
0
        public static AVAudioPlayer FromData(NSData data, out NSError error)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr)(&errhandle);

                var ap = new AVAudioPlayer(data, ptrtohandle);
                if (ap.Handle == IntPtr.Zero)
                {
                    error = (NSError)Runtime.GetNSObject(errhandle);
                    return(null);
                }
                else
                {
                    error = null;
                }
                return(ap);
            }
        }