Ejemplo n.º 1
0
 public static MusicTrack FromSequence(MusicSequence sequence)
 {
     if (sequence == null)
     {
         throw new ArgumentNullException("sequence");
     }
     return(sequence.CreateTrack());
 }
Ejemplo n.º 2
0
 public static MusicTrack?FromSequence(MusicSequence sequence)
 {
     if (sequence is null)
     {
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(sequence));
     }
     return(sequence.CreateTrack());
 }
Ejemplo n.º 3
0
 public static MusicTrack?FromSequence(MusicSequence sequence)
 {
     if (sequence is null)
     {
         throw new ArgumentNullException(nameof(sequence));
     }
     return(sequence.CreateTrack());
 }
Ejemplo n.º 4
0
 protected virtual void Dispose(bool disposing)
 {
     if (handle != IntPtr.Zero)
     {
         if (owns)
         {
             MusicSequenceDisposeTrack(sequence.Handle, handle);
         }
         handle = IntPtr.Zero;
     }
     sequence = null;
 }
Ejemplo n.º 5
0
        static void UserCallbackProxy(IntPtr inClientData, IntPtr inSequence, IntPtr inTrack, double inEventTime, IntPtr inEventData, double inStartSliceBeat, double inEndSliceBeat)
        {
            MusicSequenceUserCallback userCallback;

            lock (userCallbackHandles)
                userCallbackHandles.TryGetValue(inSequence, out userCallback);

            if (userCallback != null)
            {
                var userEventData = new MusicEventUserData(inEventData);
                var musicSequence = MusicSequence.Lookup(inSequence);
                var musicTrack    = new MusicTrack(musicSequence, inTrack, false);

                userCallback(musicTrack, inEventTime, userEventData, inStartSliceBeat, inEndSliceBeat);
            }
        }
Ejemplo n.º 6
0
 internal static MusicSequence Lookup(IntPtr handle)
 {
     lock (sequenceMap){
         if (sequenceMap.TryGetValue(handle, out var weakRef))
         {
             var target = weakRef.Target;
             if (target is not null)
             {
                 return((MusicSequence)target);
             }
             sequenceMap.Remove(handle);
         }
         var ms = new MusicSequence(handle, false);
         sequenceMap [handle] = new WeakReference(ms);
         return(ms);
     }
 }
Ejemplo n.º 7
0
 internal MusicTrack(MusicSequence sequence, IntPtr handle, bool owns)
 {
     this.sequence = sequence;
     this.handle   = handle;
     this.owns     = owns;
 }
Ejemplo n.º 8
0
 internal MusicTrack(MusicSequence sequence, IntPtr handle, bool owns)
     : base(handle, owns)
 {
     this.sequence = sequence;
 }