private void onSoundStarted(ISound sound) { _playingSounds.Add(sound); foreach (var rule in AudioRules) { rule.OnSoundStarted(sound); } }
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(); }
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); }