Example #1
0
 private void onSoundStarted(ISound sound)
 {
     _playingSounds.Add(sound);
     foreach (var rule in AudioRules)
     {
         rule.OnSoundStarted(sound);
     }
 }
Example #2
0
 public AGSEntity(string id, Resolver resolver)
 {
     ID = id;
     if (!_ids.Add(id))
     {
         throw new ArgumentException($"Duplicate entity: {id}");
     }
     _resolver               = resolver;
     _components             = new ConcurrentDictionary <Type, Lazy <API.IComponent> >();
     _bindings               = new AGSConcurrentHashSet <API.IComponentBinding>(200, false);
     OnComponentsInitialized = new AGSEvent();
     OnComponentsChanged     = new AGSEvent <AGSListChangedEventArgs <API.IComponent> >();
     _onDisposed             = new AGSEvent();
 }
Example #3
0
        private ISound playSound(float volume, float pitch, float panning, bool looping = false)
        {
            //Debug.WriteLine("Playing Sound: " + ID);
            int     source = getSource();
            ALSound sound  = new ALSound(source, Duration, volume, pitch, looping, panning, _errors, _backend);

            _playingSounds.Add(sound);
            sound.Play(_buffer.Value);
            sound.Completed.ContinueWith(_ =>
            {
                _system.ReleaseSource(source);
                _playingSounds.Remove(sound);
            });
            return(sound);
        }