Example #1
0
        private void DeleteBeatsWithinMarkers()
        {
            TimeSpan tBegin = _marker1 < _marker2 ? _marker1 : _marker2;
            TimeSpan tEnd   = _marker1 < _marker2 ? _marker2 : _marker1;

            SetAllBeats(Beats.Where(t => t <tBegin || t> tEnd));
        }
Example #2
0
        private void mnuShiftSelected_Click(object sender, RoutedEventArgs e)
        {
            TimeSpan tBegin = _marker1 < _marker2 ? _marker1 : _marker2;
            TimeSpan tEnd   = _marker1 < _marker2 ? _marker2 : _marker1;

            double shiftBy = GetDouble(0.0);

            if (Double.IsNaN(shiftBy))
            {
                return;
            }

            TimeSpan shift = TimeSpan.FromMilliseconds((int)shiftBy);

            List <TimeSpan> beatsToEvenOut = Beats.GetBeats(tBegin, tEnd).Select(b => b + shift).ToList();

            List <TimeSpan> otherBeats = Beats.Where(t => t <tBegin || t> tEnd).ToList();

            SetAllBeats(otherBeats.Concat(beatsToEvenOut));

            _marker1 += shift;
            _marker2 += shift;


            BeatBar.Marker1 = _marker1;
            BeatBar.Marker2 = _marker2;
        }
Example #3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            TimeSpan tBegin = _marker1 < _marker2 ? _marker1 : _marker2;
            TimeSpan tEnd   = _marker1 < _marker2 ? _marker2 : _marker1;

            SetAllBeats(Beats.Where(t => t <tBegin || t> tEnd));
        }
Example #4
0
        private void Normalize(int additionalBeats, bool trimToBeats = true)
        {
            TimeSpan tBegin = _marker1 < _marker2 ? _marker1 : _marker2;
            TimeSpan tEnd   = _marker1 < _marker2 ? _marker2 : _marker1;

            List <TimeSpan> beatsToEvenOut = Beats.GetBeats(tBegin, tEnd).ToList();

            List <TimeSpan> otherBeats = Beats.Where(t => t <tBegin || t> tEnd).ToList();

            if (beatsToEvenOut.Count < 2 && trimToBeats)
            {
                return;
            }

            TimeSpan first = trimToBeats ? beatsToEvenOut.Min() : tBegin;
            TimeSpan last  = trimToBeats ? beatsToEvenOut.Max() : tEnd;

            int numberOfBeats = (int)(beatsToEvenOut.Count + additionalBeats);

            if (numberOfBeats < 2)
            {
                numberOfBeats = 2;
            }

            TimeSpan tStart    = first;
            TimeSpan intervall = (last - first).Divide(numberOfBeats - 1);

            for (int i = 0; i < numberOfBeats; i++)
            {
                otherBeats.Add(tStart + intervall.Multiply(i));
            }

            Fadeout.SetText(intervall.TotalMilliseconds.ToString("f0") + "ms", TimeSpan.FromSeconds(4));

            SetAllBeats(otherBeats);
        }