public AudioSessionViewModel(IStreamWithVolumeControl stream)
        {
            _stream = stream;
            _stream.PropertyChanged += Stream_PropertyChanged;

            ToggleMute = new RelayCommand(() => IsMuted = !IsMuted);
        }
Beispiel #2
0
 internal AudioSessionViewModel(IStreamWithVolumeControl stream)
 {
     _stream = stream;
     _stream.PropertyChanged += Stream_PropertyChanged;
     SettingsService.UseLogarithmicVolumeChanged += SettingService_UseLogarithmicVolumeChanged;
     _stream.UseLogarithmicVolume = SettingsService.UseLogarithmicVolume;
 }
Beispiel #3
0
            public void RefreshStream(bool forced = false, INamedStreamWithVolumeControl newStream = null)
            {
                if (Id == null)
                {
                    return;
                }

                if (_stream != null && !forced)
                {
                    return;
                }

                IStreamWithVolumeControl old = _stream;

                _stream = newStream != null ? newStream : SharedManager.GetStreamById(Id);

                if (old == _stream)
                {
                    return;
                }

                if (old != null)
                {
                    INotifyPropertyChanged notifiable = (INotifyPropertyChanged)old;
                    notifiable.PropertyChanged -= this.Stream_PropertyChanged;
                }

                if (_stream != null)
                {
                    INotifyPropertyChanged notifiable = (INotifyPropertyChanged)_stream;
                    notifiable.PropertyChanged += this.Stream_PropertyChanged;
                    _streamName = _stream.DisplayName;
                    if (_stream is IAudioDeviceSession)
                    {
                        IAudioDeviceSession session = (IAudioDeviceSession)_stream;

                        if (session.Parent != null)
                        {
                            _parent    = session.Parent;
                            ParentName = session.Parent.DisplayName;
                        }
                    }
                    IconPath     = _stream.IconPath;
                    IsDesktopApp = _stream.IsDesktopApp;
                }

                RaisePropertyChanged("Stream");
                RaisePropertyChanged("StreamName");
                RaisePropertyChanged("Disabled");
                RaisePropertyChanged("QualifiedStreamName");
            }
Beispiel #4
0
        private static void DoAudioAction(MuteKind action, IStreamWithVolumeControl stream)
        {
            switch (action)
            {
            case MuteKind.Mute:
                stream.IsMuted = true;
                break;

            case MuteKind.ToggleMute:
                stream.IsMuted = !stream.IsMuted;
                break;

            case MuteKind.Unmute:
                stream.IsMuted = false;
                break;
            }
        }
Beispiel #5
0
        private static void DoAudioAction(SetVolumeKind action, IStreamWithVolumeControl stream, IPartWithVolume part)
        {
            var vol = (float)(part.Volume / 100f);

            switch (action)
            {
            case SetVolumeKind.Set:
                stream.Volume = vol;
                break;

            case SetVolumeKind.Increment:
                stream.Volume += vol;
                break;

            case SetVolumeKind.Decrement:
                stream.Volume -= vol;
                break;
            }
        }
 internal AudioSessionViewModel(IStreamWithVolumeControl stream)
 {
     _stream = stream;
     _stream.PropertyChanged += Stream_PropertyChanged;
 }