Add metrics for BPM and Song Length sorting.

Fixes request 173.
This commit is contained in:
Jason Felds
2011-04-01 01:35:14 -04:00
parent 11a163a395
commit 7a9796f769
2 changed files with 8 additions and 4 deletions
+5 -4
View File
@@ -19,6 +19,9 @@
#include "LuaBinding.h"
#include "EnumHelper.h"
ThemeMetric<int> SORT_BPM_DIVISION ( "MusicWheel", "SortBPMDivision" );
ThemeMetric<int> SORT_LENGTH_DIVISION ( "MusicWheel", "SortLengthDivision" );
bool SongCriteria::Matches( const Song *pSong ) const
{
if( !m_sGroupName.empty() && m_sGroupName != pSong->m_sGroupName )
@@ -595,8 +598,7 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return SORT_NOT_AVAILABLE.GetValue();
case SORT_BPM:
{
// todo: make this a theme metric? -aj
const int iBPMGroupSize = 20;
const int iBPMGroupSize = SORT_BPM_DIVISION;
DisplayBpms bpms;
pSong->GetDisplayBpms( bpms );
int iMaxBPM = (int)bpms.GetMax();
@@ -605,8 +607,7 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
}
case SORT_LENGTH:
{
// todo: make this a theme metric? -aj
const int iSortLengthSize = 5;
const int iSortLengthSize = SORT_LENGTH_DIVISION;
int iMaxLength = (int)pSong->m_fMusicLengthSeconds;
iMaxLength += (iSortLengthSize - (iMaxLength%iSortLengthSize) - 1);
int iMinLength = iMaxLength - (iSortLengthSize-1);