Esempio n. 1
0
        private void UpdateViewText()
        {
            var start    = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomStart));
            var end      = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomEnd));
            var length   = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomLength));
            var position = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(CurrentPosition));

            lblViewDetails.Text = $"View: {start} to {end} ({length}) Cursor: {position}";
        }
Esempio n. 2
0
        private void mnuSetSampleOffset_Click(object sender, EventArgs e)
        {
            if (CurrentSample == null)
            {
                return;
            }

            CurrentSample.Offset = BassTrack.SamplesToSeconds(CurrentPosition);
            UpdatePositions();
        }
Esempio n. 3
0
        /// <summary>
        ///     Zooms the view to the specified position
        /// </summary>
        /// <param name="startSeconds">The start seconds.</param>
        /// <param name="lengthSeconds">The length seconds.</param>
        /// <param name="currentPositionSeconds">The current position seconds.</param>
        public void Zoom(double startSeconds, double lengthSeconds, double currentPositionSeconds)
        {
            var start           = BassTrack.SecondsToSamples(startSeconds);
            var end             = BassTrack.SecondsToSamples(startSeconds + lengthSeconds);
            var currentPosition = start;

            if (currentPositionSeconds != 0D)
            {
                currentPosition = BassTrack.SecondsToSamples(currentPositionSeconds);
            }

            Zoom(start, end, currentPosition);
        }
Esempio n. 4
0
        /// <summary>
        ///     Draws the wave.
        /// </summary>
        private void DrawWave()
        {
            if (Wave == null)
            {
                return;
            }
            if (ZoomLength == 0)
            {
                return;
            }

            BeginInvoke((MethodInvoker) delegate
            {
                var oldBitmap = picWaveForm.BackgroundImage;
                var bitmap    = Wave.CreateBitmap(picWaveForm.Width,
                                                  picWaveForm.Height,
                                                  Wave.Position2Frames(BassTrack.SamplesToSeconds(ZoomStart)),
                                                  Wave.Position2Frames(BassTrack.SamplesToSeconds(ZoomEnd)),
                                                  true);

                if (CurrentPosition >= ZoomStart && CurrentPosition <= ZoomEnd)
                {
                    var positionPercent = (CurrentPosition - ZoomStart) / (double)ZoomLength;
                    var x = Convert.ToInt32(Math.Round(positionPercent * picWaveForm.Width, 0));

                    using (var pen = new Pen(Color.Red))
                        using (var graphics = Graphics.FromImage(bitmap))
                        {
                            graphics.DrawLine(pen, x, 0, x, picWaveForm.Height - 1);
                        }
                }

                picWaveForm.BackgroundImage = bitmap;
                oldBitmap?.Dispose();

                scrollBar.Maximum     = (int)(BassTrack.Length - ZoomLength);
                scrollBar.SmallChange = scrollBar.Maximum / 400;
                scrollBar.LargeChange = scrollBar.Maximum / 50;

                if (!_scrolling)
                {
                    scrollBar.Value = (int)ZoomStart;
                }

                UpdateViewText();
            });
        }
Esempio n. 5
0
        private void mnuSetSampleEnd_Click(object sender, EventArgs e)
        {
            if (CurrentSample == null)
            {
                return;
            }

            var end   = BassTrack.SamplesToSeconds(CurrentPosition);
            var start = CurrentSample.Start;

            if (start > end)
            {
                var temp = start;
                start = end;
                end   = temp;
            }
            var length = end - start;

            CurrentSample.Start  = start;
            CurrentSample.Length = length;

            UpdatePositions();
        }
Esempio n. 6
0
        private void SetShufflerMarkers()
        {
            if (Wave == null)
            {
                return;
            }

            Wave.RemoveMarker("PFI");
            Wave.RemoveMarker("FIS");
            Wave.RemoveMarker("FIE");
            Wave.RemoveMarker("FOS");
            Wave.RemoveMarker("FOE");
            Wave.RemoveMarker("SKS");
            Wave.RemoveMarker("SKE");

            var attributes = AutomationAttributesHelper.GetAutomationAttributes(BassTrack.Description);

            foreach (var trigger in attributes.TrackFXTriggers)
            {
                Wave.RemoveMarker("TS" + attributes.TrackFXTriggers.IndexOf(trigger));
                Wave.RemoveMarker("TE" + attributes.TrackFXTriggers.IndexOf(trigger));
            }

            for (var i = 1; i <= 2000; i++)
            {
                Wave.RemoveMarker("S" + i + "S");
                Wave.RemoveMarker("S" + i + "E");
            }

            Wave.AddMarker("PFI", BassTrack.SamplesToSeconds(BassTrack.PreFadeInStart));
            Wave.AddMarker("FIS", BassTrack.SamplesToSeconds(BassTrack.FadeInStart));
            Wave.AddMarker("FIE", BassTrack.SamplesToSeconds(BassTrack.FadeInEnd));
            Wave.AddMarker("FOS", BassTrack.SamplesToSeconds(BassTrack.FadeOutStart));
            Wave.AddMarker("FOE", BassTrack.SamplesToSeconds(BassTrack.FadeOutEnd));

            if (BassTrack.HasSkipSection)
            {
                Wave.AddMarker("SKS", BassTrack.SamplesToSeconds(BassTrack.SkipStart));
                Wave.AddMarker("SKE", BassTrack.SamplesToSeconds(BassTrack.SkipEnd));
            }

            if (TrackSamples != null)
            {
                for (var i = 1; i <= TrackSamples.Count; i++)
                {
                    var trackSample = TrackSamples[i - 1];

                    if (trackSample.Start == 0 && trackSample.Length == 0)
                    {
                        continue;
                    }

                    Wave.AddMarker("S" + i + "S", trackSample.Start);
                    Wave.AddMarker("S" + i + "E", trackSample.Start + trackSample.Length);
                }
            }

            if (!ShowTrackFx)
            {
                return;
            }

            foreach (var trackFx in attributes.TrackFXTriggers)
            {
                Wave.AddMarker("TS" + attributes.TrackFXTriggers.IndexOf(trackFx), trackFx.Start);
                Wave.AddMarker("TE" + attributes.TrackFXTriggers.IndexOf(trackFx), trackFx.Start + trackFx.Length);
            }
        }
Esempio n. 7
0
 public void PlayTrack(BassTrack track)
 {
     BassPlayerControls.MediaPlayer.OpenFile(track.TrackPath);
     BassPlayerControls.MediaPlayer.Play();
 }
Esempio n. 8
0
 public void AddTrack(BassTrack track)
 {
     tracksList.Add(track);
 }