示例#1
0
        private async Task InitializeAudioGraphAsync()
        {
            _audioPlayer = new XAudioPlayer();

            var successful = await _audioPlayer.InitializeAudioGraphAsync();

            if (!successful)
            {
                IsAudioEffectsSupport = false;
                return;
            }

            IsAudioEffectsSupport         = true;
            _audioPlayer.MediaEnd        += (sender, args) => OnCurrentTrackEnd();
            _audioPlayer.StateChanged    += (sender, args) => DispatcherHelper.CheckBeginInvokeOnUI(() => State = _audioPlayer.State);
            _audioPlayer.ErrorOccurred   += (sender, args) => OnCurrentTrackEnd();
            _audioPlayer.PositionChanged += (sender, args) => DispatcherHelper.CheckBeginInvokeOnUI(() => NotifyPositionInternal(_audioPlayer.Position));

            _audioPlayer.IsEQEffectEnabled = LocalSettingsHelper.LoadValue(CommonKeys.EQEffectEnabled, false);
            _audioPlayer.EQBassGain        = LocalSettingsHelper.LoadValue(CommonKeys.EQBassGain, 50d);
            _audioPlayer.EQLowMidGain      = LocalSettingsHelper.LoadValue(CommonKeys.EQLowMidGain, 20d);
            _audioPlayer.EQHighMidGain     = LocalSettingsHelper.LoadValue(CommonKeys.EQHighMidGain, 70d);
            _audioPlayer.EQHighPitchGain   = LocalSettingsHelper.LoadValue(CommonKeys.EQHighPitchGain, 30d);

            _audioPlayer.IsEchoEffectEnabled = LocalSettingsHelper.LoadValue(CommonKeys.EchoEffectEnabled, false);
            _audioPlayer.EchoDelay           = LocalSettingsHelper.LoadValue(CommonKeys.EchoDelay, 50d);

            _audioPlayer.IsLimiterEffectEnabled = LocalSettingsHelper.LoadValue(CommonKeys.LimiterEffectEnabled, false);
            _audioPlayer.LimiterLoudness        = LocalSettingsHelper.LoadValue(CommonKeys.LimiterLoudness, 20u);

            _audioPlayer.IsReverbEffectEnabled = LocalSettingsHelper.LoadValue(CommonKeys.ReverbEffectEnabled, false);
            _audioPlayer.ReverbDecayTime       = LocalSettingsHelper.LoadValue(CommonKeys.ReverbDecay, 2d);
        }
示例#2
0
        public XConnection(string ipAddress, int port, string userName, string password)
        {
            var settings = new XSettings(ipAddress, port, userName, password);
            var client   = new XClient(settings);

            XHelpers.Settings = settings;
            AudioLibrary      = new XAudioLibrary(client);
            VideoLibrary      = new XVideoLibrary(client);
            AudioPlayer       = new XAudioPlayer(client);
            VirtualRemote     = new XVirtualRemote(settings);
        }