Yeah, BPM segments, big one :D
This commit is contained in:
+1
-85
@@ -9,92 +9,8 @@ struct lua_State;
|
||||
/** @brief Compare a TimingData segment's properties with one another. */
|
||||
#define COMPARE(x) if(x!=other.x) return false;
|
||||
|
||||
/**
|
||||
* @brief Identifies when a song changes its BPM.
|
||||
*/
|
||||
struct BPMSegment
|
||||
{
|
||||
/**
|
||||
* @brief Creates a simple BPM Segment with default values.
|
||||
*
|
||||
* It is best to override the values as soon as possible.
|
||||
*/
|
||||
BPMSegment() : m_iStartRow(-1), m_fBPS(-1.0f) { }
|
||||
/**
|
||||
* @brief Creates a BPM Segment with the specified starting row and beats per second.
|
||||
* @param s the starting row of this segment.
|
||||
* @param b the beats per second to be turned into beats per minute.
|
||||
*/
|
||||
BPMSegment( int s, float b ): m_iStartRow(max(0, s)), m_fBPS(0) { SetBPM( b ); }
|
||||
/**
|
||||
* @brief The row in which the BPMSegment activates.
|
||||
*/
|
||||
int m_iStartRow;
|
||||
/**
|
||||
* @brief The BPS to use when this row is reached.
|
||||
*/
|
||||
float m_fBPS;
|
||||
|
||||
/**
|
||||
* @brief Converts the BPS to a BPM.
|
||||
* @param f The BPM.
|
||||
*/
|
||||
void SetBPM( float f ) { m_fBPS = f / 60.0f; }
|
||||
/**
|
||||
* @brief Retrieves the BPM from the BPS.
|
||||
* @return the BPM.
|
||||
*/
|
||||
float GetBPM() const { return m_fBPS * 60.0f; }
|
||||
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if they are equal to each other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the equality of the two segments.
|
||||
*/
|
||||
bool operator==( const BPMSegment &other ) const
|
||||
{
|
||||
COMPARE( m_iStartRow );
|
||||
COMPARE( m_fBPS );
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if they are not equal to each other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the inequality of the two segments.
|
||||
*/
|
||||
bool operator!=( const BPMSegment &other ) const { return !operator==(other); }
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if one is less than the other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less than the second.
|
||||
*/
|
||||
bool operator<( const BPMSegment &other ) const
|
||||
{
|
||||
return m_iStartRow < other.m_iStartRow ||
|
||||
( m_iStartRow == other.m_iStartRow && m_fBPS < other.m_fBPS );
|
||||
}
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if one is less than or equal to the other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less or equal to than the second.
|
||||
*/
|
||||
bool operator<=( const BPMSegment &other ) const
|
||||
{
|
||||
return ( operator<(other) || operator==(other) );
|
||||
}
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if one is greater than the other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than the second.
|
||||
*/
|
||||
bool operator>( const BPMSegment &other ) const { return !operator<=(other); }
|
||||
/**
|
||||
* @brief Compares two BPMSegments to see if one is greater than or equal to the other.
|
||||
* @param other the other BPMSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than or equal to the second.
|
||||
*/
|
||||
bool operator>=( const BPMSegment &other ) const { return !operator<(other); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Identifies when a song has a stop or a delay.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user