added mute-attribute to TCOs and fixed other small things
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@134 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -114,6 +114,12 @@ bbEditor::bbEditor( engine * _engine ) :
|
||||
tr( "Stop playing of current beat/bassline (Space)" ),
|
||||
this, SLOT( stop() ), m_toolBar );
|
||||
|
||||
toolButton * add_bb_track = new toolButton(
|
||||
embed::getIconPixmap( "add_bb_track" ),
|
||||
tr( "Add beat/bassline" ),
|
||||
eng()->getSongEditor(), SLOT( addBBTrack() ),
|
||||
m_toolBar );
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
m_playButton->setWhatsThis(
|
||||
@@ -144,6 +150,8 @@ bbEditor::bbEditor( engine * _engine ) :
|
||||
tb_layout->addWidget( m_stopButton );
|
||||
tb_layout->addSpacing( 20 );
|
||||
tb_layout->addWidget( m_bbComboBox );
|
||||
tb_layout->addSpacing( 10 );
|
||||
tb_layout->addWidget( add_bb_track );
|
||||
tb_layout->addStretch();
|
||||
tb_layout->addWidget( l );
|
||||
tb_layout->addSpacing( 15 );
|
||||
@@ -198,7 +206,7 @@ void bbEditor::setCurrentBB( int _bb )
|
||||
tact bbEditor::lengthOfBB( csize _bb )
|
||||
{
|
||||
midiTime max_length;
|
||||
|
||||
|
||||
trackVector tv = tracks();
|
||||
for( trackVector::iterator it = tv.begin(); it != tv.end(); ++it )
|
||||
{
|
||||
|
||||
@@ -154,16 +154,16 @@ bool mixer::criticalXRuns( void ) const
|
||||
void mixer::setClipScaling( bool _state )
|
||||
{
|
||||
m_mixMutex.lock();
|
||||
|
||||
|
||||
m_scaleClip = _state;
|
||||
|
||||
|
||||
if( _state )
|
||||
{
|
||||
m_poolDepth = 3;
|
||||
m_readBuffer = 0;
|
||||
m_analBuffer = m_readBuffer + 1;
|
||||
m_writeBuffer = m_poolDepth - 1;
|
||||
|
||||
|
||||
for( ch_cnt_t chnl=0; chnl < m_audioDev->channels(); ++chnl )
|
||||
{
|
||||
m_clipped[chnl] = FALSE;
|
||||
@@ -172,6 +172,9 @@ void mixer::setClipScaling( bool _state )
|
||||
m_previousSample[chnl] = 0.0;
|
||||
m_newBuffer[chnl] = FALSE;
|
||||
}
|
||||
// FIXME: why assign buffer-ptr to m_readBuf just for calling
|
||||
// another method?
|
||||
// clearAudioBuffer(m_bufferPool[i],...) would do as well
|
||||
for( Uint8 i = 0; i < 3; i++ )
|
||||
{
|
||||
m_readBuf = m_bufferPool[i];
|
||||
@@ -185,7 +188,7 @@ void mixer::setClipScaling( bool _state )
|
||||
m_writeBuffer = 1;
|
||||
m_analBuffer = 1;
|
||||
}
|
||||
|
||||
|
||||
m_mixMutex.unlock();
|
||||
}
|
||||
|
||||
@@ -239,16 +242,16 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
// qSwap( m_curBuf, m_nextBuf );
|
||||
m_writeBuffer++;
|
||||
m_writeBuffer %= m_poolDepth;
|
||||
|
||||
|
||||
m_readBuffer++;
|
||||
m_readBuffer %= m_poolDepth;
|
||||
|
||||
|
||||
m_analBuffer++;
|
||||
m_analBuffer %= m_poolDepth;
|
||||
|
||||
|
||||
m_writeBuf = m_bufferPool[m_writeBuffer];
|
||||
m_readBuf = m_bufferPool[m_readBuffer];
|
||||
|
||||
|
||||
// clear last audio-buffer
|
||||
clearAudioBuffer( m_writeBuf, m_framesPerAudioBuffer );
|
||||
|
||||
@@ -280,9 +283,8 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
{
|
||||
if( ( *it )->m_bufferUsage != audioPort::NONE )
|
||||
{
|
||||
processBuffer(
|
||||
( *it )->firstBuffer(),
|
||||
( *it )->nextFxChannel() );
|
||||
processBuffer( ( *it )->firstBuffer(),
|
||||
( *it )->nextFxChannel() );
|
||||
( *it )->nextPeriod();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ trackContentObject::trackContentObject( track * _track ) :
|
||||
m_action( NONE ),
|
||||
m_autoResize( FALSE ),
|
||||
m_initialMouseX( 0 ),
|
||||
m_muted( FALSE ),
|
||||
m_hint( NULL )
|
||||
{
|
||||
if( s_textFloat == NULL )
|
||||
@@ -225,6 +226,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
|
||||
if( m_track->getTrackContainer()->allowRubberband() == TRUE &&
|
||||
_me->button() == Qt::LeftButton )
|
||||
{
|
||||
// if rubberband is active, we can be selected
|
||||
if( m_track->getTrackContainer()->rubberBandActive() == FALSE )
|
||||
{
|
||||
if(
|
||||
@@ -246,11 +248,13 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
|
||||
}
|
||||
else if( getTrack()->eng()->getMainWindow()->isShiftPressed() == TRUE )
|
||||
{
|
||||
// add/remove object to/from selection
|
||||
selectableObject::mousePressEvent( _me );
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
getTrack()->eng()->getMainWindow()->isCtrlPressed() == TRUE )
|
||||
{
|
||||
// start drag-action
|
||||
multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA );
|
||||
saveState( mmp, mmp.content() );
|
||||
#ifdef QT4
|
||||
@@ -272,6 +276,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
|
||||
/* eng()->getMainWindow()->isShiftPressed() == FALSE &&*/
|
||||
fixedTCOs() == FALSE )
|
||||
{
|
||||
// move or resize
|
||||
setJournalling( FALSE );
|
||||
|
||||
m_initialMouseX = _me->x();
|
||||
@@ -307,12 +312,17 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
|
||||
mouseMoveEvent( _me );
|
||||
s_textFloat->show();
|
||||
}
|
||||
else if( ( _me->button() == Qt::MidButton/* ||
|
||||
( _me->button() == Qt::LeftButton &&
|
||||
eng()->getMainWindow()->isShiftPressed() == TRUE )*/ ) &&
|
||||
fixedTCOs() == FALSE )
|
||||
else if( _me->button() == Qt::MidButton )
|
||||
{
|
||||
close();
|
||||
if( getTrack()->eng()->getMainWindow()->isCtrlPressed() )
|
||||
{
|
||||
toggleMute();
|
||||
}
|
||||
else if( fixedTCOs() == FALSE )
|
||||
{
|
||||
// delete ourself
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,9 +474,10 @@ void trackContentObject::contextMenuEvent( QContextMenuEvent * _cme )
|
||||
tr( "Copy" ), this, SLOT( copy() ) );
|
||||
contextMenu.addAction( embed::getIconPixmap( "edit_paste" ),
|
||||
tr( "Paste" ), this, SLOT( paste() ) );
|
||||
//contextMenu.insertSeparator();
|
||||
//contextMenu.insertItem( tr( "&Help" ), this, SLOT( displayHelp() ) );
|
||||
|
||||
contextMenu.insertSeparator();
|
||||
contextMenu.addAction( embed::getIconPixmap( "muted" ),
|
||||
tr( "Mute/unmute (<Ctrl> + middle click)" ),
|
||||
this, SLOT( toggleMute() ) );
|
||||
constructContextMenu( &contextMenu );
|
||||
|
||||
contextMenu.exec( QCursor::pos() );
|
||||
@@ -559,6 +570,15 @@ void trackContentObject::paste( void )
|
||||
|
||||
|
||||
|
||||
void trackContentObject::toggleMute( void )
|
||||
{
|
||||
m_muted = !m_muted;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackContentObject::setAutoResizeEnabled( bool _e )
|
||||
{
|
||||
m_autoResize = _e;
|
||||
@@ -1215,8 +1235,7 @@ void trackWidget::changePosition( const midiTime & _new_pos )
|
||||
|
||||
for( csize i = 0; i < tcos; ++i )
|
||||
{
|
||||
trackContentObject * tco =
|
||||
m_trackContentWidget.getTCO( i );
|
||||
trackContentObject * tco = m_trackContentWidget.getTCO( i );
|
||||
tco->changeLength( tco->length() );
|
||||
Sint32 ts = tco->startPosition();
|
||||
Sint32 te = tco->endPosition();
|
||||
|
||||
@@ -135,7 +135,7 @@ void bbTCO::mouseDoubleClickEvent( QMouseEvent * )
|
||||
void bbTCO::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QColor col = m_color;
|
||||
if( getTrack()->muted() )
|
||||
if( getTrack()->muted() || muted() )
|
||||
{
|
||||
col = QColor( 160, 160, 160 );
|
||||
}
|
||||
@@ -189,7 +189,13 @@ void bbTCO::paintEvent( QPaintEvent * )
|
||||
|
||||
p.setFont( pointSize<7>( p.font() ) );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawText( 2, QFontMetrics( p.font() ).height() - 1, m_name );
|
||||
p.drawText( 2, p.fontMetrics().height() - 1, m_name );
|
||||
|
||||
if( muted() )
|
||||
{
|
||||
p.drawPixmap( 3, p.fontMetrics().height() + 1,
|
||||
embed::getIconPixmap( "muted", 16, 16 ) );
|
||||
}
|
||||
|
||||
#ifndef QT4
|
||||
bitBlt( this, rect().topLeft(), &pm );
|
||||
@@ -211,6 +217,7 @@ void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
_this.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
_this.setAttribute( "len", length() );
|
||||
_this.setAttribute( "muted", muted() );
|
||||
_this.setAttribute( "color", m_color.rgb() );
|
||||
}
|
||||
|
||||
@@ -225,6 +232,11 @@ void bbTCO::loadSettings( const QDomElement & _this )
|
||||
movePosition( _this.attribute( "pos" ).toInt() );
|
||||
}
|
||||
changeLength( _this.attribute( "len" ).toInt() );
|
||||
if( _this.attribute( "muted" ).toInt() != muted() )
|
||||
{
|
||||
toggleMute();
|
||||
}
|
||||
|
||||
if( _this.attribute( "color" ).toUInt() != 0 )
|
||||
{
|
||||
m_color.setRgb( _this.attribute( "color" ).toUInt() );
|
||||
@@ -384,7 +396,8 @@ bool FASTCALL bbTrack::play( const midiTime & _start,
|
||||
for( vlist<trackContentObject *>::iterator it = tcos.begin();
|
||||
it != tcos.end(); ++it )
|
||||
{
|
||||
if( ( *it )->startPosition() >= lastPosition )
|
||||
if( !( *it )->muted() &&
|
||||
( *it )->startPosition() >= lastPosition )
|
||||
{
|
||||
lastPosition = ( *it )->startPosition();
|
||||
lastLen = ( *it )->length();
|
||||
|
||||
@@ -891,7 +891,8 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start,
|
||||
it != tcos.end(); ++it )
|
||||
{
|
||||
pattern * p = dynamic_cast<pattern *>( *it );
|
||||
if( p == NULL )
|
||||
// everything which is not a pattern or muted won't be played
|
||||
if( p == NULL || ( *it )->muted() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ pattern::~pattern()
|
||||
// us before
|
||||
if( eng()->getSongEditor()->playing() &&
|
||||
eng()->getSongEditor()->playMode() ==
|
||||
songEditor::PLAY_PATTERN )
|
||||
songEditor::PLAY_PATTERN )
|
||||
{
|
||||
eng()->getSongEditor()->playPattern( NULL );
|
||||
}
|
||||
@@ -427,6 +427,7 @@ void pattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
_this.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
_this.setAttribute( "len", length() );
|
||||
_this.setAttribute( "muted", muted() );
|
||||
_this.setAttribute( "steps", m_steps );
|
||||
_this.setAttribute( "frozen", m_frozenPattern != NULL );
|
||||
|
||||
@@ -456,6 +457,10 @@ void pattern::loadSettings( const QDomElement & _this )
|
||||
movePosition( _this.attribute( "pos" ).toInt() );
|
||||
}
|
||||
changeLength( midiTime( _this.attribute( "len" ).toInt() ) );
|
||||
if( _this.attribute( "muted" ).toInt() != muted() )
|
||||
{
|
||||
toggleMute();
|
||||
}
|
||||
|
||||
clearNotes();
|
||||
|
||||
@@ -556,7 +561,7 @@ void pattern::freeze( void )
|
||||
QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
if( m_instrumentTrack->muted() )
|
||||
if( m_instrumentTrack->muted() || muted() )
|
||||
{
|
||||
if( QMessageBox::
|
||||
#if QT_VERSION >= 0x030200
|
||||
@@ -565,9 +570,10 @@ void pattern::freeze( void )
|
||||
information
|
||||
#endif
|
||||
|
||||
( 0, tr( "Channel muted" ),
|
||||
tr( "The channel this pattern "
|
||||
"belongs to is "
|
||||
( 0, tr( "Pattern muted" ),
|
||||
tr( "The track this pattern "
|
||||
"belongs to or the "
|
||||
"pattern itself is "
|
||||
"currently muted "
|
||||
"therefore "
|
||||
"freezing makes no "
|
||||
@@ -786,11 +792,6 @@ void pattern::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
|
||||
void pattern::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
/* if( _me->button() != Qt::LeftButton )
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
m_patternType == pattern::BEAT_PATTERN &&
|
||||
( pixelsPerTact() >= 192 ||
|
||||
@@ -1001,7 +1002,7 @@ void pattern::paintEvent( QPaintEvent * )
|
||||
height() - 2 *
|
||||
TCO_BORDER_WIDTH );
|
||||
}
|
||||
if( getTrack()->muted() )
|
||||
if( getTrack()->muted() || muted() )
|
||||
{
|
||||
p.setPen( QColor( 160, 160, 160 ) );
|
||||
}
|
||||
@@ -1110,9 +1111,21 @@ void pattern::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
p.setFont( pointSize<7>( p.font() ) );
|
||||
p.setPen( QColor( 32, 240, 32 ) );
|
||||
p.drawText( 2, 9, m_name );
|
||||
if( m_frozenPattern != NULL )
|
||||
if( muted() || getTrack()->muted() )
|
||||
{
|
||||
p.setPen( QColor( 192, 192, 192 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setPen( QColor( 32, 240, 32 ) );
|
||||
}
|
||||
p.drawText( 2, p.fontMetrics().height() - 1, m_name );
|
||||
if( muted() )
|
||||
{
|
||||
p.drawPixmap( 3, p.fontMetrics().height() + 1,
|
||||
embed::getIconPixmap( "muted", 16, 16 ) );
|
||||
}
|
||||
else if( m_frozenPattern != NULL )
|
||||
{
|
||||
p.setPen( QColor( 0, 224, 255 ) );
|
||||
p.drawRect( 0, 0, width(), height() - 1 );
|
||||
|
||||
@@ -192,7 +192,7 @@ void sampleTCO::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
// TODO: set according brush/pen for gradient!
|
||||
#warning TODO: set according brush for gradient!
|
||||
p.fillRect( _pe->rect(), QColor( 64, 64, 64 ) );
|
||||
#else
|
||||
// create pixmap for our widget
|
||||
@@ -218,7 +218,7 @@ void sampleTCO::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawRect( 0, 0, width(), height() );
|
||||
if( getTrack()->muted() )
|
||||
if( getTrack()->muted() || muted() )
|
||||
{
|
||||
p.setPen( QColor( 128, 128, 128 ) );
|
||||
}
|
||||
@@ -236,6 +236,13 @@ void sampleTCO::paintEvent( QPaintEvent * _pe )
|
||||
p.drawLine( r.x() + r.width(), r.y() + r.height() / 2,
|
||||
width() - 2, r.y() + r.height() / 2 );
|
||||
}
|
||||
|
||||
p.translate( 0, 0 );
|
||||
if( muted() )
|
||||
{
|
||||
p.drawPixmap( 3, 8, embed::getIconPixmap( "muted", 16, 16 ) );
|
||||
}
|
||||
|
||||
#ifndef QT4
|
||||
bitBlt( this, _pe->rect().topLeft(), &pm );
|
||||
#endif
|
||||
@@ -266,6 +273,7 @@ void FASTCALL sampleTCO::saveSettings( QDomDocument & _doc,
|
||||
_this.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
_this.setAttribute( "len", length() );
|
||||
_this.setAttribute( "muted", muted() );
|
||||
_this.setAttribute( "src", sampleFile() );
|
||||
if( sampleFile() == "" )
|
||||
{
|
||||
@@ -290,6 +298,10 @@ void FASTCALL sampleTCO::loadSettings( const QDomElement & _this )
|
||||
m_sampleBuffer.loadFromBase64( _this.attribute( "data" ) );
|
||||
}
|
||||
changeLength( _this.attribute( "len" ).toInt() );
|
||||
if( _this.attribute( "muted" ).toInt() != muted() )
|
||||
{
|
||||
toggleMute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +463,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start,
|
||||
it != tcos.end(); ++it )
|
||||
{
|
||||
sampleTCO * st = dynamic_cast<sampleTCO *>( *it );
|
||||
if( st != NULL )
|
||||
if( st != NULL && !st->muted() )
|
||||
{
|
||||
st->play( buf, _start_frame +
|
||||
static_cast<Uint32>( _start.getTact() *
|
||||
|
||||
Reference in New Issue
Block a user