Пример #1
0
        public void LoadModule(Module module)
        {
            Pause();
            _mainPlayer.UnloadAll();
            foreach (var player in _channelPlayers)
            {
                player.UnloadAll();
            }

            _targetBpm  = module.Bpm;
            _loopLength = BpmHelper.GetDefaultLoopLength(_targetBpm);

            Module = module;

            foreach (var audioFile in module.AudioFiles)
            {
                if (File.Exists(audioFile.Path) || _libraryFolder == "" || !_libraryFolder.EndsWith("Library") ||
                    !audioFile.Path.Contains("Library"))
                {
                    continue;
                }

                var index = audioFile.Path.IndexOf("Library", StringComparison.Ordinal) + "Libary".Length + 1;
                var path  = _libraryFolder + audioFile.Path.Substring(index);
                audioFile.Path = path;
            }


            LoadChannelPlayers(module);
            LoadAudioFiles(module);
        }
Пример #2
0
        /// <summary>
        ///     Sets the BPM values.
        /// </summary>
        private void SetBpmValues()
        {
            if (_bindingData)
            {
                return;
            }

            var fadeInLength = BpmHelper.GetDefaultLoopLength(Track.TagBpm);

            if (cmbCustomFadeInLength.Seconds != 0D)
            {
                fadeInLength = cmbCustomFadeInLength.Seconds;
            }
            var startBpm = BpmHelper.GetBpmFromLoopLength(fadeInLength);

            lblStartBPM.Text = startBpm.ToString("0.00");

            var fadeOutLength = BpmHelper.GetDefaultLoopLength(Track.TagBpm);

            if (cmbCustomFadeOutLength.Seconds != 0D)
            {
                fadeOutLength = cmbCustomFadeOutLength.Seconds;
            }
            var endBpm = BpmHelper.GetBpmFromLoopLength(fadeOutLength);

            lblEndBPM.Text = endBpm.ToString("0.00");

            PopulateVolumeDropDown(cmbPreFadeInStartVolume);
        }
        public double GetExtendedFadeOutLength(Track fromTrack, Track toTrack)
        {
            if (fromTrack == null)
            {
                return(0);
            }

            var attributes = GetExtendedMixAttributes(fromTrack, toTrack);

            if (attributes != null)
            {
                return(attributes.FadeLength);
            }
            var fadeOutLength = fromTrack.FullEndLoopLengthSeconds;

            if (fadeOutLength == 0)
            {
                fadeOutLength = BpmHelper.GetDefaultLoopLength(fromTrack.EndBpm);
            }

            if (toTrack != null)
            {
                fadeOutLength = BpmHelper.GetLengthAdjustedToMatchAnotherTrack(fromTrack, toTrack, fadeOutLength);
            }

            return(fadeOutLength);
        }
Пример #4
0
        private string FadeInDescription(Track previousTrack, Track track)
        {
            if (track == null)
            {
                return("");
            }

            var standardStartLength = track.FullStartLoopLengthSeconds;
            var looped    = track.StartLoopCount > 1;
            var powerDown = previousTrack?.PowerDownOnEnd ?? false;

            var description = "Fade In: ";

            description += GetFormattedSeconds(standardStartLength);

            if (powerDown)
            {
                var powerDownFadeIn = BpmHelper.GetDefaultLoopLength(track.StartBpm) / 4D;
                description += " (" + GetFormattedSeconds(powerDownFadeIn) + ")";
            }
            else
            {
                var hasExtendedMix = BassPlayer.HasExtendedMixAttributes(previousTrack, track);
                if (hasExtendedMix)
                {
                    var extendedEndLength = BassPlayer.GetExtendedFadeOutLength(previousTrack, track);
                    description += " (" + GetFormattedSeconds(extendedEndLength) + "*)";
                }
            }

            if (looped)
            {
                description += " looped";
            }

            description += "  " + track.StartBpm.ToString("00.00") + "BPM";

            return(description);
        }
 public void SetBpm(decimal bpm)
 {
     _targetBpm  = bpm;
     _loopLength = BpmHelper.GetDefaultLoopLength(_targetBpm);
 }