示例#1
0
 public static MusicTrack FromSequence(MusicSequence sequence)
 {
     if (sequence == null)
     {
         throw new ArgumentNullException("sequence");
     }
     return(sequence.CreateTrack());
 }
示例#2
0
 public static MusicTrack?FromSequence(MusicSequence sequence)
 {
     if (sequence is null)
     {
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(sequence));
     }
     return(sequence.CreateTrack());
 }
示例#3
0
 public static MusicTrack?FromSequence(MusicSequence sequence)
 {
     if (sequence is null)
     {
         throw new ArgumentNullException(nameof(sequence));
     }
     return(sequence.CreateTrack());
 }
示例#4
0
 protected virtual void Dispose(bool disposing)
 {
     if (handle != IntPtr.Zero)
     {
         if (owns)
         {
             MusicSequenceDisposeTrack(sequence.Handle, handle);
         }
         handle = IntPtr.Zero;
     }
     sequence = null;
 }
示例#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);
            }
        }
示例#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);
     }
 }
示例#7
0
 internal MusicTrack(MusicSequence sequence, IntPtr handle, bool owns)
 {
     this.sequence = sequence;
     this.handle   = handle;
     this.owns     = owns;
 }
示例#8
0
 internal MusicTrack(MusicSequence sequence, IntPtr handle, bool owns)
     : base(handle, owns)
 {
     this.sequence = sequence;
 }