Performance improvements to controller-base

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@888 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-04-05 04:17:25 +00:00
parent f8369195a0
commit 0bb4bf5221
11 changed files with 99 additions and 27 deletions

View File

@@ -1,3 +1,28 @@
2008-04-04 Paul Giblock <drfaygo/at/gmail/dot/com>
* include/knob.h:
* src/gui/widgets/knob.cpp:
Add friendlyUpdates slot and override doConnections
* include/song_editor.h:
Add button for managing controller to songEditor
* include/mv_base.h:
* include/core/mv_base.cpp:
Make doConnections virtual
* include/combobox.h:
Fixed tabs
* src/core/mixer.cpp:
Couldn't easily convert from void* to int on a 64bit machine. Instead, we
now use a union. We should change any enqueueing code to use the union as
well
* data/themes/add_controller.png:
* data/themes/controller.png:
Some new images for controllers
2008-04-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/mixer.cpp:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -97,25 +97,25 @@ public:
comboBox( QWidget * _parent, const QString & _name = QString::null );
virtual ~comboBox();
comboBoxModel * model( void )
{
return( castModel<comboBoxModel>() );
}
comboBoxModel * model( void )
{
return( castModel<comboBoxModel>() );
}
const comboBoxModel * model( void ) const
{
return( castModel<comboBoxModel>() );
}
const comboBoxModel * model( void ) const
{
return( castModel<comboBoxModel>() );
}
virtual void modelChanged( void )
{
if( model() != NULL )
{
connect( model(), SIGNAL( itemPixmapRemoved( QPixmap * ) ),
this, SLOT( deletePixmap( QPixmap * ) ) );
}
}
virtual void modelChanged( void )
{
if( model() != NULL )
{
QWidget::connect( model(), SIGNAL( itemPixmapRemoved( QPixmap * ) ),
this, SLOT( deletePixmap( QPixmap * ) ) );
}
}
protected:

View File

@@ -70,6 +70,7 @@ public slots:
void connectToMidiDevice( void );
void connectToController( void );
void displayHelp( void );
void friendlyUpdate( void );
signals:
@@ -114,6 +115,10 @@ private:
model()->step() ) );
}
virtual void doConnections( void );
void valueChange( void );
void buttonReleased( void );

View File

@@ -71,6 +71,7 @@ signals:
class modelView
{
public:
modelView( model * _model );
virtual ~modelView()
@@ -98,7 +99,7 @@ protected:
{
}
void doConnections( void );
virtual void doConnections( void );
private:

View File

@@ -96,6 +96,7 @@ private:
toolButton * m_addBBTrackButton;
toolButton * m_addSampleTrackButton;
toolButton * m_addControllerButton;
toolButton * m_drawModeButton;
toolButton * m_editModeButton;

View File

@@ -95,7 +95,15 @@ public:
{
}
JobTypes type;
void * job;
union
{
playHandle * playHandleJob;
audioPort * audioPortJob;
int effectChannelJob;
void * job;
};
volatile bool done;
} ;
@@ -159,11 +167,11 @@ private:
switch( it->type )
{
case PlayHandle:
( (playHandle *) it->job )->play();
it->playHandleJob->play();
break;
case AudioPortEffects:
{
audioPort * a = (audioPort *) it->job;
audioPort * a = it->audioPortJob;
bool me = a->processEffects();
if( a->m_bufferUsage != audioPort::NoUsage || me )
{
@@ -174,8 +182,8 @@ private:
}
break;
case EffectChannel:
engine::getFxMixer()->processChannel(
(fx_ch_t) (int) it->job );
engine::getFxMixer()->processChannel(
(fx_ch_t) it->effectChannelJob );
default:
break;
}

View File

@@ -72,14 +72,14 @@ void modelView::doConnections( void )
{
QWidget * w = dynamic_cast<QWidget *>( this );
QObject::connect( m_model, SIGNAL( dataChanged() ),
w, SLOT( update() ), Qt::QueuedConnection );
w, SLOT( update() ),
Qt::QueuedConnection );
QObject::connect( m_model, SIGNAL( propertiesChanged() ),
w, SLOT( update() ), Qt::QueuedConnection );
}
}
#include "mv_base.moc"

View File

@@ -257,6 +257,12 @@ songEditor::songEditor( song * _song ) :
m_s, SLOT( addSampleTrack() ),
m_toolBar );
m_addControllerButton = new toolButton( embed::getIconPixmap(
"add_controller" ),
tr( "Add controller" ),
m_s, SLOT( addSampleTrack() ),
m_toolBar );
m_drawModeButton = new toolButton( embed::getIconPixmap(
"edit_draw" ),
tr( "Draw mode" ),
@@ -322,6 +328,7 @@ songEditor::songEditor( song * _song ) :
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_addBBTrackButton );
tb_layout->addWidget( m_addSampleTrackButton );
tb_layout->addWidget( m_addControllerButton );
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_drawModeButton );
tb_layout->addWidget( m_editModeButton );

View File

@@ -287,8 +287,9 @@ void knob::contextMenuEvent( QContextMenuEvent * )
SLOT( openInAutomationEditor() ) );
contextMenu.addSeparator();
}
contextMenu.addAction( tr( "Connect to controller..." ), this,
SLOT( connectToController() ) );
contextMenu.addAction( embed::getIconPixmap( "controller" ),
tr( "Connect to controller..." ), this,
SLOT( connectToController() ) );
contextMenu.addSeparator();
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
@@ -586,6 +587,30 @@ void knob::connectToController( void )
}
void knob::friendlyUpdate( void )
{
if( model()->getController() == NULL || controller::runningFrames() % (256*4) == 0 )
{
update();
}
}
void knob::doConnections( void )
{
if( model() != NULL )
{
QObject::connect( model(), SIGNAL( dataChanged() ),
this, SLOT( friendlyUpdate() ),
Qt::QueuedConnection );
QObject::connect( model(), SIGNAL( propertiesChanged() ),
this, SLOT( update() ), Qt::QueuedConnection );
}
}
void knob::displayHelp( void )
{
QWhatsThis::showText( mapToGlobal( rect().bottomRight() ),