Beispiel #1
0
        public bool ToggleMute(AudioSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            lock (this.syncRoot)
            {
                AudioSource actual;
                if (!Sources.TryGetValue(source.Id, out actual))
                {
                    return(false);
                }

                AudioSource newSource = new AudioSource(actual);
                newSource.IsMuted = !actual.IsMuted;

                OwnedSources.Remove(source.OwnerId, source);
                Sources[newSource.Id] = newSource;
                OwnedSources.Add(source.OwnerId, source);

                return(newSource.IsMuted);
            }
        }
Beispiel #2
0
        public virtual bool Remove(AudioSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            lock (this.syncRoot)
            {
                OwnedSources.Remove(source.OwnerId, source);
                return(Sources.Remove(source.Id));
            }
        }
Beispiel #3
0
        public virtual bool Remove(IUserInfo user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            lock (this.syncRoot)
            {
                foreach (AudioSource source in OwnedSources[user.UserId])
                {
                    Sources.Remove(source.Id);
                }

                return(OwnedSources.Remove(user.UserId));
            }
        }