/// <summary> /// Initializes the singleton instance of this class and starts PCA /// computations if the library has been scanned already. Also causes /// TrackData to be written to the database if it is not current anymore. /// </summary> /// <param name="sc"> /// The <see cref="NoNoiseClutterSourceContents"/> which is used as callback. /// </param> /// <param name="force_new"> /// If this is true then a new instance will be initialized even if an /// old one already exists. Otherwise Init () might return an existing /// instance. /// </param> /// <returns> /// The singleton instance of <see cref="BansheeLibraryAnalyzer"/> /// </returns> public static BansheeLibraryAnalyzer Init (NoNoiseClutterSourceContents sc, bool force_new) { if (!force_new && bla != null) return bla; bla = new BansheeLibraryAnalyzer (); bla.sc = sc; Hyena.Log.Debug ("NoNoise/BLA - starting write track data thread"); new Thread (new ThreadStart (bla.WriteTrackInfosToDB)).Start (); return bla; }
/// <summary> /// Releases all resource used by the <see cref="Banshee.NoNoise.BansheeLibraryAnalyzer"/> /// object and removes all listeners which were previously added. /// </summary> /// <remarks> /// Call <see cref="Dispose"/> when you are finished using the /// <see cref="Banshee.NoNoise.BansheeLibraryAnalyzer"/>. The <see cref="Dispose"/> method leaves the /// <see cref="Banshee.NoNoise.BansheeLibraryAnalyzer"/> in an unusable state. After calling /// <see cref="Dispose"/>, you must release all references to the /// <see cref="Banshee.NoNoise.BansheeLibraryAnalyzer"/> so the garbage collector can reclaim the memory that /// the <see cref="Banshee.NoNoise.BansheeLibraryAnalyzer"/> was occupying. /// </remarks> public void Dispose () { Hyena.Log.Debug ("NoNoise/BLA - Disposing library analyzer..."); lock (scan_synch) { stop_scan = true; } ml.TracksAdded -= HandleTracksAdded; ml.TracksDeleted -= HandleTracksDeleted; sc = null; bla = null; }