public void Dispose() { lock (_syncObj) { Log.Debug("BassLibraryManager.Dispose()"); Log.Debug("Unloading all BASS player plugins"); foreach (int pluginHandle in _DecoderPluginHandles) { Bass.BASS_PluginFree(pluginHandle); } _DecoderPluginHandles.Clear(); // Free the NoSound device if (!Bass.BASS_SetDevice(BassConstants.BassNoSoundDevice)) { throw new BassLibraryException("BASS_SetDevice"); } if (!Bass.BASS_Free()) { throw new BassLibraryException("BASS_Free"); } _bassLibraryManager = null; } }
/// <summary> /// Loads and initializes the Bass library. /// </summary> /// <param name="playerPluginsDirectory">Directory where the BASS player plugins are located.</param> /// <returns>The new instance.</returns> public static BassLibraryManager Get(string playerPluginsDirectory) { lock (_syncObj) { if (_bassLibraryManager != null) return _bassLibraryManager; _bassLibraryManager = new BassLibraryManager(); _bassLibraryManager.Initialize(playerPluginsDirectory); return _bassLibraryManager; } }
/// <summary> /// Loads and initializes the Bass library. /// </summary> /// <param name="playerPluginsDirectory">Directory where the BASS player plugins are located.</param> /// <returns>The new instance.</returns> public static BassLibraryManager Get(string playerPluginsDirectory) { lock (_syncObj) { if (_bassLibraryManager != null) { return(_bassLibraryManager); } _bassLibraryManager = new BassLibraryManager(); _bassLibraryManager.Initialize(playerPluginsDirectory); return(_bassLibraryManager); } }
public void Dispose() { lock (_syncObj) { Log.Debug("BassLibraryManager.Dispose()"); Log.Debug("Unloading all BASS player plugins"); foreach (int pluginHandle in _DecoderPluginHandles) Bass.BASS_PluginFree(pluginHandle); _DecoderPluginHandles.Clear(); // Free the NoSound device if (!Bass.BASS_SetDevice(BassConstants.BassNoSoundDevice)) throw new BassLibraryException("BASS_SetDevice"); if (!Bass.BASS_Free()) throw new BassLibraryException("BASS_Free"); _bassLibraryManager = null; } }
/// <summary> /// Initializes a new instance of the BASS player controller. /// </summary> /// <param name="player">BASS player instance which contains this controller instance.</param> /// <param name="playerMainDirectory">Directory where the BASS player is located. Plugins will be searched relative /// to this directory.</param> public Controller(BassPlayer player, string playerMainDirectory) { Log.Debug("Initializing BASS controller"); _player = player; _bassLibraryManager = BassLibraryManager.Get(Path.Combine(playerMainDirectory, InternalSettings.PluginsPath)); _playbackProcessor = new PlaybackProcessor(this); _outputDeviceManager = new OutputDeviceManager(this); _mainThreadTerminated = false; _workItemQueue = new WorkItemQueue(); _playerThread = new Thread(PlayerThreadMain) {Name = "BassPlay"}; _playerThread.Start(); SetVolume_Async(100); }