public void Attach(IAudioPlaybackProvider audioPlayback, AudioSource source, AudioEnginePlaybackOptions options) { if (audioPlayback == null) { throw new ArgumentNullException("audioPlayback"); } if (source == null) { throw new ArgumentNullException("source"); } if (options == null) { throw new ArgumentNullException("options"); } lock (playbacks) { if (!this.playbackProviders.Contains(audioPlayback)) { audioPlayback.SourceFinished += OnSourceFinished; this.playbackProviders.Add(audioPlayback); } audioPlayback.SetGain(source, options.Gain); playbacks[source] = new AudioPlaybackEntity(audioPlayback, source, options); if (mutedPlayers.Contains(audioPlayback)) { playbacks[source].Muted = true; } } }
public void Attach(IAudioPlaybackProvider audioPlayback, IEnumerable <AudioSource> sources, AudioEnginePlaybackOptions options) { if (audioPlayback == null) { throw new ArgumentNullException("audioPlayback"); } if (sources == null) { throw new ArgumentNullException("sources"); } if (options == null) { throw new ArgumentNullException("options"); } lock (playbacks) { if (!this.playbackProviders.Contains(audioPlayback)) { audioPlayback.SourceFinished += OnSourceFinished; this.playbackProviders.Add(audioPlayback); } foreach (var s in sources.Where(s => !playbacks.ContainsKey(s) && s.OwnerId != Context.CurrentUser.UserId)) { audioPlayback.SetGain(s, options.Gain); playbacks[s] = new AudioPlaybackEntity(audioPlayback, s, options); if (mutedPlayers.Contains(audioPlayback)) { playbacks[s].Muted = true; } } } }
public void Update(AudioSource source, AudioEnginePlaybackOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (options == null) { throw new ArgumentNullException("options"); } lock (playbacks) { AudioPlaybackEntity p; if (!playbacks.TryGetValue(source, out p)) { throw new ArgumentException("source is not attached", "source"); } p.AudioPlayback.SetGain(source, options.Gain); playbacks[source] = new AudioPlaybackEntity(p.AudioPlayback, source, options); } }
public void Update(AudioSource source, AudioEnginePlaybackOptions options) { if (source == null) throw new ArgumentNullException ("source"); if (options == null) throw new ArgumentNullException ("options"); lock (playbacks) { AudioPlaybackEntity p; if (!playbacks.TryGetValue (source, out p)) throw new ArgumentException ("source is not attached", "source"); p.AudioPlayback.SetGain (source, options.Gain); playbacks[source] = new AudioPlaybackEntity (p.AudioPlayback, source, options); } }
public void Attach(IAudioPlaybackProvider audioPlayback, AudioSource source, AudioEnginePlaybackOptions options) { if (audioPlayback == null) throw new ArgumentNullException ("audioPlayback"); if (source == null) throw new ArgumentNullException ("source"); if (options == null) throw new ArgumentNullException ("options"); lock (playbacks) { if (!this.playbackProviders.Contains (audioPlayback)) { audioPlayback.SourceFinished += OnSourceFinished; this.playbackProviders.Add (audioPlayback); } audioPlayback.SetGain (source, options.Gain); playbacks[source] = new AudioPlaybackEntity (audioPlayback, source, options); if (mutedPlayers.Contains (audioPlayback)) playbacks[source].Muted = true; } }
public void Attach(IAudioPlaybackProvider audioPlayback, IEnumerable<AudioSource> sources, AudioEnginePlaybackOptions options) { if (audioPlayback == null) throw new ArgumentNullException ("audioPlayback"); if (sources == null) throw new ArgumentNullException ("sources"); if (options == null) throw new ArgumentNullException ("options"); lock (playbacks) { if (!this.playbackProviders.Contains (audioPlayback)) { audioPlayback.SourceFinished += OnSourceFinished; this.playbackProviders.Add (audioPlayback); } foreach (var s in sources.Where (s => !playbacks.ContainsKey (s) && s.OwnerId != Context.CurrentUser.UserId)) { audioPlayback.SetGain (s, options.Gain); playbacks[s] = new AudioPlaybackEntity (audioPlayback, s, options); if (mutedPlayers.Contains (audioPlayback)) playbacks[s].Muted = true; } } }