Пример #1
0
        private SfAudioMarker AddMarkerToFile(SfAudioMarker marker)
        {
            int idx = _markers.Add(marker);

            marker = _markers[idx];
            _outputHelper?.ToScriptWindow($"Added Marker idx={idx} ({marker.Start} '{marker.Name}', type={marker.Type})");
            return(marker);
        }
Пример #2
0
        private SplitTrackDefinition CreateTrackInList(int newTrackNumber, SfAudioMarker newRegion)
        {
            _splitTrackList.RenumberMarkers(newTrackNumber + 1);
            var newTrack = _splitTrackList.AddNew(newRegion, newTrackNumber, _options);

            _splitTrackList.RenumberMarkers();
            return(newTrack);
        }
Пример #3
0
 public static void SetMarkerEnd(SfAudioMarker marker, long ccEndIn)
 {
     if (marker == null || ccEndIn < marker.Start)
     {
         return;
     }
     marker.Length = ccEndIn - marker.Start;
 }
Пример #4
0
        public SfAudioMarker CreateFadeOutEnd(int track, long startPosition)
        {
            string        name   = _markerNameBuilder.GetFadeOutEndMarkerName(track);
            SfAudioMarker marker = new SfAudioMarker(startPosition)
            {
                Name = name
            };

            return(AddMarkerToFile(marker));
        }
Пример #5
0
        public SfAudioMarker CreateRegion(int track, long startPosition, long length)
        {
            string        name   = _markerNameBuilder.GetRegionMarkerName(track);
            SfAudioMarker marker = new SfAudioMarker(startPosition, length)
            {
                Name = name
            };

            return(AddMarkerToFile(marker));
        }
Пример #6
0
        public bool IsTrackFadeOutEndMarker(SfAudioMarker marker, int track)
        {
            if (!IsTrackFadeOutEndMarker(marker))
            {
                return(false);
            }
            Match m = FadeOutEndNameRegex.Match(marker.Name);

            return(int.Parse(m.Groups[1].Value).Equals(track));
        }
Пример #7
0
        public SplitTrackList InitTracks(VinylRipOptions options)
        {
            List <SfAudioMarker> trackRegions = GetTrackRegions();

            SetListBounds(trackRegions.Count);
            for (int trackNumber = trackRegions.Count; trackNumber > 0; trackNumber--)
            {
                SfAudioMarker trackRegion = trackRegions[trackNumber - 1];
                AddNew(trackRegion, trackNumber, options);
            }
            return(this);
        }
Пример #8
0
        public SplitTrackDefinition AddNew(SfAudioMarker trackRegionMarker, int trackNumber, VinylRipOptions options)
        {
            SplitTrackDefinition track = new SplitTrackDefinition(this, _file, options, _markerFactory, _regionFactory, _output);

            this[trackNumber - 1] = track;
            track.Number          = trackNumber;
            track.TrackRegion     = trackRegionMarker;
            track.FadeInEndMarker = GetTrackFadeInEndMarker(track.Number, options.DefaultTrackFadeInLengthInSamples);
            var fadeOutLengthInSamples = _file.SecondsToPosition(options.DefaultTrackFadeOutLengthInSeconds);

            track.FadeOutEndMarker = GetTrackFadeOutEndMarker(track.Number, fadeOutLengthInSamples);
            return(track);
        }
Пример #9
0
 public SplitTrackDefinition(
     SplitTrackList splitTrackList,
     ISfFileHost file,
     VinylRipOptions options,
     ICreateFadeMarkers markerFactory,
     ICreateTrackRegions regionFactory,
     IOutputHelper output)
 {
     _options                = options;
     _splitTrackList         = splitTrackList;
     _originalFile           = file;
     _markerFactory          = markerFactory;
     _regionFactory          = regionFactory;
     _output                 = output;
     _trackRegionMarker      = new SfAudioMarker();
     _trackRegionMarker.Type = MarkerType.Region;
 }
Пример #10
0
        public void Remove(SfAudioMarker marker)
        {
            var idx = File.Markers.IndexOf(marker);

            File.Markers.RemoveAt(idx);
        }
Пример #11
0
 public int Add(SfAudioMarker marker) => File.Markers.Add(marker);
Пример #12
0
 public static long GetMarkerEnd(SfAudioMarker marker)
 {
     return(marker.Start + marker.Length);
 }
Пример #13
0
 public bool IsTrackFadeOutEndMarker(SfAudioMarker marker)
 {
     return(!marker.HasLength && FadeOutEndNameRegex.IsMatch(marker.Name));
 }
Пример #14
0
 public bool IsTrackRegion(SfAudioMarker marker)
 {
     return(marker.HasLength && RegionNameRegex.IsMatch(marker.Name));
 }