public void Dispose() { if (_isDisposed) { return; } _isDisposed = true; lock (_updateLock) { foreach (var track in _audioTracks) { try { track.Stop(); track.Dispose(); } catch (Exception e) { GameLog.Client.Audio.Error(e); } } _audioTracks.Clear(); if (_channelGroup != null) { _channelGroup.Dispose(); _channelGroup = null; } _engine = null; } }
public SoundPlayer([NotNull] IAudioEngine engine, [NotNull] IAppContext appContext) { if (engine == null) { throw new ArgumentNullException("engine"); } if (appContext == null) { throw new ArgumentNullException("musicLibrary"); } _engine = engine; _appContext = appContext; _channelGroup = _engine.CreateGrouping("sound"); }
public MusicPlayer([NotNull] IAudioEngine engine, [NotNull] IAppContext appContext) { if (engine == null) { throw new ArgumentNullException("engine"); } if (appContext == null) { throw new ArgumentNullException("appContext"); } _engine = engine; _appContext = appContext; _channelGroup = _engine.CreateGrouping("music"); _updateTimer = Observable.Interval(TimeSpan.FromMilliseconds(UpdateInterval), _engine.Scheduler).Do(_ => Update()); }