Ejemplo n.º 1
0
        private void OnRecordingStopped(object sender, EventArgs e)
        {
            _audioRecorder.Stopped -= OnRecordingStopped;
            _audioRecorder.Dispose();             //Not needed *currently* but always good to do

            this.RecordedGroup = new RecordedSongGroup(
                path: _audioRecorder.FullOutputPath,
                groupID: GroupID,
                startTime: RecordingStartTime,
                duration: _audioRecorder.CurrentLength,
                waveFormat: _audioRecorder.WaveFormat,
                songs: Songs.ToImmutableList()
                );
            _logger.Log($"Recording for song group '{GroupID}' has stopped.", LogType.MinorMessage);
            GroupFinished?.Invoke(this, EventArgs.Empty);

            //	Task.Run((Action)SplitSongs)
            //	.ContinueWith(
            //		task => {
            //			lock (_lock) {
            //				_splittingCompleted = true;
            //			}
            //			if (task.Exception != null) {
            //				_logger?.Invoke(
            //					"An error occurred while splitting the recording into songs in a separate thread:\r\n"
            //					+ task.Exception,
            //					LogType.Error
            //				);
            //			}
            //		}
            //	);
        }
Ejemplo n.º 2
0
        public SongGroupSplitter(RecordedSongGroup group, Logger logger, bool autostart = false)
        {
            this.Group   = group;
            this._logger = logger;

            this._asyncProcessHelper = AsyncProcessHelper.Create <RecordedSong>(SplitGroup, _logger, "split song group into songs");

            if (autostart)
            {
                SplitGroupAsync();
            }
        }
        public void Enqueue(RecordedSongGroup group)
        {
            _logger.Log($"Enqueued song group '{group.GroupID}' for splitting.");

            _pendingGroups.Enqueue(group);
        }