private void init() { m_updateListener = new UpdateListener(this); m_updateSubject .Synchronize() .Throttle(TimeSpan.FromMilliseconds(10)) .SubscribeOnDispatcher() .Subscribe(m_updateListener); m_sessionVolumeListener = new AudioSessionVolumeListener(this); m_sessionMuteListener = new AudioSessionMuteListener(this); m_coreAudioController = new CoreAudioController(); m_coreAudioController.DefaultPlaybackDevice.GetCapability <IAudioSessionController>().SessionCreated.Subscribe(new AudioSessionAddedListener(this)); m_coreAudioController.DefaultPlaybackDevice.GetCapability <IAudioSessionController>().SessionDisconnected.Subscribe(new AudioSessionRemovedListener(this)); m_coreAudioController.AudioDeviceChanged.Subscribe(new DeviceChangeListener(this)); var masterVolumeListener = new MasterVolumeListener(this); m_coreAudioController.DefaultPlaybackDevice.VolumeChanged.Throttle(TimeSpan.FromMilliseconds(10)).Subscribe(masterVolumeListener); m_coreAudioController.DefaultPlaybackDevice.MuteChanged.Throttle(TimeSpan.FromMilliseconds(10)).Subscribe(masterVolumeListener); new Thread(() => { updateState(null); Server = new Server(this); }).Start(); }
public AudioSessionKeeper(IAudioSession session, AudioSessionVolumeListener volumeListener, AudioSessionMuteListener muteListener) { m_id = session.Id; m_volumeSubscription = session.VolumeChanged.Subscribe(volumeListener); m_muteSubscription = session.MuteChanged.Subscribe(muteListener); }