Example #1
0
        public RecordingSession(string tempFolder, SpotifyProcessManager spotifyProcessManager, SongClassificationInfo songClassificationInfo, int songRefreshInterval, Logger logger)
        {
            this._groupRecordings = new List <SongGroupRecorder>();
            this.GroupRecordings  = this._groupRecordings.AsReadOnly();

            this.TempFolder             = tempFolder;
            this.SpotifyProcessManager  = spotifyProcessManager;
            this.SongClassificationInfo = songClassificationInfo;
            this.SongRefreshInterval    = songRefreshInterval;
            this._logger = logger;

            _logger.Log("Starting new recording session.");

            StartNewGroupRecording();
        }
        //	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);
        }