frames computation based on 64th of a tact, fixes BB-pattern arbitrary positioning in song editor

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@281 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2006-08-06 21:33:29 +00:00
parent 1d0be3f734
commit cd4932feff
6 changed files with 28 additions and 35 deletions

View File

@@ -105,16 +105,16 @@ public:
void close( void );
float framesPerTact( void ) const
float framesPerTact64th( void ) const
{
return( m_frames_per_tact );
return( m_frames_per_tact64th );
}
void updateFramesPerTact( void );
void updateFramesPerTact64th( void );
private:
bool m_hasGUI;
float m_frames_per_tact;
float m_frames_per_tact64th;
mixer * m_mixer;
mainWindow * m_mainWindow;

View File

@@ -107,24 +107,21 @@ public:
}
// calculate number of frame that are needed this time
inline f_cnt_t frames( const float _frames_per_tact ) const
inline f_cnt_t frames( const float _frames_per_tact64th ) const
{
if( m_tact >= 0 )
{
return( static_cast<f_cnt_t>( m_tact *
_frames_per_tact +
m_tact64th *
_frames_per_tact /
64.0f ) );
return( static_cast<f_cnt_t>( ( m_tact * 64
+ m_tact64th ) * _frames_per_tact64th ) );
}
return( 0 );
}
static inline midiTime fromFrames( const f_cnt_t _frames,
const float _frames_per_tact )
const float _frames_per_tact64th )
{
return( midiTime( static_cast<Sint32>( _frames * 64.0f /
_frames_per_tact ) ) );
return( midiTime( static_cast<Sint32>( _frames /
_frames_per_tact64th ) ) );
}