private void mnuTrackRank_Click(object sender, EventArgs e)
        {
            var toolStripDropDownItem = sender as ToolStripDropDownItem;

            if (toolStripDropDownItem == null)
            {
                return;
            }

            var trackRankDescription = toolStripDropDownItem.Text;
            var trackRank            = MixLibrary.GetRankFromDescription(trackRankDescription);

            var tracks = GetSelectedLibraryTracks();

            Library.SetRank(tracks, (int)trackRank);

            foreach (var track in tracks)
            {
                var trackModel = TrackModels.FirstOrDefault(t => t.Description == track.Description);
                if (trackModel == null)
                {
                    continue;
                }
                trackModel.TrackRankDescription = trackRankDescription;
            }

            //BindData();
            grdPlaylist.InvalidateDisplayedRows();
        }
        private void mnuMixRank_Click(object sender, EventArgs e)
        {
            var toolStripDropDownItem = sender as ToolStripDropDownItem;

            if (toolStripDropDownItem == null)
            {
                return;
            }

            var mixRankDescription = toolStripDropDownItem.Text;
            var mixRank            = MixLibrary.GetRankFromDescription(mixRankDescription);

            foreach (DataGridViewRow row in grdPlaylist.SelectedRows)
            {
                if (row.Index == 0)
                {
                    continue;
                }
                var track2 = GetTrackByIndex(row.Index);
                var track1 = GetTrackByIndex(row.Index - 1);
                MixLibrary.SetMixLevel(track1, track2, (int)mixRank);

                var trackModel = GetTrackModelByIndex(row.Index);
                trackModel.MixRankDescription = mixRankDescription;
            }


            grdPlaylist.InvalidateDisplayedRows();
        }
示例#3
0
        private string GetMixRankDescription(AudioStream currentTrack, AudioStream nextTrack)
        {
            if (currentTrack == null || nextTrack == null)
            {
                return("");
            }

            var currentLibraryTrack = Library.GetTrackByFilename(currentTrack.Filename);
            var nextLibraryTrack    = Library.GetTrackByFilename(nextTrack.Filename);

            if (currentLibraryTrack == null || nextLibraryTrack == null)
            {
                return("");
            }

            var rank           = MixLibrary.GetMixLevel(currentLibraryTrack, nextLibraryTrack);
            var hasExtendedMix = MixLibrary.HasExtendedMix(currentLibraryTrack, nextLibraryTrack);

            var mixRankDescription = MixLibrary.GetRankDescription(rank);

            if (hasExtendedMix)
            {
                mixRankDescription += "*";
            }

            return(mixRankDescription);
        }
 private TrackModel(Track track, MixLibrary mixLibrary)
 {
     Description          = track.Description;
     Filename             = track.Filename;
     LengthFormatted      = track.LengthFormatted;
     IsCurrent            = false;
     Bpm                  = track.Bpm;
     Length               = track.Length;
     TrackRankDescription = mixLibrary.GetRankDescription(track.Rank);
     Key                  = KeyHelper.GetDisplayKey(track.Key);
 }
        /// <summary>
        ///     Binds the rank menu.
        /// </summary>
        private void BindTrackRankMenu()
        {
            var currentTrackRank = -1;

            if (GetSelectedTrack() != null)
            {
                currentTrackRank = GetSelectedTrack().Rank;
            }
            for (var i = 0; i < 6; i++)
            {
                mnuTrackRank.DropDownItems[i].Text = MixLibrary.GetRankDescription(5 - i);
                ((ToolStripMenuItem)mnuTrackRank.DropDownItems[i]).Checked = 5 - i == currentTrackRank;
            }
        }
        /// <summary>
        ///     Binds the rank menu.
        /// </summary>
        private void BindMixRankMenu()
        {
            var currentMixRank = -1;

            if (GetSelectedTracks().Count == 1 && grdPlaylist.SelectedRows[0].Index > 0)
            {
                var track2  = GetSelectedTrack();
                var track1  = GetTrackByIndex(grdPlaylist.SelectedRows[0].Index - 1);
                var mixRank = MixLibrary.GetMixLevel(track1, track2);
                currentMixRank = mixRank;
            }
            for (var i = 0; i < 6; i++)
            {
                mnuMixRank.DropDownItems[i].Text = MixLibrary.GetRankDescription(5 - i);
                ((ToolStripMenuItem)mnuMixRank.DropDownItems[i]).Checked = 5 - i == currentMixRank;
            }
        }
        private void UpdateMixRank(int rowIndex)
        {
            if (rowIndex == 0)
            {
                TrackModels[0].MixRankDescription = "";
                return;
            }

            var track1 = GetTrackByIndex(rowIndex - 1);
            var track2 = GetTrackByIndex(rowIndex);

            if (track1 == null || track2 == null)
            {
                return;
            }

            TrackModels[rowIndex].MixRankDescription = MixLibrary.GetExtendedMixDescription(track1, track2);
            TrackModels[rowIndex].KeyRankDescription = KeyHelper.GetKeyMixRankDescription(track1.Key, track2.Key);
        }
示例#8
0
        private void LoadFromDatabase()
        {
            Library.LoadFromDatabase();
            TrackSampleLibrary.LoadFromCache();

            MixLibrary.AvailableTracks = Library.GetTracks();
            MixLibrary.LoadFromDatabase();

            ExtenedAttributesHelper.ShufflerFolder = Library.ShufflerFolder;
            ExtenedAttributesHelper.LoadFromDatabase();
            Library.LoadAllExtendedAttributes();

            AutomationAttributesHelper.ShufflerFolder = Library.ShufflerFolder;
            AutomationAttributesHelper.LoadFromDatabase();

            CollectionHelper.LoadFromDatabase();

            LoopLibrary.LoadFromCache();
        }
示例#9
0
        private void SetConservativeFadeOutSettings()
        {
            if (!_useConservativeFadeOut)
            {
                return;
            }
            if (BassPlayer.CurrentTrack == null || BassPlayer.NextTrack == null)
            {
                return;
            }

            var track1         = Library.GetTrackByFilename(BassPlayer.CurrentTrack.Filename);
            var track2         = Library.GetTrackByFilename(BassPlayer.NextTrack.Filename);
            var mixRank        = MixLibrary.GetMixLevel(track1, track2);
            var hasExtendedMix = MixLibrary.HasExtendedMix(track1, track2);

            if (mixRank <= 2 && !hasExtendedMix)
            {
                BassPlayer.SetConservativeFadeOutSettings();
            }
        }
        public void SetCurrentMixRank(int mixRank)
        {
            if (BassPlayer.CurrentTrack == null)
            {
                return;
            }

            Track currentTrack = null;

            if (BassPlayer.CurrentTrack != null)
            {
                currentTrack = Library.GetTrackByFilename(BassPlayer.CurrentTrack.Filename);
            }

            var prevTrack = PlaylistControl.GetPreviousTrack();

            if (prevTrack == null)
            {
                return;
            }

            MixLibrary.SetMixLevel(prevTrack, currentTrack, mixRank);
        }
        public int GetCurrentMixRank()
        {
            if (BassPlayer.CurrentTrack == null)
            {
                return(1);
            }

            Track currentTrack = null;

            if (BassPlayer.CurrentTrack != null)
            {
                currentTrack = Library.GetTrackByFilename(BassPlayer.CurrentTrack.Filename);
            }

            var prevTrack = PlaylistControl.GetPreviousTrack();

            if (prevTrack == null)
            {
                return(1);
            }

            return(MixLibrary.GetMixLevel(prevTrack, currentTrack));
        }
示例#12
0
        public ShufflerApplication()
        {
            BassPlayer = new BassPlayer();
            Library    = new Library(BassPlayer);

            CollectionHelper.Library = Library;


            LoopLibrary = new LoopLibrary(BassPlayer);
            LoadSettings();

            MixLibrary         = new MixLibrary(Library.ShufflerFolder);
            TrackSampleLibrary = new TrackSampleLibrary(BassPlayer, Library);

            MidiManager = new MidiManager();
            MidiMapper  = new BassPlayerMidiMapper(BassPlayer, MidiManager);


            //LoopLibrary = new LoopLibrary(BassPlayer, @"E:\OneDrive\Music\Samples\Hiphop\Future Loops Scratch Anthology");

            LoadFromDatabase();

            BassPlayer.OnTrackQueued += BassPlayer_OnTrackQueued;
        }
 /// <summary>
 ///     Initializes this instance.
 /// </summary>
 public void Initialize(MixLibrary mixLibrary, TrackLibraryControl libraryControl)
 {
     _mixLibrary = mixLibrary;
     LoadSettings();
     _libraryControl = libraryControl;
 }
 public static IEnumerable <TrackModel> ToList(IEnumerable <Track> tracks, MixLibrary mixLibrary)
 {
     return(tracks.Select(t => new TrackModel(t, mixLibrary)).ToList());
 }