Example #1
0
        private void GetAudioMeterInformation()
        {
            object result;

            Marshal.ThrowExceptionForHR(_RealDevice.Activate(ref IIDs.IID_IAudioMeterInformation, CLSCTX.ALL, IntPtr.Zero, out result));
            _AudioMeterInformation = new AudioMeterInformation(result as IAudioMeterInformation);
        }
        internal AudioSessionControl2(IAudioSessionControl2 realAudioSessionControl2)
        {
            _AudioSessionControl2 = realAudioSessionControl2;

            IAudioMeterInformation _meters = _AudioSessionControl2 as IAudioMeterInformation;
            ISimpleAudioVolume _volume = _AudioSessionControl2 as ISimpleAudioVolume;
            if (_meters != null) _AudioMeterInformation = new CoreAudio.AudioMeterInformation(_meters);
            if (_volume != null) _SimpleAudioVolume = new SimpleAudioVolume(_volume);

            _AudioSessionEvents = new AudioSessionEvents(this);
            Marshal.ThrowExceptionForHR(_AudioSessionControl2.RegisterAudioSessionNotification(_AudioSessionEvents));
        }
        internal AudioSessionControl(IAudioSessionControl realAudioSessionControl)
        {
            IAudioMeterInformation _meters = realAudioSessionControl as IAudioMeterInformation;
            ISimpleAudioVolume     _volume = realAudioSessionControl as ISimpleAudioVolume;

            if (_meters != null)
            {
                _AudioMeterInformation = new CoreAudio.AudioMeterInformation(_meters);
            }
            if (_volume != null)
            {
                _SimpleAudioVolume = new SimpleAudioVolume(_volume);
            }
            _AudioSessionControl = realAudioSessionControl;

            //_AudioSessionEvents = new AudioSessionEvents(this);
            Marshal.ThrowExceptionForHR(_AudioSessionControl.RegisterAudioSessionNotification(_AudioSessionEvents));
        }
Example #4
0
        public AudioSessionControl2(IAudioSessionControl2 realAudioSessionControl2)
        {
            _AudioSessionControl2 = realAudioSessionControl2;

            if (_AudioSessionControl2 is IAudioMeterInformation _meters)
            {
                _AudioMeterInformation = new AudioMeterInformation(_meters);
            }

            if (_AudioSessionControl2 is ISimpleAudioVolume _volume1)
            {
                _SimpleAudioVolume = new SimpleAudioVolume(_volume1);
            }

            //IAudioVolumeLevel _volume2 = _AudioSessionControl2 as IAudioVolumeLevel;
            //if (_volume2 != null) _AudioVolumeLevel = new AudioVolumeLevel(_volume2);

            _AudioSessionEvents = new AudioSessionEvents(this);
            Marshal.ThrowExceptionForHR(_AudioSessionControl2.RegisterAudioSessionNotification(_AudioSessionEvents));
        }
Example #5
0
 private void GetAudioMeterInformation()
 {
     object result;
     Marshal.ThrowExceptionForHR(_RealDevice.Activate(ref IIDs.IID_IAudioMeterInformation, CLSCTX.ALL, IntPtr.Zero, out result));
     _AudioMeterInformation = new AudioMeterInformation( result as IAudioMeterInformation);
 }