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