add sorting by music length
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 621 B |
@@ -232,6 +232,7 @@ EasyMeterText=EASY METER
|
||||
GenreText=GENRE
|
||||
GroupText=GROUP
|
||||
HardMeterText=HARD METER
|
||||
LengthText=LENGTH
|
||||
MediumMeterText=MEDIUM METER
|
||||
PopularityText=PLAYERS' BEST
|
||||
Portal=PORTAL
|
||||
|
||||
@@ -1769,7 +1769,7 @@ Use3D=false
|
||||
Wheel3DRadius=245 -- Possibly safe defaults?
|
||||
CirclePercent=0.5
|
||||
MostPlayedSongsToShow=30
|
||||
ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,Genre"
|
||||
ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,Genre,Length"
|
||||
ChoicePreferred="sort,Preferred"
|
||||
ChoiceGroup="sort,Group"
|
||||
ChoiceTitle="sort,Title"
|
||||
@@ -1781,6 +1781,7 @@ ChoiceGenre="sort,Genre"
|
||||
ChoiceEasyMeter="sort,EasyMeter"
|
||||
ChoiceMediumMeter="sort,MediumMeter"
|
||||
ChoiceHardMeter="sort,HardMeter"
|
||||
ChoiceLength="sort,Length"
|
||||
|
||||
[RoomWheel]
|
||||
Fallback="MusicWheel"
|
||||
|
||||
@@ -151,6 +151,7 @@ static const char *SortOrderNames[] = {
|
||||
"Nonstop",
|
||||
"Oni",
|
||||
"Endless",
|
||||
"Length",
|
||||
"Roulette",
|
||||
};
|
||||
XToString( SortOrder );
|
||||
|
||||
@@ -119,6 +119,7 @@ enum SortOrder
|
||||
SORT_NONSTOP_COURSES,
|
||||
SORT_ONI_COURSES,
|
||||
SORT_ENDLESS_COURSES,
|
||||
SORT_LENGTH,
|
||||
SORT_ROULETTE,
|
||||
NUM_SortOrder,
|
||||
SortOrder_Invalid
|
||||
|
||||
@@ -417,6 +417,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData *> &arrayWheelItemDat
|
||||
case SORT_MEDIUM_METER:
|
||||
case SORT_HARD_METER:
|
||||
case SORT_CHALLENGE_METER:
|
||||
case SORT_LENGTH:
|
||||
{
|
||||
///////////////////////////////////
|
||||
// Make an array of Song*, then sort them
|
||||
@@ -463,6 +464,9 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData *> &arrayWheelItemDat
|
||||
case SORT_GENRE:
|
||||
SongUtil::SortSongPointerArrayByGenre( arraySongs );
|
||||
break;
|
||||
case SORT_LENGTH:
|
||||
SongUtil::SortSongPointerArrayByLength( arraySongs );
|
||||
break;
|
||||
case SORT_EASY_METER:
|
||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Easy );
|
||||
break;
|
||||
|
||||
@@ -400,6 +400,25 @@ void SongUtil::SortSongPointerArrayByBPM( vector<Song*> &vpSongsInOut )
|
||||
sort( vpSongsInOut.begin(), vpSongsInOut.end(), CompareSongPointersByBPM );
|
||||
}
|
||||
|
||||
static bool CompareSongPointersByLength( const Song *pSong1, const Song *pSong2 )
|
||||
{
|
||||
float length1, length2;
|
||||
length1 = pSong1->m_fMusicLengthSeconds;
|
||||
length2 = pSong2->m_fMusicLengthSeconds;
|
||||
|
||||
if( length1 < length2 )
|
||||
return true;
|
||||
if( length1 > length2 )
|
||||
return false;
|
||||
|
||||
return CompareRStringsAsc( pSong1->GetSongFilePath(), pSong2->GetSongFilePath() );
|
||||
}
|
||||
|
||||
void SongUtil::SortSongPointerArrayByLength( vector<Song*> &vpSongsInOut )
|
||||
{
|
||||
sort( vpSongsInOut.begin(), vpSongsInOut.end(), CompareSongPointersByLength );
|
||||
}
|
||||
|
||||
void AppendOctal( int n, int digits, RString &out )
|
||||
{
|
||||
for( int p = digits-1; p >= 0; --p )
|
||||
@@ -566,6 +585,7 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
|
||||
iMaxBPM += iBPMGroupSize - (iMaxBPM%iBPMGroupSize) - 1;
|
||||
return ssprintf("%03d-%03d",iMaxBPM-(iBPMGroupSize-1), iMaxBPM);
|
||||
}
|
||||
case SORT_LENGTH:
|
||||
case SORT_POPULARITY:
|
||||
return RString();
|
||||
case SORT_TOP_GRADES:
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace SongUtil
|
||||
RString GetSectionNameFromSongAndSort( const Song *pSong, SortOrder so );
|
||||
void SortSongPointerArrayBySectionName( vector<Song*> &vpSongsInOut, SortOrder so );
|
||||
void SortByMostRecentlyPlayedForMachine( vector<Song*> &vpSongsInOut );
|
||||
void SortSongPointerArrayByLength( vector<Song*> &vpSongsInOut );
|
||||
|
||||
int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user