private ISound playSound(float volume, float pitch, float panning, bool looping = false) { //Debug.WriteLine("Playing Sound: " + ID); _numPlayingSounds++; int source = getSource(); ALSound sound = new ALSound (source, volume, pitch, looping, panning, _errors, _backend); sound.Play(_buffer.Value); sound.Completed.ContinueWith(_ => { _system.ReleaseSource(source); _numPlayingSounds--; }); return sound; }
private ISound playSound(float volume, float pitch, float panning, bool looping = false) { //Debug.WriteLine("Playing Sound: " + ID); _numPlayingSounds++; int source = getSource(); ALSound sound = new ALSound(source, volume, pitch, looping, panning, _errors, _backend); sound.Play(_buffer.Value); sound.Completed.ContinueWith(_ => { _system.ReleaseSource(source); _numPlayingSounds--; }); return(sound); }
private ISound playSound(float volume, float pitch, float panning, IConcurrentHashSet <string> tags, bool looping = false) { //Debug.WriteLine("Playing Sound: " + ID); int source = getSource(); ALSound sound = new ALSound(source, Duration, volume, pitch, looping, panning, tags, _errors, _backend); _playingSounds.Add(sound); OnSoundStarted.Invoke(sound); sound.Play(_buffer.Value); sound.Completed.ContinueWith(_ => { _system.ReleaseSource(source); _playingSounds.Remove(sound); OnSoundCompleted.Invoke(sound); }); return(sound); }