mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-24 07:58:51 -04:00
Load and save controllers to project
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1015 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -35,25 +35,36 @@
|
||||
#include "mixer.h"
|
||||
#include "controller.h"
|
||||
#include "controller_dialog.h"
|
||||
#include "lfo_controller.h"
|
||||
|
||||
|
||||
unsigned int controller::s_frames = 0;
|
||||
QVector<controller *> controller::s_controllers;
|
||||
|
||||
controller::controller( model * _parent ) :
|
||||
model( _parent )
|
||||
|
||||
|
||||
controller::controller( ControllerTypes _type, model * _parent ) :
|
||||
model( _parent ),
|
||||
m_type( _type )
|
||||
{
|
||||
s_controllers.append( this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
controller::~controller()
|
||||
{
|
||||
printf("controller dtor\n");
|
||||
s_controllers.remove( s_controllers.indexOf( this ) );
|
||||
|
||||
if( engine::getSong() )
|
||||
{
|
||||
engine::getSong()->removeController( this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get current value, with an offset into the current buffer for sample exactness
|
||||
float controller::currentValue( int _offset )
|
||||
{
|
||||
@@ -66,6 +77,7 @@ float controller::currentValue( int _offset )
|
||||
}
|
||||
|
||||
|
||||
|
||||
float controller::value( int _offset )
|
||||
{
|
||||
return 0.5f;
|
||||
@@ -79,6 +91,8 @@ unsigned int controller::runningFrames()
|
||||
return s_frames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get position in seconds
|
||||
float controller::runningTime()
|
||||
{
|
||||
@@ -86,6 +100,7 @@ float controller::runningTime()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controller::triggerFrameCounter( void )
|
||||
{
|
||||
for( int i = 0; i < s_controllers.size(); ++i )
|
||||
@@ -101,11 +116,72 @@ void controller::triggerFrameCounter( void )
|
||||
//emit s_signaler.triggerValueChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controller::resetFrameCounter( void )
|
||||
{
|
||||
s_frames = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
controller * controller::create( ControllerTypes _ct, model * _parent )
|
||||
{
|
||||
controller * c = NULL;
|
||||
|
||||
switch( _ct )
|
||||
{
|
||||
case LfoController: c = new lfoController( _parent ); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return( c );
|
||||
}
|
||||
|
||||
|
||||
|
||||
controller * controller::create( const QDomElement & _this, model * _parent )
|
||||
{
|
||||
controller * c = create(
|
||||
static_cast<ControllerTypes>( _this.attribute( "type" ).toInt() ),
|
||||
_parent );
|
||||
if( c != NULL )
|
||||
{
|
||||
c->restoreState( _this );
|
||||
}
|
||||
|
||||
return( c );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controller::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "type", type() );
|
||||
_this.setAttribute( "name", name() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controller::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
if( _this.attribute( "type" ).toInt() != type() )
|
||||
{
|
||||
qWarning( "controller-type does not match controller-type of "
|
||||
"settings-node!\n" );
|
||||
}
|
||||
|
||||
setName( _this.attribute( "muted" ) );
|
||||
}
|
||||
|
||||
|
||||
QString controller::nodeName( void ) const
|
||||
{
|
||||
return( "controller" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
controllerDialog * controller::createDialog( QWidget * _parent )
|
||||
{
|
||||
controllerDialog * d = new controllerDialog( this, _parent );
|
||||
|
||||
Reference in New Issue
Block a user