/// <summary> /// Method that will filter the current playlist and return the songs that are acording to the correct BPM Interval /// </summary> /// <param name="bpmInterval"> Interval of BPM's allowed in the playlist</param> /// <returns>Playlist of songs with the beats per minute acording to the passed interval</returns> private SongDataColl GetSongsWithBPM(BPMInterval bpmInterval) { SongDataColl playlist = new SongDataColl(); foreach (var song in _songCollection) { if( song.BPM <= bpmInterval.MaxBPM && song.BPM >= bpmInterval.MinBPM ) playlist.Add(song); } return playlist; }
private void ExportPlaylist() { BPMInterval bpmInterval = new BPMInterval(); bpmInterval = NRMAnalytics.GetBPM( Convert.ToInt32(_textBoxDistance.Text), Convert.ToInt32(_textBoxDuration.Text)); //TODO:Remove this code and determine the calculator formula //bpmInterval.MinBPM = 0; //bpmInterval.MaxBPM = 200; SongDataColl playlist = GetSongsWithBPM(bpmInterval); string path = "c:\\"; PlaylistToXML.ExportPlaylist(playlist, path); foreach (var item in playlist) { _bindingSourceFinalPlaylist.Add(item); } MessageBox.Show("Playlist exported to the folder: " + path, "Export Playlist.", MessageBoxButtons.OK, MessageBoxIcon.Information); }