예제 #1
0
        public PlayerTabController(SettingsHost settingsHost, SpotifyProcessManager spotifyProcessManager, Logger logger)
        {
            this.SettingsHost          = settingsHost;
            this.SpotifyProcessManager = spotifyProcessManager;
            this.Logger = logger;

            this.SpotifyController = new SpotifyController(spotifyProcessManager);

            this.SongTracker = new SongTracker(
                spotifyProcessManager,
                settingsHost.SongClassificationInfo,
                settingsHost.SongRefreshInterval,
                logger,
                maxSongs: 11                 //Minimum suported non-infinite value
                //There's no need to store songs for the player, just get notified when they change
                );
            this.SongTracker.StartTracking();
        }
        //	private bool _splittingCompleted = false;
        //	/// <summary>
        //	/// False until everything, including asynchronously splitting the recording into songs, has been completed
        //	/// </summary>
        //	public bool SplittingCompleted {
        //		get { lock (_lock) return _splittingCompleted; }
        //	}
        //	private object _lock = new object();

        public SongGroupRecorder(string tempFolder, SpotifyProcessManager spotifyProcessManager, SongClassificationInfo songClassificationInfo, int songRefreshInterval, Logger logger)
        {
            this.TempFolder = tempFolder;
            this.GroupID    = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss.ffff");
            this._logger    = logger;

            _logger.Log("Starting new song group with ID '" + this.GroupID + "'.");

            _songTracker   = new SongTracker(spotifyProcessManager, songClassificationInfo, songRefreshInterval, _logger);
            _audioRecorder = new AudioRecorder(tempFolder, $"Temp Group '{this.GroupID}'");
            _logger.Log("Audio recorder created & automatically started", LogType.MinorMessage);

            RecordingStartTime = DateTime.Now;

            _songTracker.SongChanged += this.OnSongChanged;
            _songTracker.StartTracking();

            _logger.Log("Successfully started new song group with ID '" + this.GroupID + "'.", LogType.MinorMessage);
        }