mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 20:26:24 -04:00
- moved framesPerTact() from songEditor to engine
- update frames per tact only when changes happen git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@275 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -139,8 +139,6 @@ public:
|
||||
bool mayChangeProject( void );
|
||||
|
||||
|
||||
float framesPerTact( void ) const;
|
||||
|
||||
// file management
|
||||
void createNewProject( void );
|
||||
void FASTCALL createNewProjectFromTemplate( const QString & _template );
|
||||
@@ -311,6 +309,10 @@ private:
|
||||
friend class engine;
|
||||
|
||||
|
||||
private slots:
|
||||
void updateFramesPerTact( void );
|
||||
|
||||
|
||||
signals:
|
||||
void tempoChanged( bpm_t _new_bpm );
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "engine.h"
|
||||
#include "main_window.h"
|
||||
#include "mixer.h"
|
||||
#include "pattern.h"
|
||||
#include "piano_roll.h"
|
||||
#include "preset_preview_play_handle.h"
|
||||
#include "project_notes.h"
|
||||
@@ -105,6 +106,15 @@ void engine::close( void )
|
||||
|
||||
|
||||
|
||||
void engine::updateFramesPerTact( void )
|
||||
{
|
||||
m_frames_per_tact = m_mixer->sampleRate() * 60.0f * BEATS_PER_TACT
|
||||
/ m_songEditor->getTempo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
engineObject::engineObject( engine * _engine ) :
|
||||
m_engine( _engine )
|
||||
|
||||
@@ -204,6 +204,9 @@ songEditor::songEditor( engine * _engine ) :
|
||||
|
||||
eng()->getMainWindow()->addSpacingToToolBar( 10 );
|
||||
|
||||
connect( eng()->getMixer(), SIGNAL( sampleRateChanged() ), this,
|
||||
SLOT( updateFramesPerTact() ) );
|
||||
|
||||
|
||||
|
||||
QLabel * master_vol_lbl = new QLabel( tb );
|
||||
@@ -755,6 +758,7 @@ void songEditor::setTempo( int _new_bpm )
|
||||
m_bpmSpinBox->setInitValue(
|
||||
tLimit<bpm_t>( _new_bpm, MIN_BPM, MAX_BPM ) );
|
||||
setModified();
|
||||
eng()->updateFramesPerTact();
|
||||
emit tempoChanged( _new_bpm );
|
||||
}
|
||||
|
||||
@@ -976,7 +980,8 @@ void songEditor::processNextBuffer( void )
|
||||
}
|
||||
|
||||
f_cnt_t total_frames_played = 0;
|
||||
f_cnt_t frames_per_tact = static_cast<f_cnt_t>( framesPerTact() );
|
||||
f_cnt_t frames_per_tact = static_cast<f_cnt_t>(
|
||||
eng()->framesPerTact() );
|
||||
if( m_playPos[m_playMode].currentFrame() == 0 &&
|
||||
m_playPos[m_playMode].getTact64th() > 0 )
|
||||
{
|
||||
@@ -1175,7 +1180,7 @@ void songEditor::setPlayPos( tact _tact_num, tact64th _t_64th, playModes
|
||||
m_playPos[_play_mode].setTact( _tact_num );
|
||||
m_playPos[_play_mode].setTact64th( _t_64th );
|
||||
m_playPos[_play_mode].setCurrentFrame( static_cast<f_cnt_t>(
|
||||
_t_64th * framesPerTact() / 64.0f ) );
|
||||
_t_64th * eng()->framesPerTact() / 64.0f ) );
|
||||
if( _play_mode == m_playMode )
|
||||
{
|
||||
updateTimeLinePosition();
|
||||
@@ -1316,18 +1321,6 @@ void songEditor::addSampleTrack( void )
|
||||
|
||||
|
||||
|
||||
float songEditor::framesPerTact( void ) const
|
||||
{
|
||||
// when fooling around with tempo while playing, we sometimes get
|
||||
// 0 here which leads to FP-exception, so handle it separately
|
||||
const int bpm = tMax( 1, m_bpmSpinBox->value() );
|
||||
return( eng()->getMixer()->sampleRate() * 60.0f * BEATS_PER_TACT /
|
||||
bpm );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bpm_t songEditor::getTempo( void )
|
||||
{
|
||||
return( m_bpmSpinBox->value() );
|
||||
@@ -1775,6 +1768,15 @@ void songEditor::exportProject( void )
|
||||
|
||||
|
||||
|
||||
|
||||
void songEditor::updateFramesPerTact( void )
|
||||
{
|
||||
eng()->updateFramesPerTact();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "song_editor.moc"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user