Ejemplo n.º 1
0
        public UserAudioPlayer(Guid userID, AudioOutWPF parent, bool useWaveEvent = true)
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                new CompositionContainer(new AssemblyCatalog(Assembly.GetExecutingAssembly())).ComposeParts(this);
            }

            Parent       = parent;
            this.UserID  = userID;
            UseWaveEvent = useWaveEvent;

            User = UserStatusRepo.FindUser(userID);
            UserStatusRepo.Users.CollectionChanged += Users_CollectionChanged;

            aggregator = new FeenPhone.Audio.SampleAggregator()
            {
                PerformFFT = false
            };
            aggregator.NotificationCount = 882;
            aggregator.PerformFFT        = true;

            VisSource = new AudioVisualizationSource(aggregator);

            LastReceived = DateTime.UtcNow;
        }
Ejemplo n.º 2
0
        void Users_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            var found = false;

            if (UserStatusRepo.Users != null)
            {
                foreach (var user in UserStatusRepo.Users)
                {
                    if (user.ID == UserID)
                    {
                        User  = user;
                        found = true;
                        break;
                    }
                }
            }
            if (!found)
            {
                User = null;
            }
        }