fixed potential segfault and small GUI-improvement

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@567 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-09-25 00:07:34 +00:00
parent a53a1e3843
commit b8df7b4b8d
6 changed files with 30 additions and 14 deletions

View File

@@ -1,3 +1,17 @@
2007-09-25 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/mixer.h:
* include/visualization_widget.h:
* src/core/mixer.cpp:
* src/widget/visualization_widget.cpp:
reworked code for retrieving current mixer-buffer for visualizing it -
do not use signal/slot-mechanism for passing pointer and use
currentReadBuffer() + mixer-mutex instead which probably fixes some
mixer-related crashes
* src/widget/effect_label.cpp:
set window-title for effect-chain-windows of a sample-track etc.
2007-09-16 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/ladspa_effect/ladspa_subplugin_features.cpp:

View File

@@ -188,9 +188,9 @@ public:
return( m_framesPerPeriod );
}
inline const surroundSampleFrame * currentAudioBuffer( void ) const
inline const surroundSampleFrame * currentReadBuffer( void ) const
{
return( m_writeBuf );
return( m_readBuf );
}
@@ -298,7 +298,7 @@ public slots:
signals:
void sampleRateChanged( void );
void nextAudioBuffer( const surroundSampleFrame *, int _frames );
void nextAudioBuffer( void );
private:

View File

@@ -54,7 +54,7 @@ protected:
protected slots:
void setAudioBuffer( const surroundSampleFrame * _ab, int _frames );
void updateAudioBuffer( void );
private:

View File

@@ -376,11 +376,10 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
}
}
emit nextAudioBuffer( m_readBuf, m_framesPerPeriod );
unlock();
emit nextAudioBuffer();
// and trigger LFOs
envelopeAndLFOWidget::triggerLFO();

View File

@@ -64,6 +64,7 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
engine::getMainWindow()->workspace()->addWindow( m_effWidget );
m_effWidget->setWindowTitle( _initial_name );
m_effWidget->setFixedSize( 240, 242 );
m_effWidget->hide();
connect( m_effWidget, SIGNAL( closed() ),
@@ -92,6 +93,7 @@ QString effectLabel::text( void ) const
void FASTCALL effectLabel::setText( const QString & _text )
{
m_label->setText( _text );
m_effWidget->setWindowTitle( _text );
}

View File

@@ -63,10 +63,8 @@ visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p,
m_updateTimer->start( UPDATE_TIME );
}
connect( engine::getMixer(), SIGNAL( nextAudioBuffer(
const surroundSampleFrame *, int ) ),
this, SLOT( setAudioBuffer(
const surroundSampleFrame *, int ) ) );
connect( engine::getMixer(), SIGNAL( nextAudioBuffer() ),
this, SLOT( updateAudioBuffer() ) );
toolTip::add( this, tr( "click to enable/disable visualization of "
"master-output" ) );
@@ -83,12 +81,15 @@ visualizationWidget::~visualizationWidget()
void visualizationWidget::setAudioBuffer( const surroundSampleFrame * _ab,
int _frames )
void visualizationWidget::updateAudioBuffer( void )
{
if( m_enabled == TRUE )
{
memcpy( m_buffer, *_ab, _frames * BYTES_PER_SURROUND_FRAME);
engine::getMixer()->lock();
memcpy( m_buffer, engine::getMixer()->currentReadBuffer(),
engine::getMixer()->framesPerPeriod() *
BYTES_PER_SURROUND_FRAME );
engine::getMixer()->unlock();
}
}