added mute-button for each FX-line

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1181 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-27 15:02:10 +00:00
parent 563d5b8b5b
commit 620b4d8a58
4 changed files with 40 additions and 15 deletions

View File

@@ -47,7 +47,6 @@ struct fxChannel
float m_peakRight;
sampleFrame * m_buffer;
boolModel m_muteModel;
boolModel m_soloModel;
floatModel m_volumeModel;
QString m_name;
QMutex m_lock;

View File

@@ -66,8 +66,7 @@ private:
{
fxLine * m_fxLine;
effectRackView * m_rackView;
pixmapButton * m_muteButton;
pixmapButton * m_soloButton;
pixmapButton * m_muteBtn;
fader * m_fader;
} ;

View File

@@ -38,7 +38,6 @@ fxChannel::fxChannel( model * _parent ) :
m_peakRight( 0.0f ),
m_buffer( new sampleFrame[engine::getMixer()->framesPerPeriod()] ),
m_muteModel( FALSE, _parent ),
m_soloModel( FALSE, _parent ),
m_volumeModel( 1.0, 0.0, 2.0, 0.01, _parent ),
m_name(),
m_lock()
@@ -90,15 +89,19 @@ fxMixer::~fxMixer()
void fxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch )
{
m_fxChannels[_ch]->m_lock.lock();
sampleFrame * buf = m_fxChannels[_ch]->m_buffer;
for( f_cnt_t f = 0; f < engine::getMixer()->framesPerPeriod(); ++f )
if( m_fxChannels[_ch]->m_muteModel.value() == FALSE )
{
buf[f][0] += _buf[f][0];
buf[f][1] += _buf[f][1];
m_fxChannels[_ch]->m_lock.lock();
sampleFrame * buf = m_fxChannels[_ch]->m_buffer;
for( f_cnt_t f = 0; f < engine::getMixer()->framesPerPeriod();
++f )
{
buf[f][0] += _buf[f][0];
buf[f][1] += _buf[f][1];
}
m_fxChannels[_ch]->m_used = TRUE;
m_fxChannels[_ch]->m_lock.unlock();
}
m_fxChannels[_ch]->m_used = TRUE;
m_fxChannels[_ch]->m_lock.unlock();
}
@@ -106,8 +109,10 @@ void fxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch )
void fxMixer::processChannel( fx_ch_t _ch )
{
if( m_fxChannels[_ch]->m_used || m_fxChannels[_ch]->m_stillRunning ||
_ch == 0 )
if( m_fxChannels[_ch]->m_muteModel.value() == FALSE &&
( m_fxChannels[_ch]->m_used ||
m_fxChannels[_ch]->m_stillRunning ||
_ch == 0 ) )
{
const fpp_t f = engine::getMixer()->framesPerPeriod();
m_fxChannels[_ch]->m_fxChain.startRunning();
@@ -166,6 +171,13 @@ const surroundSampleFrame * fxMixer::masterMix( void )
processChannel( 0 );
if( m_fxChannels[0]->m_muteModel.value() )
{
engine::getMixer()->clearAudioBuffer( m_out,
engine::getMixer()->framesPerPeriod() );
return( m_out );
}
const float v = m_fxChannels[0]->m_volumeModel.value();
for( f_cnt_t f = 0; f < engine::getMixer()->framesPerPeriod(); ++f )
{

View File

@@ -42,6 +42,8 @@
#include "lcd_spinbox.h"
#include "gui_templates.h"
#include "song_editor.h"
#include "tooltip.h"
#include "pixmap_button.h"
@@ -72,7 +74,7 @@ public:
p.setPen( m_mv->currentFxLine() == this ?
QColor( 0, 255, 0 ) : Qt::white );
p.setFont( pointSizeF( font(), 7.5f ) );
p.drawText( -70, 20, m_name );
p.drawText( -90, 20, m_name );
}
virtual void mousePressEvent( QMouseEvent * )
@@ -167,10 +169,23 @@ fxMixerView::fxMixerView() :
l->move( 2, 4 );
l->setMarginWidth( 1 );
cv->m_fader = new fader( &m->m_fxChannels[i]->m_volumeModel,
cv->m_fxLine );
cv->m_fader->move( 15-cv->m_fader->width()/2,
cv->m_fxLine->height()-130 );
cv->m_fxLine->height()-
cv->m_fader->height()-5 );
cv->m_muteBtn = new pixmapButton( cv->m_fxLine, tr( "Mute" ) );
cv->m_muteBtn->setModel( &m->m_fxChannels[i]->m_muteModel );
cv->m_muteBtn->setActiveGraphic(
embed::getIconPixmap( "led_off" ) );
cv->m_muteBtn->setInactiveGraphic(
embed::getIconPixmap( "led_green" ) );
cv->m_muteBtn->setCheckable( TRUE );
cv->m_muteBtn->move( 9, cv->m_fader->y()-16);
toolTip::add( cv->m_muteBtn, tr( "Mute this track" ) );
cv->m_rackView = new effectRackView(
&m->m_fxChannels[i]->m_fxChain, this );
m_fxRacksLayout->addWidget( cv->m_rackView );