Esempio n. 1
0
        public void AddListener(AudioQueueProperty id, AudioQueuePropertyChanged callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (listeners == null)
            {
                listeners = new Hashtable();
            }

            lock (listeners){
                var a = (ArrayList)listeners [id];
                if (a == null)
                {
                    AudioQueueAddPropertyListener(handle, id, property_changed, GCHandle.ToIntPtr(gch));
                    listeners [id] = a = new ArrayList();
                }
                a.Add(callback);
            }
        }
Esempio n. 2
0
 public void RemoveListener(AudioQueueProperty id, AudioQueuePropertyChanged callback)
 {
     if (callback == null)
     {
         throw new ArgumentNullException("callback");
     }
     if (listeners == null)
     {
         return;
     }
     lock (listeners){
         var a = (ArrayList)listeners [id];
         if (a == null)
         {
             return;
         }
         a.Remove(callback);
         if (a.Count == 0)
         {
             AudioQueueRemovePropertyListener(handle, id, property_changed, GCHandle.ToIntPtr(gch));
         }
     }
 }