Improved metronome (on/off during song, pattern and bb playback)

There is a new tool button that can be used to turn the metronome on and
off. Per default the metronome is turned off. When enabled the metronome
will during on song playback, pattern playback and BB playback. During
export it is ignored.

A new icon was added as well.

The state is currently stored in the Mixer. It might make sense to put
the metronome configuration in its own class in the future. The state is
currently not stored in the file but this might be a good choice for now
until a better place is found for the metronome data.

Also removed some repeated calls to Engine::getSong() and
Engine::fxMixer().
This commit is contained in:
Michael Gregorius
2015-08-17 21:33:36 +02:00
parent 8fd5fe90d2
commit 5b2e77b444
6 changed files with 52 additions and 13 deletions

View File

@@ -78,7 +78,8 @@ MainWindow::MainWindow() :
m_recentlyOpenedProjectsMenu( NULL ),
m_toolsMenu( NULL ),
m_autoSaveTimer( this ),
m_viewMenu( NULL )
m_viewMenu( NULL ),
m_metronomeToggle( 0 )
{
setAttribute( Qt::WA_DeleteOnClose );
@@ -430,6 +431,13 @@ void MainWindow::finalize()
this, SLOT( enterWhatsThisMode() ),
m_toolBar );
m_metronomeToggle = new ToolButton(
embed::getIconPixmap( "metronome" ),
tr( "Toggle metronome" ),
this, SLOT( onToggleMetronome() ),
m_toolBar );
m_metronomeToggle->setCheckable(true);
m_metronomeToggle->setChecked(Engine::mixer()->isMetronomeActive());
m_toolBarLayout->setColumnMinimumWidth( 0, 5 );
m_toolBarLayout->addWidget( project_new, 0, 1 );
@@ -439,6 +447,7 @@ void MainWindow::finalize()
m_toolBarLayout->addWidget( project_save, 0, 5 );
m_toolBarLayout->addWidget( project_export, 0, 6 );
m_toolBarLayout->addWidget( whatsthis, 0, 7 );
m_toolBarLayout->addWidget( m_metronomeToggle, 0, 8 );
// window-toolbar
@@ -1209,6 +1218,17 @@ void MainWindow::updateConfig( QAction * _who )
}
void MainWindow::onToggleMetronome()
{
Mixer * mixer = Engine::mixer();
mixer->setMetronomeActive( m_metronomeToggle->isChecked() );
}
void MainWindow::toggleControllerRack()
{
toggleWindow( gui->getControllerRackView() );