further refactorization of TimingSegments (use more templates!)

This commit is contained in:
Thai Pangsakulyanont
2011-05-31 19:39:28 +07:00
parent 0d4f95eda1
commit f7e849f045
3 changed files with 163 additions and 211 deletions
+29
View File
@@ -307,6 +307,35 @@ inline int BeatToNoteRowNotRounded( float fBeatNum ) { return (int)( fBeatNum
* @return the beat. */
inline float NoteRowToBeat( int iRow ) { return iRow / (float)ROWS_PER_BEAT; }
// These functions can be useful for function templates,
// where both rows and beats can be specified.
/**
* @brief Convert the note row to note row (returns itself).
* @param row the row to convert.
*/
static inline int ToNoteRow(int row) { return row; }
/**
* @brief Convert the beat to note row.
* @param beat the beat to convert.
*/
static inline int ToNoteRow(float beat) { return BeatToNoteRow(beat); }
/**
* @brief Convert the note row to beat.
* @param row the row to convert.
*/
static inline float ToBeat(int row) { return NoteRowToBeat(row); }
/**
* @brief Convert the beat row to beat (return itself).
* @param beat the beat to convert.
*/
static inline float ToBeat(float beat) { return beat; }
#endif
/**