public static AudioSessionErrors AddListener(AudioSessionProperty property, PropertyListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } if (listeners == null) { listeners = new Dictionary <AudioSessionProperty, List <PropertyListener> > (); } List <PropertyListener> a; if (!listeners.TryGetValue(property, out a)) { listeners [property] = a = new List <PropertyListener> (); } a.Add(listener); if (a.Count == 1) { return(AudioSessionAddPropertyListener(property, Listener, IntPtr.Zero)); } return(AudioSessionErrors.None); }
public static void AddListener(AudioSessionProperty property, PropertyListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } if (listeners == null) { listeners = new Hashtable(); } ArrayList a = (ArrayList)listeners [property]; if (a == null) { listeners [property] = a = new ArrayList(); } a.Add(listener); if (a.Count == 1) { AudioSessionAddPropertyListener(property, Listener, IntPtr.Zero); } }
static void SetDouble (AudioSessionProperty property, double val) { unsafe { int k = AudioSessionSetProperty (property, 8, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); } }
static void SetInt (AudioSessionProperty property, int val) { unsafe { int k = AudioSessionSetProperty (property, sizeof (int), (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); } }
static void SetFloat (AudioSessionProperty property, float val) { unsafe { int k = AudioSessionSetProperty (property, 4, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); } }
static float GetFloat (AudioSessionProperty property) { unsafe { float val = 0; int size = 4; int k = AudioSessionGetProperty (property, ref size, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); return val; } }
static void AddListenerEvent (AudioSessionProperty property, object handler, PropertyListener listener) { if (strongListenerHash == null) Interlocked.CompareExchange (ref strongListenerHash, new Hashtable (), null); lock (strongListenerHash) { strongListenerHash [handler] = listener; } AddListener (property, listener); }
static double GetDouble (AudioSessionProperty property) { unsafe { double val = 0; int size = 8; int k = AudioSessionGetProperty (property, ref size, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); return val; } }
static void Listener (IntPtr userData, AudioSessionProperty prop, int size, IntPtr data) { ArrayList a = (ArrayList) listeners [prop]; if (a == null){ // Should never happen return; } foreach (PropertyListener pl in a){ pl (prop, size, data); } }
public static void RemoveListener (AudioSessionProperty property, PropertyListener listener) { if (listener == null) throw new ArgumentNullException ("listener"); ArrayList a = (ArrayList) listeners [property]; if (a == null) return; a.Remove (listener); if (a.Count == 0) listeners [property] = null; }
static IntPtr GetIntPtr (AudioSessionProperty property) { unsafe { IntPtr val; int size = IntPtr.Size; int k = AudioSessionGetProperty (property, ref size, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); return val; } }
static int GetInt(AudioSessionProperty property) { unsafe { int val = 0; int size = 4; int k = AudioSessionGetProperty(property, ref size, (IntPtr)(&val)); if (k != 0) { throw new AudioSessionException(k); } return(val); } }
static void Listener(IntPtr userData, AudioSessionProperty prop, int size, IntPtr data) { List <PropertyListener> a; if (!listeners.TryGetValue(prop, out a)) { // Should never happen return; } foreach (PropertyListener pl in a) { pl(prop, size, data); } }
static void RemoveListenerEvent (AudioSessionProperty property, object handler) { if (strongListenerHash == null) return; PropertyListener listener; lock (strongListenerHash) { listener = (PropertyListener) strongListenerHash [handler]; if (listener == null) return; strongListenerHash.Remove (handler); } RemoveListener (AudioSessionProperty.CurrentHardwareOutputVolume, listener); }
public static void RemoveListener(AudioSessionProperty property, PropertyListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } List <PropertyListener> a; if (!listeners.TryGetValue(property, out a)) { return; } a.Remove(listener); if (a.Count == 0) { listeners [property] = null; } }
static void RemoveListenerEvent(AudioSessionProperty property, object handler) { if (strongListenerHash == null) { return; } PropertyListener listener; lock (strongListenerHash) { if (!strongListenerHash.TryGetValue(handler, out listener)) { return; } strongListenerHash.Remove(handler); } RemoveListener(AudioSessionProperty.CurrentHardwareOutputVolume, listener); }
public void audioListener(AudioSessionProperty prop, int size, IntPtr data) { if (prop == AudioSessionProperty.AudioRouteChange) { var audioInputAvailable = AudioSession.AudioInputAvailable; if (unitIsRunning && !audioInputAvailable) { rioUnit.Stop (); } else if (!unitIsRunning && audioInputAvailable) { if (!unitCreated) { SetupRemoteIO (); } } } }
public static AudioSessionErrors AddListener (AudioSessionProperty property, PropertyListener listener) { if (listener == null) throw new ArgumentNullException ("listener"); if (listeners == null) listeners = new Hashtable (); ArrayList a = (ArrayList) listeners [property]; if (a == null) listeners [property] = a = new ArrayList (); a.Add (listener); if (a.Count == 1) { return AudioSessionAddPropertyListener (property, Listener, IntPtr.Zero); } return AudioSessionErrors.None; }
void RouteChangeListener(/*IntPtr inClientData,*/ AudioSessionProperty inID, int inDataSize, IntPtr inData) { if (inID == AudioSessionProperty.AudioRouteChange) { NSDictionary routeDict = Runtime.GetNSObject (inData) as NSDictionary; NSNumber reasonValue = (NSNumber)routeDict.ValueForKey (new NSString ("OutputDeviceDidChange_Reason")); if ((AudioSessionRouteChangeReason)reasonValue.Int32Value == AudioSessionRouteChangeReason.OldDeviceUnavailable) { this.pausePlaybackForPlayer (this.player); } } }
extern static OSStatus AudioSessionAddPropertyListener(AudioSessionProperty id, _PropertyListener inProc, IntPtr userData);
extern static OSStatus AudioSessionGetPropertySize(AudioSessionProperty id, out int size);
public AudioSessionPropertyEventArgs(AudioSessionProperty prop, int size, IntPtr data) { this.Property = prop; this.Size = size; this.Data = data; }
static void SetInt(AudioSessionProperty property, int val) { unsafe { int k = AudioSessionSetProperty (property, 4, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); } }
static void Listener(IntPtr userData, AudioSessionProperty prop, int size, IntPtr data) { ArrayList a = (ArrayList) listeners [prop]; if (a == null){ // Should never happen return; } foreach (PropertyListener pl in a){ pl (prop, size, data); } }
static double GetDouble(AudioSessionProperty property) { unsafe { double val = 0; int size = 8; int k = AudioSessionGetProperty (property, ref size, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); return val; } }
public void Listener(AudioSessionProperty prop, int size, IntPtr data) { cback (null, new AudioSessionRouteChangeEventArgs (data)); }
public void Listener(AudioSessionProperty prop, int size, IntPtr data) { cback(null, new AudioSessionRouteChangeEventArgs(data)); }
static extern int AudioSessionSetProperty( AudioSessionProperty inID, UInt32 inDataSize, ref OverrideAudioRouteType inData);
static extern OSStatus AudioSessionGetPropertySize(AudioSessionProperty id, out int size);
static extern OSStatus AudioSessionSetProperty(AudioSessionProperty id, int size, IntPtr data);
static int GetInt(AudioSessionProperty property) { unsafe { int val = 0; int size = 4; int k = AudioSessionGetProperty (property, ref size, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); return val; } }
extern static AudioSessionErrors AudioSessionAddPropertyListener(AudioSessionProperty id, _PropertyListener inProc, IntPtr userData);
static void SetDouble(AudioSessionProperty property, double val) { unsafe { int k = AudioSessionSetProperty (property, 8, (IntPtr) (&val)); if (k != 0) throw new AudioSessionException (k); } }
extern static OSStatus AudioSessionSetProperty(AudioSessionProperty id, int size, IntPtr data);
public static void AddListener(AudioSessionProperty property, PropertyListener listener) { if (listener == null) throw new ArgumentNullException ("listener"); if (listeners == null) listeners = new Hashtable (); ArrayList a = (ArrayList) listeners [property]; if (a == null) listeners [property] = a = new ArrayList (); a.Add (listener); if (a.Count == 1) AudioSessionAddPropertyListener (property, Listener, IntPtr.Zero); }
public static void RemoveListener(AudioSessionProperty property, PropertyListener listener) { if (listener == null) throw new ArgumentNullException ("listener"); ArrayList a = (ArrayList) listeners [property]; if (a == null) return; a.Remove (listener); if (a.Count == 0) listeners [property] = null; }
static extern OSStatus AudioSessionAddPropertyListener(AudioSessionProperty id, _PropertyListener inProc, IntPtr userData);
extern static OSStatus AudioSessionGetProperty(AudioSessionProperty id, ref int size, IntPtr data);