* completely new automation-system with automation-tracks and automation-patterns as well as song-global automation

* made modelView take a QWidget-pointer argument
* trackContentObject-ctor now calls track::addTCO() directly
* optimize various loops to use iterators/const_iterators instead of a running index variable
* drag'n'drop doesn't fool around with pointers anymore - instead use unique journalling-IDs
* moved drag'n'drop handling code from knob to automatableModelView so that all controls can benefit from that



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1164 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-23 22:36:33 +00:00
parent 81ec8833f5
commit 9bebe4325b
98 changed files with 1321 additions and 1088 deletions

View File

@@ -33,7 +33,7 @@
#include "engine.h"
audioPort::audioPort( const QString & _name, track * _track ) :
audioPort::audioPort( const QString & _name ) :
m_bufferUsage( NoUsage ),
m_firstBuffer( new sampleFrame[engine::getMixer()->framesPerPeriod()] ),
m_secondBuffer( new sampleFrame[
@@ -41,7 +41,7 @@ audioPort::audioPort( const QString & _name, track * _track ) :
m_extOutputEnabled( FALSE ),
m_nextFxChannel( 0 ),
m_name( "unnamed port" ),
m_effects( _track )
m_effects( NULL )
{
engine::getMixer()->clearAudioBuffer( m_firstBuffer,
engine::getMixer()->framesPerPeriod() );

View File

@@ -28,7 +28,6 @@
#include "automatable_model.h"
#include "automation_pattern.h"
#include "automation_editor.h"
#include "controller_connection.h"
@@ -63,9 +62,7 @@ automatableModel::automatableModel( DataType _type,
m_range( _max - _min ),
m_displayName( _display_name ),
m_journalEntryReady( FALSE ),
m_controllerConnection( NULL ),
m_automationPattern( NULL ),
m_track( NULL )
m_controllerConnection( NULL )
{
}
@@ -74,7 +71,6 @@ automatableModel::automatableModel( DataType _type,
automatableModel::~automatableModel()
{
delete m_automationPattern;
while( m_linkedModels.empty() == FALSE )
{
m_linkedModels.last()->unlinkModel( this );
@@ -89,28 +85,24 @@ automatableModel::~automatableModel()
bool automatableModel::isAutomated( void ) const
{
return( automationPattern::isAutomated( this ) );
}
void automatableModel::saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name )
{
if( m_automationPattern && m_automationPattern->getTimeMap().size()
> 1 )
if( isAutomated() )
{
QDomElement pattern_element;
QDomNode node = _this.namedItem(
automationPattern::classNodeName() );
if( node.isElement() )
{
pattern_element = node.toElement();
}
else
{
pattern_element = _doc.createElement(
automationPattern::classNodeName() );
_this.appendChild( pattern_element );
}
QDomElement element = _doc.createElement( _name );
m_automationPattern->saveSettings( _doc, element );
pattern_element.appendChild( element );
QDomElement me = _doc.createElement( _name );
me.setAttribute( "id", id() );
me.setAttribute( "value", m_value );
_this.appendChild( me );
}
else
{
@@ -142,18 +134,29 @@ void automatableModel::saveSettings( QDomDocument & _doc, QDomElement & _this,
void automatableModel::loadSettings( const QDomElement & _this,
const QString & _name )
{
// compat code
QDomNode node = _this.namedItem( automationPattern::classNodeName() );
if( node.isElement() && getAutomationPattern() )
if( node.isElement() )
{
node = node.namedItem( _name );
if( node.isElement() )
{
m_automationPattern->loadSettings( node.toElement() );
setValue( m_automationPattern->valueAt( 0 ) );
automationPattern * p = automationPattern::
globalAutomationPattern( this );
p->loadSettings( node.toElement() );
setValue( p->valueAt( 0 ) );
return;
}
}
node = _this.namedItem( _name );
if( node.isElement() )
{
changeID( node.toElement().attribute( "id" ).toInt() );
setValue( node.toElement().attribute( "value" ).toFloat() );
return;
}
node = _this.namedItem( "connection" );
if( node.isElement() )
{
@@ -197,7 +200,6 @@ void automatableModel::setValue( const float _value )
(*it)->setJournalling( journalling );
}
}
setFirstValue();
emit dataChanged();
}
else
@@ -384,11 +386,11 @@ void automatableModel::linkModels( automatableModel * _model1,
_model1->linkModel( _model2 );
_model2->linkModel( _model1 );
if( _model1->m_automationPattern != _model2->m_automationPattern )
/* if( _model1->m_automationPattern != _model2->m_automationPattern )
{
delete _model2->m_automationPattern;
_model2->m_automationPattern = _model1->m_automationPattern;
}
}*/
}
@@ -399,21 +401,13 @@ void automatableModel::unlinkModels( automatableModel * _model1,
{
_model1->unlinkModel( _model2 );
_model2->unlinkModel( _model1 );
/*
if( _model1->m_automationPattern && _model1->m_automationPattern
== _model2->m_automationPattern )
{
_model2->m_automationPattern = new automationPattern(
*_model1->m_automationPattern, _model2 );
}
}
void automatableModel::initAutomationPattern( void )
{
m_automationPattern = new automationPattern( NULL, this );
}*/
}
@@ -434,49 +428,18 @@ void automatableModel::setControllerConnection( controllerConnection * _c )
automationPattern * automatableModel::getAutomationPattern( void )
{
if( !m_automationPattern )
{
m_automationPattern = new automationPattern( m_track, this );
setFirstValue();
// syncAutomationPattern();
}
return( m_automationPattern );
}
void automatableModel::setFirstValue( void )
{
if( m_automationPattern && m_automationPattern->updateFirst() )
{
m_automationPattern->putValue( 0, m_value, FALSE );
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern()
== m_automationPattern )
{
engine::getAutomationEditor()->update();
}
}
}
void automatableModel::setInitValue( const float _value )
{
m_initValue = _value;
bool journalling = testAndSetJournalling( FALSE );
setValue( _value );
if( m_automationPattern )
{
setFirstValue();
}
setJournalling( journalling );
emit initValueChanged( _value );
}
void automatableModel::reset( void )
{
setValue( initValue<float>() );

View File

@@ -4,6 +4,7 @@
* automation_pattern.cpp - implementation of class automationPattern which
* holds dynamic values
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -27,69 +28,53 @@
#include <Qt/QtXml>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include "automation_pattern.h"
#include "automation_track.h"
#include "automation_editor.h"
#include "bb_track_container.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "note.h"
#include "project_journal.h"
#include "rename_dialog.h"
#include "song.h"
#include "string_pair_drag.h"
#include "templates.h"
#include "track.h"
#include "tooltip.h"
#include "track_container.h"
automationPattern::automationPattern( track * _track,
automatableModel * _object ) :
m_track( _track ),
m_object( _object ),
m_update_first( TRUE ),
automationPattern::automationPattern( automationTrack * _auto_track ) :
trackContentObject( _auto_track ),
m_autoTrack( _auto_track ),
m_objects(),
m_updateFirst( TRUE ),
m_dynamic( FALSE )
{
changeLength( midiTime( 1, 0 ) );
}
automationPattern::automationPattern( const automationPattern & _pat_to_copy ) :
QObject(),
journallingObject(),
m_track( _pat_to_copy.m_track ),
m_object( _pat_to_copy.m_object ),
m_update_first( _pat_to_copy.m_update_first ),
trackContentObject( _pat_to_copy.m_autoTrack ),
m_autoTrack( _pat_to_copy.m_autoTrack ),
m_objects( _pat_to_copy.m_objects ),
m_updateFirst( _pat_to_copy.m_updateFirst ),
m_dynamic( _pat_to_copy.m_dynamic )
{
for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin();
it != _pat_to_copy.m_time_map.end(); ++it )
for( timeMap::const_iterator it = _pat_to_copy.m_timeMap.begin();
it != _pat_to_copy.m_timeMap.end(); ++it )
{
m_time_map[it.key()] = it.value();
}
if( m_dynamic && m_track )
{
m_track->addAutomationPattern( this );
}
}
automationPattern::automationPattern( const automationPattern & _pat_to_copy,
automatableModel * _object ) :
m_track( _pat_to_copy.m_track ),
m_object( _object ),
m_update_first( _pat_to_copy.m_update_first ),
m_dynamic( _pat_to_copy.m_dynamic )
{
for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin();
it != _pat_to_copy.m_time_map.end(); ++it )
{
m_time_map[it.key()] = it.value();
}
if( m_dynamic && m_track )
{
m_track->addAutomationPattern( this );
m_timeMap[it.key()] = it.value();
}
}
@@ -98,31 +83,35 @@ automationPattern::automationPattern( const automationPattern & _pat_to_copy,
automationPattern::~automationPattern()
{
if( m_dynamic && m_track )
{
m_track->removeAutomationPattern( this );
}
if( engine::getAutomationEditor()
&& engine::getAutomationEditor()->currentPattern() == this )
{
engine::getAutomationEditor()->setCurrentPattern( NULL );
}
}
const automatableModel * automationPattern::firstObject( void )
{
if( !m_objects.isEmpty() )
{
return( m_objects.first() );
}
static floatModel _fm;
return( &_fm );
}
//TODO: Improve this
midiTime automationPattern::length( void ) const
{
tick max_length = 0;
for( timeMap::const_iterator it = m_time_map.begin();
it != m_time_map.end();
for( timeMap::const_iterator it = m_timeMap.begin();
it != m_timeMap.end();
++it )
{
max_length = tMax<tick>( max_length, -it.key() );
max_length = tMax<tick>( max_length, it.key() );
}
if( max_length % DefaultTicksPerTact == 0 )
{
@@ -136,7 +125,8 @@ midiTime automationPattern::length( void ) const
midiTime automationPattern::putValue( const midiTime & _time, const float _value,
midiTime automationPattern::putValue( const midiTime & _time,
const float _value,
const bool _quant_pos )
{
midiTime new_time = _quant_pos && engine::getAutomationEditor() ?
@@ -144,17 +134,20 @@ midiTime automationPattern::putValue( const midiTime & _time, const float _value
engine::getAutomationEditor()->quantization() ) :
_time;
m_time_map[-new_time] = _value;
m_timeMap[new_time] = _value;
if( !m_dynamic && new_time != 0 )
{
m_dynamic = TRUE;
if( m_track )
{
m_track->addAutomationPattern( this );
}
}
if( getTrack()->type() == track::HiddenAutomationTrack )
{
changeLength( length() );
}
emit dataChanged();
return( new_time );
}
@@ -165,17 +158,31 @@ void automationPattern::removeValue( const midiTime & _time )
{
if( _time != 0 )
{
m_time_map.remove( -_time );
m_timeMap.remove( _time );
if( m_time_map.size() == 1 )
if( m_timeMap.size() == 1 )
{
m_dynamic = FALSE;
m_object->setValue( m_time_map[0] );
if( m_track )
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
m_track->removeAutomationPattern( this );
if( *it )
{
( *it )->setValue( m_timeMap[0] );
}
else
{
it = m_objects.erase( it );
}
}
}
if( getTrack()->type() == track::HiddenAutomationTrack )
{
changeLength( length() );
}
emit dataChanged();
}
}
@@ -184,7 +191,10 @@ void automationPattern::removeValue( const midiTime & _time )
void automationPattern::clear( void )
{
m_time_map.clear();
m_timeMap.clear();
m_dynamic = FALSE;
m_timeMap[0] = firstObject()->value<float>();
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern() == this )
{
@@ -195,58 +205,6 @@ void automationPattern::clear( void )
float automationPattern::valueAt( const midiTime & _time )
{
return( m_time_map.lowerBound( -_time ).value() );
}
void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
for( timeMap::iterator it = m_time_map.begin(); it != m_time_map.end();
++it )
{
QDomElement element = _doc.createElement( "time" );
element.setAttribute( "pos", -it.key() );
element.setAttribute( "value", it.value() );
_this.appendChild( element );
}
}
void automationPattern::loadSettings( const QDomElement & _this )
{
clear();
for( QDomNode node = _this.firstChild(); !node.isNull();
node = node.nextSibling() )
{
QDomElement element = node.toElement();
if( element.isNull() || element.tagName() != "time" )
{
continue;
}
m_time_map[-element.attribute( "pos" ).toInt()]
= element.attribute( "value" ).toFloat();
}
if( !m_dynamic )
{
m_dynamic = TRUE;
if( m_track )
{
m_track->addAutomationPattern( this );
}
}
}
void automationPattern::openInAutomationEditor( void )
{
engine::getAutomationEditor()->setCurrentPattern( this );
@@ -257,18 +215,77 @@ void automationPattern::openInAutomationEditor( void )
float automationPattern::valueAt( const midiTime & _time )
{
timeMap::const_iterator v = m_timeMap.lowerBound( _time );
return( ( v != m_timeMap.end() ) ? v.value() : (v-1).value() );
}
void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
for( timeMap::const_iterator it = m_timeMap.begin();
it != m_timeMap.end(); ++it )
{
QDomElement element = _doc.createElement( "time" );
element.setAttribute( "pos", it.key() );
element.setAttribute( "value", it.value() );
_this.appendChild( element );
}
for( objectVector::const_iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
QDomElement element = _doc.createElement( "object" );
element.setAttribute( "id", ( *it )->id() );
_this.appendChild( element );
}
}
void automationPattern::loadSettings( const QDomElement & _this )
{
clear();
m_objects.clear();
for( QDomNode node = _this.firstChild(); !node.isNull();
node = node.nextSibling() )
{
QDomElement element = node.toElement();
if( element.isNull() )
{
continue;
}
if( element.tagName() == "time" )
{
m_timeMap[element.attribute( "pos" ).toInt()]
= element.attribute( "value" ).toFloat();
}
else if( element.tagName() == "object" )
{
m_idsToResolve << element.attribute( "id" ).toInt();
}
}
m_dynamic = m_timeMap.size() > 1;
changeLength( length() );
}
const QString automationPattern::name( void )
{
if( m_track )
if( !m_objects.isEmpty() )
{
QString widget_name = m_object->displayName();
/* dynamic_cast<QWidget *>( m_object )->accessibleName();*/
return( m_track->name() + " - " + widget_name );
}
else
{
return( m_object->displayName() );
return( m_objects.first()->fullDisplayName() );
}
return( tr( "No control assigned" ) );
}
@@ -276,16 +293,383 @@ const QString automationPattern::name( void )
void automationPattern::processMidiTime( const midiTime & _time )
{
if( _time >= 0 )
if( _time >= 0 && m_dynamic )
{
m_object->setAutomatedValue(
m_time_map.lowerBound( -_time ).value() );
const float val = valueAt( _time );
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
if( *it )
{
( *it )->setAutomatedValue( val );
}
}
}
}
trackContentObjectView * automationPattern::createView( trackView * _tv )
{
return( new automationPatternView( this, _tv ) );
}
bool automationPattern::isAutomated( const automatableModel * _m )
{
const trackContainer::trackList l = engine::getSong()->tracks() +
engine::getBBTrackContainer()->tracks();
for( trackContainer::trackList::const_iterator it = l.begin();
it != l.end(); ++it )
{
if( ( *it )->type() == track::AutomationTrack )
{
const track::tcoVector & v = ( *it )->getTCOs();
for( track::tcoVector::const_iterator j = v.begin();
j != v.end(); ++j )
{
const automationPattern * a =
dynamic_cast<const
automationPattern *>( *j );
if( a && a->m_dynamic )
{
for( objectVector::const_iterator k = a->m_objects.begin();
k != a->m_objects.end(); ++k )
{
if( *k == _m )
{
return( TRUE );
}
}
}
}
}
}
return( FALSE );
}
automationPattern * automationPattern::globalAutomationPattern(
automatableModel * _m )
{
automationTrack * t = engine::getSong()->globalAutomationTrack();
track::tcoVector v = t->getTCOs();
for( track::tcoVector::const_iterator j = v.begin(); j != v.end(); ++j )
{
automationPattern * a = dynamic_cast<automationPattern *>( *j );
if( a )
{
for( objectVector::const_iterator k =
a->m_objects.begin();
k != a->m_objects.end(); ++k )
{
if( *k == _m )
{
return( a );
}
}
}
}
automationPattern * a = new automationPattern( t );
a->m_objects += _m;
return( a );
}
void automationPattern::resolveAllIDs( void )
{
trackContainer::trackList l = engine::getSong()->tracks() +
engine::getBBTrackContainer()->tracks();
for( trackContainer::trackList::iterator it = l.begin();
it != l.end(); ++it )
{
if( ( *it )->type() == track::AutomationTrack ||
( *it )->type() == track::HiddenAutomationTrack )
{
track::tcoVector v = ( *it )->getTCOs();
for( track::tcoVector::iterator j = v.begin();
j != v.end(); ++j )
{
automationPattern * a =
dynamic_cast<automationPattern *>( *j );
if( a )
{
for( QVector<jo_id_t>::iterator k = a->m_idsToResolve.begin();
k != a->m_idsToResolve.end(); ++k )
{
journallingObject * o = engine::getProjectJournal()->
getJournallingObject( *k );
if( o && dynamic_cast<automatableModel *>( o ) )
{
a->m_objects += dynamic_cast<automatableModel *>( o );
}
}
a->m_idsToResolve.clear();
}
}
}
}
}
automationPatternView::automationPatternView( automationPattern * _pattern,
trackView * _parent ) :
trackContentObjectView( _pattern, _parent ),
m_pat( _pattern ),
m_paintPixmap(),
m_needsUpdate( TRUE )
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( FALSE );
toolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );
}
automationPatternView::~automationPatternView()
{
if( engine::getAutomationEditor()
&& engine::getAutomationEditor()->currentPattern() == m_pat )
{
engine::getAutomationEditor()->setCurrentPattern( NULL );
}
}
void automationPatternView::update( void )
{
m_needsUpdate = TRUE;
// m_pat->changeLength( m_pat->length() );
trackContentObjectView::update();
}
void automationPatternView::resetName( void )
{
//m_pat->setName( m_pat->m_autoTrack->name() );
}
void automationPatternView::changeName( void )
{
QString s = m_pat->name();
renameDialog rename_dlg( s );
rename_dlg.exec();
// m_pat->setName( s );
}
void automationPatternView::constructContextMenu( QMenu * _cm )
{
QAction * a = new QAction( embed::getIconPixmap( "automation" ),
tr( "Open in Automation editor" ), _cm );
_cm->insertAction( _cm->actions()[0], a );
connect( a, SIGNAL( triggered( bool ) ),
m_pat, SLOT( openInAutomationEditor() ) );
_cm->insertSeparator( _cm->actions()[1] );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "edit_erase" ),
tr( "Clear" ), m_pat, SLOT( clear() ) );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ),
this, SLOT( resetName() ) );
_cm->addAction( embed::getIconPixmap( "rename" ), tr( "Change name" ),
this, SLOT( changeName() ) );
_cm->addSeparator();
}
void automationPatternView::mouseDoubleClickEvent( QMouseEvent * _me )
{
if( _me->button() != Qt::LeftButton )
{
_me->ignore();
return;
}
m_pat->openInAutomationEditor();
}
void automationPatternView::paintEvent( QPaintEvent * )
{
if( m_needsUpdate == FALSE )
{
QPainter p( this );
p.drawPixmap( 0, 0, m_paintPixmap );
return;
}
m_needsUpdate = FALSE;
if( m_paintPixmap.isNull() == TRUE || m_paintPixmap.size() != size() )
{
m_paintPixmap = QPixmap( size() );
}
QPainter p( &m_paintPixmap );
QLinearGradient lingrad( 0, 0, 0, height() );
const QColor c = isSelected() ? QColor( 0, 0, 224 ) :
QColor( 96, 96, 96 );
lingrad.setColorAt( 0, c );
lingrad.setColorAt( 0.5, Qt::black );
lingrad.setColorAt( 1, c );
p.setBrush( lingrad );
p.setPen( QColor( 0, 0, 0 ) );
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
const float ppt = fixedTCOs() ?
( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
/ (float) m_pat->length().getTact() :
pixelsPerTact();
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
height() - 2 * TCO_BORDER_WIDTH );
}
const float y_scale = m_pat->firstObject()->maxValue<float>();
for( automationPattern::timeMap::const_iterator it =
m_pat->getTimeMap().begin();
it != m_pat->getTimeMap().end(); ++it )
{
const float x1 = 2 * x_base + it.key() * ppt /
midiTime::ticksPerTact();
float x2;
if( it+1 != m_pat->getTimeMap().end() )
{
x2 = (it+1).key() * ppt / midiTime::ticksPerTact() + 2;
}
else
{
x2 = width() - TCO_BORDER_WIDTH + 1;
}
const float h = ( height()-2*TCO_BORDER_WIDTH ) * it.value() /
y_scale;
p.fillRect( QRectF( x1, height()-TCO_BORDER_WIDTH-h, x2-x1, h ),
QColor( 255, 224, 0 ) );
}
p.setFont( pointSize<7>( p.font() ) );
if( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
{
p.setPen( QColor( 192, 192, 192 ) );
}
else
{
p.setPen( QColor( 32, 240, 32 ) );
}
if( m_pat->name() != m_pat->m_autoTrack->name() )
{
p.drawText( 2, p.fontMetrics().height() - 1, m_pat->name() );
}
if( m_pat->isMuted() )
{
p.drawPixmap( 3, p.fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
p.end();
p.begin( this );
p.drawPixmap( 0, 0, m_paintPixmap );
}
void automationPatternView::dragEnterEvent( QDragEnterEvent * _dee )
{
stringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
}
void automationPatternView::dropEvent( QDropEvent * _de )
{
QString type = stringPairDrag::decodeKey( _de );
QString val = stringPairDrag::decodeValue( _de );
if( type == "automatable_model" )
{
automatableModel * mod = dynamic_cast<automatableModel *>(
engine::getProjectJournal()->
getJournallingObject( val.toInt() ) );
if( mod != NULL )
{
m_pat->m_objects += mod;
}
}
update();
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern() == m_pat )
{
engine::getAutomationEditor()->setCurrentPattern( m_pat );
}
}
#include "automation_pattern.moc"

View File

@@ -244,14 +244,13 @@ void bbTrackContainer::createTCOsForBB( int _bb )
return;
}
QList<track *> tl = tracks();
trackList tl = tracks();
for( int i = 0; i < tl.size(); ++i )
{
while( tl[i]->numOfTCOs() < _bb + 1 )
{
midiTime position = midiTime( tl[i]->numOfTCOs(), 0 );
trackContentObject * tco = tl[i]->addTCO(
tl[i]->createTCO( position ) );
trackContentObject * tco = tl[i]->createTCO( position );
tco->movePosition( position );
tco->changeLength( midiTime( 1, 0 ) );
}

View File

@@ -29,15 +29,13 @@
#include "effect_chain.h"
#include "effect.h"
#include "engine.h"
#include "track.h"
#include "debug.h"
effectChain::effectChain( track * _track ) :
model( _track ),
m_track( _track ),
effectChain::effectChain( model * _parent ) :
model( _parent ),
m_enabledModel( FALSE )
{
}
@@ -111,21 +109,18 @@ void effectChain::loadSettings( const QDomElement & _this )
void effectChain::appendEffect( effect * _effect )
{
engine::getMixer()->lock();
_effect->m_enabledModel.setTrack( m_track );
_effect->m_wetDryModel.setTrack( m_track );
_effect->m_gateModel.setTrack( m_track );
_effect->m_autoQuitModel.setTrack( m_track );
m_effects.append( _effect );
engine::getMixer()->unlock();
emit dataChanged();
}
void effectChain::removeEffect( effect * _effect )
{
engine::getMixer()->lock();

View File

@@ -49,7 +49,6 @@ QVector<envelopeAndLFOParameters *> envelopeAndLFOParameters::s_EaLParametersIns
envelopeAndLFOParameters::envelopeAndLFOParameters(
float _value_for_zero_amount,
track * _track,
model * _parent ) :
model( _parent ),
m_used( FALSE ),
@@ -80,24 +79,6 @@ envelopeAndLFOParameters::envelopeAndLFOParameters(
{
s_EaLParametersInstances.push_back( this );
m_predelayModel.setTrack( _track );
m_attackModel.setTrack( _track );
m_holdModel.setTrack( _track );
m_decayModel.setTrack( _track );
m_sustainModel.setTrack( _track );
m_releaseModel.setTrack( _track );
m_amountModel.setTrack( _track );
m_lfoPredelayModel.setTrack( _track );
m_lfoAttackModel.setTrack( _track );
m_lfoSpeedModel.setTrack( _track );
m_lfoAmountModel.setTrack( _track );
m_lfoWaveModel.setTrack( _track );
m_x100Model.setTrack( _track );
m_controlEnvAmountModel.setTrack( _track );
connect( &m_predelayModel, SIGNAL( dataChanged() ),
this, SLOT( updateSampleVars() ) );
connect( &m_attackModel, SIGNAL( dataChanged() ),

View File

@@ -45,7 +45,6 @@ fxChannel::fxChannel( model * _parent ) :
{
engine::getMixer()->clearAudioBuffer( m_buffer,
engine::getMixer()->framesPerPeriod() );
m_volumeModel.setTrack( engine::getSong()->getAutomationTrack() );
}

View File

@@ -167,23 +167,17 @@ const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y;
chordCreator::chordCreator( instrumentTrack * _instrument_track ) :
model( _instrument_track ),
chordCreator::chordCreator( model * _parent ) :
model( _parent ),
m_chordsEnabledModel( FALSE, this ),
m_chordsModel( this, tr( "Chord type" ) ),
m_chordRangeModel( 1.0f, 1.0f, 9.0f, 1.0f, this, tr( "Chord range" ) )
{
m_chordsEnabledModel.setTrack( _instrument_track );
m_chordsModel.setTrack( _instrument_track );
for( int i = 0; s_chordTable[i].interval[0] != -1; ++i )
{
m_chordsModel.addItem( tr( s_chordTable[i].name.toAscii().
constData() ) );
}
m_chordRangeModel.setTrack( _instrument_track );
}
@@ -280,8 +274,8 @@ void chordCreator::loadSettings( const QDomElement & _this )
arpeggiator::arpeggiator( instrumentTrack * _instrument_track ) :
model( _instrument_track ),
arpeggiator::arpeggiator( model * _parent ) :
model( _parent ),
m_arpEnabledModel( FALSE ),
m_arpModel( this, tr( "Arpeggio type" ) ),
m_arpRangeModel( 1.0f, 1.0f, 9.0f, 1.0f, this, tr( "Arpeggio range" ) ),
@@ -290,9 +284,6 @@ arpeggiator::arpeggiator( instrumentTrack * _instrument_track ) :
m_arpDirectionModel( 0, 0, NumArpDirections, this, tr( "Arpeggio direction" ) ),
m_arpModeModel( this, tr( "Arpeggio mode" ) )
{
m_arpEnabledModel.setTrack( _instrument_track );
m_arpModel.setTrack( _instrument_track );
for( int i = 0; chordCreator::s_chordTable[i].interval[0] != -1; ++i )
{
m_arpModel.addItem( chordCreator::tr(
@@ -300,16 +291,8 @@ arpeggiator::arpeggiator( instrumentTrack * _instrument_track ) :
name.toAscii().constData() ) );
}
m_arpRangeModel.setTrack( _instrument_track );
m_arpTimeModel.setTrack( _instrument_track );
m_arpGateModel.setTrack( _instrument_track );
m_arpDirectionModel.setTrack( _instrument_track );
m_arpDirectionModel.setInitValue( ArpDirUp );
m_arpModeModel.setTrack( _instrument_track );
m_arpModeModel.addItem( tr( "Free" ), new pixmapLoader( "arp_free" ) );
m_arpModeModel.addItem( tr( "Sort" ), new pixmapLoader( "arp_sort" ) );
m_arpModeModel.addItem( tr( "Sync" ), new pixmapLoader( "arp_sync" ) );

View File

@@ -76,12 +76,9 @@ instrumentSoundShaping::instrumentSoundShaping(
}
m_envLFOParameters[i] = new envelopeAndLFOParameters(
value_for_zero_amount,
_instrument_track,
this );
}
m_filterEnabledModel.setTrack( _instrument_track );
m_filterModel.addItem( tr( "LowPass" ),
new pixmapLoader( "filter_lp" ) );
m_filterModel.addItem( tr( "HiPass" ),
@@ -98,11 +95,6 @@ instrumentSoundShaping::instrumentSoundShaping(
new pixmapLoader( "filter_lp" ) );
m_filterModel.addItem( tr( "2x LowPass" ),
new pixmapLoader( "filter_2lp" ) );
m_filterModel.setTrack( _instrument_track );
m_filterCutModel.setTrack( _instrument_track );
m_filterResModel.setTrack( _instrument_track );
}

View File

@@ -138,6 +138,26 @@ void journallingObject::addJournalEntry( const journalEntry & _je )
void journallingObject::changeID( jo_id_t _id )
{
if( id() != _id )
{
if( engine::getProjectJournal()->getJournallingObject( _id )
!= NULL )
{
printf( "JO-ID %d already in use by another "
"object!\n", _id );
return;
}
engine::getProjectJournal()->forgetAboutID( id() );
engine::getProjectJournal()->reallocID( _id, this );
m_id = _id;
}
}
void journallingObject::saveJournal( QDomDocument & _doc,
QDomElement & _parent )
{
@@ -181,12 +201,7 @@ void journallingObject::loadJournal( const QDomElement & _this )
return;
}
if( id() != new_id )
{
engine::getProjectJournal()->forgetAboutID( id() );
engine::getProjectJournal()->reallocID( new_id, this );
m_id = new_id;
}
changeID( new_id );
m_journalEntries.resize( _this.attribute( "entries" ).toInt() );

View File

@@ -1,6 +1,7 @@
/*
* ladspa_control.cpp - model for controlling a LADSPA port
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -28,7 +29,7 @@
ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
track * _track, bool _link ) :
bool _link ) :
model( _parent ),
m_link( _link ),
m_port( _port ),
@@ -39,7 +40,6 @@ ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
{
if( m_link )
{
m_linkEnabledModel.setTrack( _track );
connect( &m_linkEnabledModel, SIGNAL( dataChanged() ),
this, SLOT( linkStateChanged() ) );
@@ -48,7 +48,6 @@ ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
switch( m_port->data_type )
{
case TOGGLED:
m_toggledModel.setTrack( _track );
connect( &m_toggledModel, SIGNAL( dataChanged() ),
this, SLOT( ledChanged() ) );
if( m_port->def == 1.0f )
@@ -58,7 +57,6 @@ ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
break;
case INTEGER:
m_knobModel.setTrack( _track );
m_knobModel.setRange( static_cast<int>( m_port->max ),
static_cast<int>( m_port->min ),
1 + static_cast<int>( m_port->max -
@@ -70,7 +68,6 @@ ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
break;
case FLOAT:
m_knobModel.setTrack( _track );
m_knobModel.setRange( m_port->min, m_port->max,
( m_port->max - m_port->min )
/ ( m_port->name.toUpper() == "GAIN"
@@ -82,7 +79,6 @@ ladspaControl::ladspaControl( model * _parent, port_desc_t * _port,
break;
case TIME:
m_tempoSyncKnobModel.setTrack( _track );
m_tempoSyncKnobModel.setRange( m_port->min, m_port->max,
( m_port->max -
m_port->min ) / 400.0f );

View File

@@ -26,14 +26,11 @@
#include "meter_model.h"
meterModel::meterModel( ::model * _parent, track * _track ) :
meterModel::meterModel( ::model * _parent ) :
model( _parent ),
m_numeratorModel( 4, 1, 32, this ),
m_denominatorModel( 4, 1, 32, this )
{
m_numeratorModel.setTrack( _track );
m_denominatorModel.setTrack( _track );
connect( &m_numeratorModel, SIGNAL( dataChanged() ),
this, SIGNAL( dataChanged() ) );
connect( &m_denominatorModel, SIGNAL( dataChanged() ),

View File

@@ -42,8 +42,8 @@ midiController::midiController( model * _parent ) :
controller( MidiController, _parent ),
midiEventProcessor(),
m_midiPort( tr( "unnamed_midi_controller" ),
engine::getMixer()->getMIDIClient(), this,
this, NULL, midiPort::Input ),
engine::getMixer()->getMIDIClient(), this, this,
midiPort::Input ),
m_lastValue( 0.0f )
{
connect( &m_midiPort, SIGNAL( modeChanged() ),
@@ -52,6 +52,7 @@ midiController::midiController( model * _parent ) :
midiController::~midiController()
{
}

View File

@@ -36,7 +36,7 @@
midiPort::midiPort( const QString & _name, midiClient * _mc,
midiEventProcessor * _mep, model * _parent,
track * _track, Modes _mode ) :
Modes _mode ) :
model( _parent ),
m_readablePortsMenu( NULL ),
m_writablePortsMenu( NULL ),
@@ -61,11 +61,6 @@ midiPort::midiPort( const QString & _name, midiClient * _mc,
{
m_midiClient->addPort( this );
m_inputChannelModel.setTrack( _track );
m_outputChannelModel.setTrack( _track );
m_defaultVelocityInEnabledModel.setTrack( _track );
m_defaultVelocityOutEnabledModel.setTrack( _track );
m_readableModel.setValue( m_mode == Input || m_mode == Duplex );
m_writableModel.setValue( m_mode == Output || m_mode == Duplex );

View File

@@ -641,6 +641,16 @@ void multimediaProject::upgrade( void )
}
}
if( version < "0.4.0-svn20080622" )
{
QDomNodeList list = elementsByTagName( "automation-pattern" );
for( int i = 0; !list.item( i ).isNull(); ++i )
{
QDomElement el = list.item( i ).toElement();
el.setTagName( "automationpattern" );
}
}
// Time-signature
if ( !m_head.hasAttribute( "timesig_numerator" ) )

View File

@@ -36,25 +36,25 @@ QString model::fullDisplayName( void ) const
const QString & n = displayName();
if( parentModel() )
{
if( !n.isEmpty() )
const QString p = parentModel()->fullDisplayName();
if( n.isEmpty() && p.isEmpty() )
{
return parentModel()->fullDisplayName() + ": " + n;
return QString::null;
}
else
else if( p.isEmpty() )
{
return parentModel()->fullDisplayName();
return( n );
}
return p + ">" + n;
}
else
{
return n;
}
return n;
}
modelView::modelView( model * _model ) :
modelView::modelView( model * _model, QWidget * _this ) :
m_widget( _this ),
m_model( _model )
{
}
@@ -64,9 +64,6 @@ modelView::modelView( model * _model ) :
void modelView::setModel( model * _model, bool _old_model_valid )
{
QWidget * w = dynamic_cast<QWidget *>( this );
assert( w != NULL );
if( _old_model_valid && m_model != NULL )
{
if( m_model->defaultConstructed() )
@@ -75,14 +72,14 @@ void modelView::setModel( model * _model, bool _old_model_valid )
}
else
{
m_model->disconnect( w );
m_model->disconnect( widget() );
}
}
m_model = _model;
doConnections();
w->update();
widget()->update();
modelChanged();
}
@@ -94,13 +91,13 @@ void modelView::doConnections( void )
{
if( m_model != NULL )
{
QWidget * w = dynamic_cast<QWidget *>( this );
QObject::connect( m_model, SIGNAL( dataChanged() ),
w, SLOT( update() ),
Qt::QueuedConnection );
widget(), SLOT( update() ),
Qt::QueuedConnection );
QObject::connect( m_model, SIGNAL( propertiesChanged() ),
w, SLOT( update() ), Qt::QueuedConnection );
widget(), SLOT( update() ),
Qt::QueuedConnection );
}
}

View File

@@ -3,7 +3,7 @@
/*
* note.cpp - implementation of class note
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -239,7 +239,8 @@ void note::redoStep( journalEntry & _je )
void note::editDetuningPattern( void )
{
m_detuning->getAutomationPattern()->openInAutomationEditor();
#warning: TODO
// m_detuning->getAutomationPattern()->openInAutomationEditor();
}
@@ -247,8 +248,9 @@ void note::editDetuningPattern( void )
void note::createDetuning( void )
{
#warning: TODO
m_detuning = new detuningHelper;
m_detuning->initAutomationPattern();
// m_detuning->initAutomationPattern();
m_detuning->setRange( -MaxDetuning, MaxDetuning, 0.1f );
}
@@ -257,9 +259,11 @@ void note::createDetuning( void )
bool note::hasDetuningInfo( void )
{
automationPattern::timeMap map =
#warning: TODO
/* automationPattern::timeMap map =
m_detuning->getAutomationPattern()->getTimeMap();
return( map.size() > 1 || map[0] != 0 );
return( map.size() > 1 || map[0] != 0 );*/
return( FALSE );
}

View File

@@ -39,7 +39,7 @@
inline notePlayHandle::baseDetuning::baseDetuning(
detuningHelper * _detuning ) :
m_detuning( _detuning ),
m_value( m_detuning->getAutomationPattern()->valueAt( 0 ) )
m_value( /*m_detuning->getAutomationPattern()->valueAt( 0 )*/ 0 )
{
}
@@ -451,13 +451,14 @@ void notePlayHandle::processMidiTime( const midiTime & _time )
{
if( _time >= pos() )
{
float v = detuning()->getAutomationPattern()->valueAt( _time -
#warning: TODO
/* float v = detuning()->getAutomationPattern()->valueAt( _time -
pos() );
if( v != m_base_detuning->value() )
{
m_base_detuning->setValue( v );
updateFrequency();
}
}*/
}
}

View File

@@ -179,7 +179,7 @@ void piano::handleKeyRelease( int _key )
*/
pianoView::pianoView( QWidget * _parent ) :
QWidget( _parent ), /*!< Our parent */
modelView( NULL ), /*!< Our view model */
modelView( NULL, this ), /*!< Our view model */
m_piano( NULL ), /*!< Our piano model */
m_startKey( Key_C + Octave_3*KeysPerOctave ), /*!< The first key displayed? */
m_lastKey( -1 ) /*!< The last key displayed? */
@@ -400,7 +400,8 @@ void pianoView::contextMenuEvent( QContextMenuEvent * _me )
}
captionMenu contextMenu( tr( "Base note" ) );
automatableModelView amv( m_piano->m_instrumentTrack->baseNoteModel() );
automatableModelView amv( m_piano->m_instrumentTrack->baseNoteModel(),
&contextMenu );
amv.addDefaultActions( &contextMenu );
contextMenu.exec( QCursor::pos() );
}

View File

@@ -122,7 +122,7 @@ jo_id_t projectJournal::allocID( journallingObject * _obj )
void projectJournal::reallocID( const jo_id_t _id, journallingObject * _obj )
{
//printf("realloc %d %d\n", _id, _obj );
if( m_joIDs.contains( _id ) )
// if( m_joIDs.contains( _id ) )
{
m_joIDs[_id] = _obj;
}

View File

@@ -41,7 +41,7 @@ samplePlayHandle::samplePlayHandle( const QString & _sample_file ) :
m_sampleBuffer( new sampleBuffer( _sample_file ) ),
m_doneMayReturnTrue( TRUE ),
m_frame( 0 ),
m_audioPort( new audioPort( "samplePlayHandle", NULL ) ),
m_audioPort( new audioPort( "samplePlayHandle" ) ),
m_ownAudioPort( TRUE ),
m_defaultVolumeModel( 1.0f, 0.0f, 4.0f, 0.001f/* this*/ ),
m_volumeModel( &m_defaultVolumeModel ),
@@ -58,7 +58,7 @@ samplePlayHandle::samplePlayHandle( sampleBuffer * _sample_buffer ) :
m_sampleBuffer( sharedObject::ref( _sample_buffer ) ),
m_doneMayReturnTrue( TRUE ),
m_frame( 0 ),
m_audioPort( new audioPort( "samplePlayHandle", NULL ) ),
m_audioPort( new audioPort( "samplePlayHandle" ) ),
m_ownAudioPort( TRUE ),
m_defaultVolumeModel( 1.0f, 0.0f, 4.0f, 0.001f/* this*/ ),
m_volumeModel( &m_defaultVolumeModel ),

View File

@@ -69,9 +69,11 @@ tick midiTime::s_ticksPerTact = DefaultTicksPerTact;
song::song( void ) :
trackContainer(),
m_automationTrack( track::create( track::AutomationTrack, this ) ),
m_globalAutomationTrack( dynamic_cast<automationTrack *>(
track::create( track::HiddenAutomationTrack,
this ) ) ),
m_tempoModel( DefaultTempo, MinTempo, MaxTempo, this ),
m_timeSigModel( this, m_automationTrack ),
m_timeSigModel( this ),
m_oldTicksPerTact( DefaultTicksPerTact ),
m_masterVolumeModel( 100, 0, 200, this ),
m_masterPitchModel( 0, -12, 12, this ),
@@ -88,7 +90,6 @@ song::song( void ) :
m_patternToPlay( NULL ),
m_loopPattern( FALSE )
{
m_tempoModel.setTrack( m_automationTrack );
connect( &m_tempoModel, SIGNAL( dataChanged() ),
this, SLOT( setTempo() ) );
connect( &m_tempoModel, SIGNAL( dataUnchanged() ),
@@ -101,9 +102,6 @@ song::song( void ) :
SLOT( updateFramesPerTick() ) );
m_masterVolumeModel.setTrack( m_automationTrack );
m_masterPitchModel.setTrack( m_automationTrack );
connect( &m_masterVolumeModel, SIGNAL( dataChanged() ),
this, SLOT( masterVolumeChanged() ) );
/* connect( &m_masterPitchModel, SIGNAL( dataChanged() ),
@@ -119,7 +117,7 @@ song::song( void ) :
song::~song()
{
m_playing = FALSE;
delete m_automationTrack;
delete m_globalAutomationTrack;
}
@@ -289,13 +287,13 @@ void song::processNextBuffer( void )
return;
}
QList<track *> trackList;
trackList track_list;
Sint16 tco_num = -1;
switch( m_playMode )
{
case Mode_PlaySong:
trackList = tracks();
track_list = tracks();
// at song-start we have to reset the LFOs
if( m_playPos[Mode_PlaySong] == 0 )
{
@@ -304,7 +302,7 @@ void song::processNextBuffer( void )
break;
case Mode_PlayTrack:
trackList.push_back( m_trackToPlay );
track_list.push_back( m_trackToPlay );
break;
case Mode_PlayBB:
@@ -312,7 +310,7 @@ void song::processNextBuffer( void )
{
tco_num = engine::getBBTrackContainer()->
currentBB();
trackList.push_back( bbTrack::findBBTrack(
track_list.push_back( bbTrack::findBBTrack(
tco_num ) );
}
break;
@@ -322,7 +320,7 @@ void song::processNextBuffer( void )
{
tco_num = m_patternToPlay->getTrack()->
getTCONum( m_patternToPlay );
trackList.push_back(
track_list.push_back(
m_patternToPlay->getTrack() );
}
break;
@@ -332,7 +330,7 @@ void song::processNextBuffer( void )
}
if( trackList.empty() == TRUE )
if( track_list.empty() == TRUE )
{
return;
}
@@ -441,15 +439,16 @@ void song::processNextBuffer( void )
{
if( m_playMode == Mode_PlaySong )
{
m_automationTrack->play( m_playPos[m_playMode],
m_globalAutomationTrack->play(
m_playPos[m_playMode],
played_frames,
total_frames_played, tco_num );
}
// loop through all tracks and play them
for( int i = 0; i < trackList.size(); ++i )
for( int i = 0; i < track_list.size(); ++i )
{
trackList[i]->play( m_playPos[m_playMode],
track_list[i]->play( m_playPos[m_playMode],
played_frames,
total_frames_played, tco_num );
}
@@ -543,10 +542,10 @@ void song::playPattern( pattern * _patternToPlay, bool _loop )
void song::updateLength( void )
{
m_length = 0;
const QList<track *> & ctl = tracks();
for( int i = 0; i < ctl.size(); ++i )
for( trackList::const_iterator it = tracks().begin();
it != tracks().end(); ++it )
{
const tact cur = ctl[i]->length();
const tact cur = ( *it )->length();
if( cur > m_length )
{
m_length = cur;
@@ -617,10 +616,10 @@ void song::stopExport( void )
void song::insertBar( void )
{
QList<track *> tl = tracks();
for( int i = 0; i < tl.size(); ++i )
for( trackList::iterator it = tracks().begin();
it != tracks().end(); ++it )
{
tl[i]->insertTact( m_playPos[Mode_PlaySong] );
( *it )->insertTact( m_playPos[Mode_PlaySong] );
}
}
@@ -629,10 +628,10 @@ void song::insertBar( void )
void song::removeBar( void )
{
QList<track *> tl = tracks();
for( int i = 0; i < tl.size(); ++i )
for( trackList::iterator it = tracks().begin();
it != tracks().end(); ++it )
{
tl[i]->removeTact( m_playPos[Mode_PlaySong] );
( *it )->removeTact( m_playPos[Mode_PlaySong] );
}
}
@@ -657,6 +656,14 @@ void song::addSampleTrack( void )
void song::addAutomationTrack( void )
{
(void) track::create( track::AutomationTrack, this );
}
bpm_t song::getTempo( void )
{
return( m_tempoModel.value() );
@@ -667,7 +674,7 @@ bpm_t song::getTempo( void )
automationPattern * song::tempoAutomationPattern( void )
{
return( m_tempoModel.getAutomationPattern() );
return( automationPattern::globalAutomationPattern( &m_tempoModel ) );
}
@@ -705,9 +712,11 @@ void song::clearProject( void )
{
engine::getAutomationEditor()->setCurrentPattern( NULL );
}
m_tempoModel.getAutomationPattern()->clear();
m_masterVolumeModel.getAutomationPattern()->clear();
m_masterPitchModel.getAutomationPattern()->clear();
automationPattern::globalAutomationPattern( &m_tempoModel )->clear();
automationPattern::globalAutomationPattern( &m_masterVolumeModel )->
clear();
automationPattern::globalAutomationPattern( &m_masterPitchModel )->
clear();
engine::getMixer()->unlock();
@@ -907,15 +916,17 @@ void song::loadProject( const QString & _file_name )
node = node.nextSibling();
}
engine::getMixer()->unlock();
// Connect controller links to their controllers
// now that everything is loaded
controllerConnection::finalizeConnections();
configManager::inst()->addRecentlyOpenedProject( _file_name );
// resolve all IDs so that autoModels are automated
automationPattern::resolveAllIDs();
QCoreApplication::instance()->processEvents();
engine::getMixer()->unlock();
configManager::inst()->addRecentlyOpenedProject( _file_name );
engine::getProjectJournal()->setJournalling( TRUE );

View File

@@ -184,14 +184,12 @@ void surroundArea::mouseReleaseEvent( QMouseEvent * )
surroundAreaModel::surroundAreaModel( ::model * _parent, track * _track,
surroundAreaModel::surroundAreaModel( ::model * _parent,
bool _default_constructed ) :
model( _parent, _default_constructed ),
m_posX( 0, -SURROUND_AREA_SIZE, SURROUND_AREA_SIZE, _parent ),
m_posY( 0, -SURROUND_AREA_SIZE, SURROUND_AREA_SIZE, _parent )
{
m_posX.setTrack( _track );
m_posY.setTrack( _track );
connect( &m_posX, SIGNAL( dataChanged() ),
this, SIGNAL( dataChanged() ) );
connect( &m_posY, SIGNAL( dataChanged() ),
@@ -271,6 +269,7 @@ void surroundAreaModel::loadSettings( const QDomElement & _this,
/*
automationPattern * surroundAreaModel::automationPatternX( void )
{
return( m_posX.getAutomationPattern() );
@@ -280,9 +279,7 @@ automationPattern * surroundAreaModel::automationPatternY( void )
{
return( m_posY.getAutomationPattern() );
}
*/
#include "surround_area.moc"

View File

@@ -113,7 +113,7 @@ trackContentObject::trackContentObject( track * _track ) :
m_length(),
m_mutedModel( FALSE, this )
{
m_mutedModel.setTrack( _track );
m_track->addTCO( this );
setJournalling( FALSE );
movePosition( 0 );
changeLength( 0 );
@@ -302,7 +302,7 @@ void trackContentObject::toggleMute( void )
trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
trackView * _tv ) :
selectableObject( _tv->getTrackContentWidget() ),
modelView( NULL ),
modelView( NULL, this ),
m_tco( _tco ),
m_trackView( _tv ),
m_action( NoAction ),
@@ -1069,8 +1069,7 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
{
const midiTime pos = getPosition( _de->pos().x()
).toNearestTact();
trackContentObject * tco = getTrack()->addTCO(
getTrack()->createTCO( pos ) );
trackContentObject * tco = getTrack()->createTCO( pos );
// value contains our XML-data so simply create a
// multimediaProject which does the rest for us...
@@ -1109,8 +1108,7 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
{
const midiTime pos = getPosition( _me->x() ).getTact() *
midiTime::ticksPerTact();
trackContentObject * tco = getTrack()->addTCO(
getTrack()->createTCO( pos ) );
trackContentObject * tco = getTrack()->createTCO( pos );
tco->saveJournallingState( FALSE );
tco->movePosition( pos );
@@ -1241,9 +1239,8 @@ void trackContentWidget::undoStep( journalEntry & _je )
case RemoveTrackContentObject:
{
trackContentObject * tco =
getTrack()->addTCO( getTrack()->createTCO(
midiTime( 0 ) ) );
trackContentObject * tco = getTrack()->createTCO(
midiTime( 0 ) );
multimediaProject mmp(
_je.data().toMap()["state"].toString(), FALSE );
tco->restoreState(
@@ -1346,8 +1343,7 @@ QPixmap * trackOperationsWidget::s_muteOnEnabled; /*!< Mute on and enabled pix
*/
trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
QWidget( _parent ), /*!< The parent widget */
m_trackView( _parent ), /*!< The parent track view */
m_automationDisabled( FALSE ) /*!< Automation enabled flag */
m_trackView( _parent ) /*!< The parent track view */
{
if( s_grip == NULL )
{
@@ -1405,13 +1401,6 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_soloBtn->show();
toolTip::add( m_soloBtn, tr( "Solo" ) );
if( inBBEditor() )
{
connect( engine::getBBEditor(),
SIGNAL( positionChanged( const midiTime & ) ),
this, SLOT( update() ) );
}
connect( this, SIGNAL( trackRemovalScheduled( trackView * ) ),
m_trackView->getTrackContainerView(),
SLOT( deleteTrackView( trackView * ) ),
@@ -1486,37 +1475,6 @@ void trackOperationsWidget::paintEvent( QPaintEvent * _pe )
if( m_trackView->isMovingTrack() == FALSE )
{
p.drawPixmap( 2, 2, *s_grip );
if( inBBEditor() )
{
bbTrack * bb_track = currentBBTrack();
if( !bb_track || bb_track->automationDisabled(
m_trackView->getTrack() ) )
{
if( !m_automationDisabled )
{
m_automationDisabled = TRUE;
setObjectName( "automationDisabled" );
setStyle( NULL );
/* m_muteBtn->setActiveGraphic(
*s_muteOffEnabled );
m_muteBtn->setInactiveGraphic(
*s_muteOnEnabled );*/
}
}
else
{
if( m_automationDisabled )
{
m_automationDisabled = FALSE;
setObjectName( "automationEnabled" );
setStyle( NULL );
/* m_muteBtn->setActiveGraphic(
*s_muteOffEnabled );
m_muteBtn->setInactiveGraphic(
*s_muteOnEnabled );*/
}
}
}
m_trackOps->show();
m_muteBtn->show();
}
@@ -1565,28 +1523,6 @@ void trackOperationsWidget::updateMenu( void )
{
QMenu * to_menu = m_trackOps->menu();
to_menu->clear();
if( inBBEditor() )
{
bbTrack * bb_track = currentBBTrack();
if( bb_track )
{
if( bb_track->automationDisabled(
m_trackView->getTrack() ) )
{
to_menu->addAction( embed::getIconPixmap(
"led_off", 16, 16 ),
tr( "Enable automation" ),
this, SLOT( enableAutomation() ) );
}
else
{
to_menu->addAction( embed::getIconPixmap(
"led_green", 16, 16 ),
tr( "Disable automation" ),
this, SLOT( disableAutomation() ) );
}
}
}
to_menu->addAction( embed::getIconPixmap( "edit_copy", 16, 16 ),
tr( "Clone this track" ),
this, SLOT( cloneTrack() ) );
@@ -1598,53 +1534,6 @@ void trackOperationsWidget::updateMenu( void )
/*! \brief Enable automation on this track
*
*/
void trackOperationsWidget::enableAutomation( void )
{
currentBBTrack()->enableAutomation( m_trackView->getTrack() );
}
/*! \brief Disable automation on this track
*
*/
void trackOperationsWidget::disableAutomation( void )
{
currentBBTrack()->disableAutomation( m_trackView->getTrack() );
}
/*! \brief Return the current Beat+Bassline track
*
*/
bbTrack * trackOperationsWidget::currentBBTrack( void )
{
return( bbTrack::findBBTrack(
engine::getBBTrackContainer()->currentBB() ) );
}
/*! \brief Are we in the Beat+Bassline Editor?
*
*/
bool trackOperationsWidget::inBBEditor( void )
{
return( m_trackView->getTrackContainerView()
== engine::getBBEditor() );
}
// ===========================================================================
// track
@@ -1668,11 +1557,8 @@ track::track( TrackTypes _type, trackContainer * _tc ) :
m_pixmapLoader( NULL ), /*!< For loading the track's pixmaps */
m_mutedModel( FALSE, this ), /*!< For controlling track muting */
m_soloModel( FALSE, this ), /*!< For controlling track soloing */
m_trackContentObjects(), /*!< The track content objects (segments) */
m_automationPatterns() /*!< The automation patterns applying */
m_trackContentObjects() /*!< The track content objects (segments) */
{
m_mutedModel.setTrack( this );
m_soloModel.setTrack( this );
m_trackContainer->addTrack( this );
}
@@ -1691,38 +1577,12 @@ track::track( TrackTypes _type, trackContainer * _tc ) :
*/
track::~track()
{
if( m_trackContainer == engine::getBBTrackContainer()
&& engine::getSong() )
{
QList<track *> tracks = engine::getSong()->tracks();
for( int i = 0; i < tracks.size(); ++i )
{
if( tracks[i]->type() == BBTrack )
{
bbTrack * bb_track = (bbTrack *)tracks[i];
if( bb_track->automationDisabled( this ) )
{
// Remove reference from bbTrack
bb_track->enableAutomation( this );
}
}
}
}
while( !m_trackContentObjects.isEmpty() )
{
delete m_trackContentObjects.last();
}
m_trackContainer->removeTrack( this );
for( QList<automationPattern *>::iterator it =
m_automationPatterns.begin();
it != m_automationPatterns.end();
++it )
{
( *it )->forgetTrack();
}
}
@@ -1745,6 +1605,8 @@ track * track::create( TrackTypes _tt, trackContainer * _tc )
// case EVENT_TRACK:
// case VIDEO_TRACK:
case AutomationTrack: t = new automationTrack( _tc ); break;
case HiddenAutomationTrack:
t = new automationTrack( _tc, TRUE ); break;
default: break;
}
@@ -1872,7 +1734,7 @@ void track::loadSettings( const QDomElement & _this )
midiTime( 0 ) );
tco->restoreState( node.toElement() );
saveJournallingState( FALSE );
addTCO( tco );
// addTCO( tco );
restoreJournallingState();
}
}
@@ -1958,7 +1820,7 @@ trackContentObject * track::getTCO( int _tco_num )
}
printf( "called track::getTCO( %d ), "
"but TCO %d doesn't exist\n", _tco_num, _tco_num );
return( addTCO( createTCO( _tco_num * midiTime::ticksPerTact() ) ) );
return( createTCO( _tco_num * midiTime::ticksPerTact() ) );
}
@@ -2004,8 +1866,7 @@ int track::getTCONum( trackContentObject * _tco )
* \param _start The MIDI start time of the range.
* \param _end The MIDI endi time of the range.
*/
void track::getTCOsInRange( QList<trackContentObject *> & _tco_v,
const midiTime & _start,
void track::getTCOsInRange( tcoVector & _tco_v, const midiTime & _start,
const midiTime & _end )
{
for( tcoVector::iterator it_o = m_trackContentObjects.begin();
@@ -2020,8 +1881,7 @@ void track::getTCOsInRange( QList<trackContentObject *> & _tco_v,
// now let's search according position for TCO in list
// -> list is ordered by TCO's position afterwards
bool inserted = FALSE;
for( QList<trackContentObject *>::iterator it =
_tco_v.begin();
for( tcoVector::iterator it = _tco_v.begin();
it != _tco_v.end(); ++it )
{
if( ( *it )->startPosition() >= s )
@@ -2139,30 +1999,6 @@ tact track::length( void ) const
/*! \brief Add an automation pattern to this track
*
* \param _pattern the automation pattern to add.
*/
void track::addAutomationPattern( automationPattern * _pattern )
{
m_automationPatterns.append( _pattern );
}
/*! \brief Remove an automation pattern from this track
*
* \param _pattern the automation pattern to remove.
*/
void track::removeAutomationPattern( automationPattern * _pattern )
{
m_automationPatterns.removeAll( _pattern );
}
/*! \brief Invert the track's solo state.
*
* We have to go through all the tracks determining if any other track
@@ -2171,7 +2007,7 @@ void track::removeAutomationPattern( automationPattern * _pattern )
*/
void track::toggleSolo( void )
{
trackContainer::trackList & tl = m_trackContainer->m_tracks;
trackContainer::trackList & tl = m_trackContainer->tracks();
bool solo_before = FALSE;
for( trackContainer::trackList::iterator it = tl.begin();
@@ -2214,24 +2050,6 @@ void track::toggleSolo( void )
/*! \brief Send a time code to all tracks to process.
*
* \param _time the MIDI time to send.
*/
void track::sendMidiTime( const midiTime & _time )
{
for( QList<automationPattern *>::iterator it =
m_automationPatterns.begin();
it != m_automationPatterns.end();
++it )
{
( *it )->processMidiTime( _time );
}
}
// ===========================================================================
@@ -2249,7 +2067,7 @@ void track::sendMidiTime( const midiTime & _time )
*/
trackView::trackView( track * _track, trackContainerView * _tcv ) :
QWidget( _tcv->contentWidget() ), /*!< The Track Container View's content widget. */
modelView( NULL/*_track*/ ), /*!< The model view of this track */
modelView( NULL, this ), /*!< The model view of this track */
m_track( _track ), /*!< The track we're displaying */
m_trackContainerView( _tcv ), /*!< The track Container View we're displayed in */
m_trackOperationsWidget( this ), /*!< Our trackOperationsWidget */

View File

@@ -45,10 +45,7 @@ trackContainer::trackContainer( void ) :
trackContainer::~trackContainer()
{
while( !m_tracks.empty() )
{
delete m_tracks.takeLast();
}
clearAllTracks();
}
@@ -137,7 +134,7 @@ void trackContainer::loadSettings( const QDomElement & _this )
void trackContainer::addTrack( track * _track )
{
if( _track->type() != track::AutomationTrack )
if( _track->type() != track::HiddenAutomationTrack )
{
m_tracks.push_back( _track );
emit trackAdded( _track );
@@ -152,7 +149,7 @@ void trackContainer::removeTrack( track * _track )
int index = m_tracks.indexOf( _track );
if( index != -1 )
{
m_tracks.removeAt( index );
m_tracks.remove( index );
if( engine::getSong() )
{
@@ -175,10 +172,12 @@ void trackContainer::updateAfterTrackAdd( void )
void trackContainer::clearAllTracks( void )
{
while( !m_tracks.empty() )
for( trackList::iterator it = m_tracks.begin();
it != m_tracks.end(); ++it )
{
delete m_tracks.takeLast();
delete *it;
}
m_tracks.clear();
}

View File

@@ -24,13 +24,33 @@
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include "automatable_model_view.h"
#include "automation_pattern.h"
#include "controller_connection_dialog.h"
#include "controller_connection.h"
#include "embed.h"
#include "main_window.h"
#include "string_pair_drag.h"
automatableModelView::automatableModelView( ::model * _model,
QWidget * _this ) :
modelView( _model, _this ),
m_description( QString::null ),
m_unit( QString::null )
{
widget()->setAcceptDrops( TRUE );
}
automatableModelView::~automatableModelView()
{
}
@@ -64,14 +84,11 @@ void automatableModelView::addDefaultActions( QMenu * _menu )
_menu->addSeparator();
if( !_model->nullTrack() )
{
_menu->addAction( embed::getIconPixmap( "automation" ),
automatableModel::tr( "&Open in automation editor" ),
_model->getAutomationPattern(),
SLOT( openInAutomationEditor() ) );
_menu->addSeparator();
}
_menu->addAction( embed::getIconPixmap( "automation" ),
automatableModel::tr( "Edit song-global automation" ),
amvSlots,
SLOT( editSongGlobalAutomation() ) );
_menu->addSeparator();
QString controllerTxt;
if( _model->getControllerConnection() )
@@ -120,9 +137,30 @@ void automatableModelView::setModel( model * _model, bool _old_model_valid )
void automatableModelView::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE )
{
new stringPairDrag( "automatable_model",
QString::number( modelUntyped()->id() ),
QPixmap(), widget() );
_me->accept();
}
else if( _me->button() == Qt::MidButton )
{
modelUntyped()->reset();
}
}
automatableModelViewSlots::automatableModelViewSlots(
automatableModelView * _amv,
QObject * _parent ) :
automatableModelView * _amv,
QObject * _parent ) :
QObject(),
amv( _amv )
{
@@ -189,4 +227,15 @@ void automatableModelViewSlots::removeConnection( void )
}
void automatableModelViewSlots::editSongGlobalAutomation( void )
{
automationPattern::globalAutomationPattern( amv->modelUntyped() )->
openInAutomationEditor();
}
#include "automatable_model_view.moc"

View File

@@ -4,6 +4,7 @@
* automation_editor.cpp - implementation of automationEditor which is used for
* actual setting of dynamic values
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -391,9 +392,9 @@ void automationEditor::setCurrentPattern( automationPattern * _new_pattern )
return;
}
m_minLevel = m_pattern->object()->minValue<float>();
m_maxLevel = m_pattern->object()->maxValue<float>();
m_step = m_pattern->object()->step<float>();
m_minLevel = m_pattern->firstObject()->minValue<float>();
m_maxLevel = m_pattern->firstObject()->maxValue<float>();
m_step = m_pattern->firstObject()->step<float>();
m_scrollLevel = ( m_minLevel + m_maxLevel ) / 2;
// resizeEvent() does the rest for us (scrolling, range-checking
@@ -674,9 +675,9 @@ void automationEditor::mousePressEvent( QMouseEvent * _me )
// and check whether the user clicked on an
// existing value
if( pos_ticks >= -it.key() &&
if( pos_ticks >= it.key() &&
len > 0 &&
pos_ticks <= -it.key() + len &&
pos_ticks <= it.key() + len &&
it.value() == level )
{
break;
@@ -702,13 +703,13 @@ void automationEditor::mousePressEvent( QMouseEvent * _me )
// reset it so that it can be used for
// ops (move, resize) after this
// code-block
it = time_map.find( -new_time );
it = time_map.find( new_time );
}
// move it
m_action = MOVE_VALUE;
int aligned_x = (int)( (float)( (
-it.key() -
it.key() -
m_currentPosition ) *
m_ppt ) / DefaultTicksPerTact );
m_moveXOffset = x - aligned_x - 1;
@@ -726,7 +727,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me )
if( it != time_map.end() )
{
m_pattern->removeValue( -it.key() );
m_pattern->removeValue( it.key() );
engine::getSong()->setModified();
}
}
@@ -859,8 +860,8 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me )
{
// and check whether the cursor is over an
// existing value
if( pos_ticks >= -it.key() &&
pos_ticks <= -it.key() +
if( pos_ticks >= it.key() &&
pos_ticks <= it.key() +
//TODO: Add constant
4 && it.value() == level )
{
@@ -938,10 +939,8 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me )
int pos_ticks = x * DefaultTicksPerTact / m_ppt +
m_currentPosition;
m_selectedTick = pos_ticks -
m_selectStartTick;
if( (int) m_selectStartTick + m_selectedTick <
0 )
m_selectedTick = pos_ticks - m_selectStartTick;
if( (int) m_selectStartTick + m_selectedTick < 0 )
{
m_selectedTick = -static_cast<int>(
m_selectStartTick );
@@ -1031,11 +1030,12 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me )
it != m_selValuesForMove.end(); ++it )
{
midiTime new_value_pos;
if( -it.key() )
if( it.key() )
{
int value_tact = ( -it.key() >> 6 )
#warning broken time-sigs
int value_tact = ( it.key() >> 6 )
+ tact_diff;
int value_ticks = ( -it.key() & 63 )
int value_ticks = ( it.key() & 63 )
+ ticks_diff;
// ensure value_ticks range
if( value_ticks >> 6 )
@@ -1044,12 +1044,12 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me )
>> 6;
value_ticks &= 63;
}
m_pattern->removeValue( -it.key() );
m_pattern->removeValue( it.key() );
new_value_pos = midiTime( value_tact,
value_ticks );
}
new_selValuesForMove[
-m_pattern->putValue( new_value_pos,
m_pattern->putValue( new_value_pos,
it.value () + level_diff,
FALSE )]
= it.value() + level_diff;
@@ -1190,7 +1190,7 @@ void automationEditor::paintEvent( QPaintEvent * _pe )
float level[] = { m_minLevel, m_maxLevel };
for( int i = 0; i < 2; ++i )
{
const QString & label = m_pattern->object()
const QString & label = m_pattern->firstObject()
->displayValue( level[i] );
p.setPen( QColor( 240, 240, 240 ) );
p.drawText( 1, y[i] - font_height + 1,
@@ -1219,7 +1219,7 @@ void automationEditor::paintEvent( QPaintEvent * _pe )
for( ; y >= TOP_MARGIN && level <= m_topLevel;
y -= printable * m_y_delta, level += printable )
{
const QString & label = m_pattern->object()
const QString & label = m_pattern->firstObject()
->displayValue( level );
p.setPen( QColor( 240, 240, 240 ) );
p.drawText( 1, y - font_height + 1,
@@ -1334,15 +1334,14 @@ void automationEditor::paintEvent( QPaintEvent * _pe )
if( validPattern() == TRUE )
{
timeMap & time_map = m_pattern->getTimeMap();
timeMap::iterator it = time_map.end();
timeMap::iterator it = time_map.begin();
do
{
--it;
Sint32 len_ticks = 4;
const float level = it.value();
Sint32 pos_ticks = -it.key();
Sint32 pos_ticks = it.key();
const int x = ( pos_ticks - m_currentPosition ) *
m_ppt / DefaultTicksPerTact;
@@ -1352,18 +1351,17 @@ void automationEditor::paintEvent( QPaintEvent * _pe )
}
int rect_width;
if( it != time_map.begin() )
if( it+1 != time_map.end() )
{
timeMap::iterator it_prev = it;
--it_prev;
Sint32 next_pos_ticks = -it_prev.key();
timeMap::iterator it_prev = it+1;
Sint32 next_pos_ticks = it_prev.key();
int next_x = ( next_pos_ticks
- m_currentPosition ) * m_ppt /
DefaultTicksPerTact;
// skip this value if not in visible area at all
if( next_x < 0 )
if( next_x > width() )
{
continue;
break;
}
rect_width = next_x - x;
}
@@ -1428,7 +1426,8 @@ void automationEditor::paintEvent( QPaintEvent * _pe )
is_selected );
}
else printf("not in range\n");
} while( it != time_map.begin() );
++it;
} while( it != time_map.end() );
}
else
{
@@ -1782,7 +1781,7 @@ void automationEditor::selectAll( void )
timeMap::iterator it = time_map.begin();
m_selectStartTick = 0;
m_selectedTick = -it.key() + len_ticks;
m_selectedTick = it.key() + len_ticks;
m_selectStartLevel = it.value();
m_selectedLevels = 1;
@@ -1839,7 +1838,7 @@ void automationEditor::getSelectedValues( timeMap & _selected_values )
tick len_ticks = DefaultTicksPerTact / 16;
float level = it.value();
tick pos_ticks = -it.key();
tick pos_ticks = it.key();
if( level >= selLevel_start && level <= selLevel_end &&
pos_ticks >= sel_pos_start &&
@@ -1897,7 +1896,7 @@ void automationEditor::cutSelectedValues( void )
it != selected_values.end(); ++it )
{
m_valuesToCopy[it.key()] = it.value();
m_pattern->removeValue( -it.key() );
m_pattern->removeValue( it.key() );
}
}
@@ -1920,7 +1919,7 @@ void automationEditor::pasteValues( void )
for( timeMap::iterator it = m_valuesToCopy.begin();
it != m_valuesToCopy.end(); ++it )
{
m_pattern->putValue( -it.key() + m_currentPosition,
m_pattern->putValue( it.key() + m_currentPosition,
it.value() );
}
@@ -1950,7 +1949,7 @@ void automationEditor::deleteSelectedValues( void )
for( timeMap::iterator it = selected_values.begin();
it != selected_values.end(); ++it )
{
m_pattern->removeValue( -it.key() );
m_pattern->removeValue( it.key() );
}
if( update_after_delete == TRUE )

View File

@@ -34,7 +34,7 @@
controllerDialog::controllerDialog( controller * _controller,
QWidget * _parent ) :
QWidget( _parent ),
modelView( _controller )
modelView( _controller, this )
{
}

View File

@@ -36,7 +36,7 @@
effectControlDialog::effectControlDialog( effectControls * _controls ) :
QWidget( NULL ),
modelView( _controls ),
modelView( _controls, this ),
m_effectControls( _controls )
{
setWindowTitle( m_effectControls->getEffect()->publicName() );

View File

@@ -106,7 +106,7 @@ private:
fxMixerView::fxMixerView() :
QWidget(),
modelView( NULL )
modelView( NULL, this )
{
fxMixer * m = engine::getFxMixer();

View File

@@ -602,7 +602,8 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x,
int middle_y = _y + KEY_LINE_HEIGHT / 2;
_p.setPen( QColor( 0xFF, 0xDF, 0x20 ) );
timeMap & map = _n->detuning()->getAutomationPattern()->getTimeMap();
#warning BLAH
/* timeMap & map = _n->detuning()->getAutomationPattern()->getTimeMap();
timeMap::iterator it = map.end();
do
{
@@ -620,7 +621,7 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x,
_p.drawLine( pos_x - 1, pos_y, pos_x + 1, pos_y );
_p.drawLine( pos_x, pos_y - 1, pos_x, pos_y + 1 );
} while( it != map.begin() );
} while( it != map.begin() );*/
}

View File

@@ -236,10 +236,10 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
m_s, SLOT( addSampleTrack() ),
m_toolBar );
m_addControllerButton = new toolButton( embed::getIconPixmap(
"add_controller", 24, 24 ),
tr( "Add controller" ),
m_s, SLOT( addSampleTrack() ),
m_addAutomationTrackButton = new toolButton( embed::getIconPixmap(
"add_automation", 24, 24 ),
tr( "Add automation-track" ),
m_s, SLOT( addAutomationTrack() ),
m_toolBar );
m_drawModeButton = new toolButton( embed::getIconPixmap(
@@ -307,7 +307,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_addBBTrackButton );
tb_layout->addWidget( m_addSampleTrackButton );
tb_layout->addWidget( m_addControllerButton );
tb_layout->addWidget( m_addAutomationTrackButton );
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_drawModeButton );
tb_layout->addWidget( m_editModeButton );

View File

@@ -50,7 +50,7 @@
trackContainerView::trackContainerView( trackContainer * _tc ) :
QWidget(),
modelView( NULL ),
modelView( NULL, this ),
m_currentPosition( 0, 0 ),
m_tc( _tc ),
m_trackViews(),
@@ -156,7 +156,7 @@ void trackContainerView::moveTrackViewUp( trackView * _tv )
m_trackViews[i - 1]->getTrack() );
m_scrollLayout->removeWidget( t );
m_scrollLayout->insertWidget( i - 1, t );
m_tc->m_tracks.swap( i - 1, i );
qSwap( m_tc->m_tracks[i-1], m_tc->m_tracks[i] );
m_trackViews.swap( i - 1, i );
realignTracks();
break;
@@ -178,7 +178,7 @@ void trackContainerView::moveTrackViewDown( trackView * _tv )
m_trackViews[i + 1]->getTrack() );
m_scrollLayout->removeWidget( t );
m_scrollLayout->insertWidget( i + 1, t );
m_tc->m_tracks.swap( i, i + 1 );
qSwap( m_tc->m_tracks[i], m_tc->m_tracks[i+1] );
m_trackViews.swap( i, i + 1 );
realignTracks();
break;

View File

@@ -33,6 +33,7 @@
#include "caption_menu.h"
#include "embed.h"
#include "main_window.h"
@@ -40,7 +41,7 @@
automatableButton::automatableButton( QWidget * _parent,
const QString & _name ) :
QPushButton( _parent ),
boolModelView( new boolModel( FALSE, NULL, _name, TRUE ) ),
boolModelView( new boolModel( FALSE, NULL, _name, TRUE ), this ),
m_group( NULL )
{
setAccessibleName( _name );
@@ -86,8 +87,9 @@ void automatableButton::update( void )
void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
{
if( model()->nullTrack() &&
( m_group == NULL || m_group->model()->nullTrack() ) )
/* if( model()->nullTrack() &&
( m_group == NULL || m_group->model()->nullTrack() ) )*/
if( m_group != NULL && !m_group->model()->isAutomated() )
{
QPushButton::contextMenuEvent( _me );
return;
@@ -99,20 +101,14 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
// an QApplication::restoreOverrideCursor()-call...
mouseReleaseEvent( NULL );
QWidget * target;
QString targetName;
automationPattern * pattern;
if ( m_group != NULL )
{
target = m_group;
targetName = m_group->model()->displayName();
pattern = m_group->model()->getAutomationPattern();
}
else
{
target = this;
targetName = model()->displayName();
pattern = model()->getAutomationPattern();
}
captionMenu contextMenu( targetName );
@@ -125,7 +121,8 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
void automatableButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton )
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
{
if( isCheckable() )
{
@@ -135,6 +132,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
}
else
{
automatableModelView::mousePressEvent( _me );
QPushButton::mousePressEvent( _me );
}
}
@@ -177,7 +175,7 @@ void automatableButton::toggle( void )
automatableButtonGroup::automatableButtonGroup( QWidget * _parent,
const QString & _name ) :
QWidget( _parent ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) )
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ), this )
{
hide();
setAccessibleName( _name );

View File

@@ -33,14 +33,15 @@
#include "caption_menu.h"
#include "embed.h"
#include "knob.h"
#include "main_window.h"
automatableSlider::automatableSlider( QWidget * _parent, const QString & _name ) :
automatableSlider::automatableSlider( QWidget * _parent,
const QString & _name ) :
QSlider( _parent ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ), this ),
m_showStatus( FALSE )
{
setAccessibleName( _name );
@@ -73,8 +74,16 @@ void automatableSlider::contextMenuEvent( QContextMenuEvent * _me )
void automatableSlider::mousePressEvent( QMouseEvent * _me )
{
m_showStatus = TRUE;
QSlider::mousePressEvent( _me );
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
{
m_showStatus = TRUE;
QSlider::mousePressEvent( _me );
}
else
{
automatableModelView::mousePressEvent( _me );
}
}

View File

@@ -39,6 +39,7 @@
#include "caption_menu.h"
#include "embed.h"
#include "gui_templates.h"
#include "main_window.h"
QPixmap * comboBox::s_background = NULL;
@@ -50,7 +51,7 @@ const int CB_ARROW_BTN_WIDTH = 20;
comboBox::comboBox( QWidget * _parent, const QString & _name ) :
QWidget( _parent ),
intModelView( new comboBoxModel ),
intModelView( new comboBoxModel, this ),
m_menu( this ),
m_pressed( FALSE )
{
@@ -94,7 +95,7 @@ comboBox::~comboBox()
void comboBox::contextMenuEvent( QContextMenuEvent * _me )
{
if( model()->nullTrack() || _me->x() <= width() - CB_ARROW_BTN_WIDTH )
if( _me->x() <= width() - CB_ARROW_BTN_WIDTH )
{
QWidget::contextMenuEvent( _me );
return;
@@ -110,50 +111,55 @@ void comboBox::contextMenuEvent( QContextMenuEvent * _me )
void comboBox::mousePressEvent( QMouseEvent * _me )
{
if( _me->x() > width() - CB_ARROW_BTN_WIDTH )
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
{
if( _me->button() == Qt::RightButton )
if( _me->x() > width() - CB_ARROW_BTN_WIDTH )
{
return;
}
m_pressed = TRUE;
update();
m_pressed = TRUE;
update();
m_menu.clear();
for( int i = 0; i < model()->size(); ++i )
{
QAction * a = m_menu.addAction(
model()->itemPixmap( i ) ?
model()->itemPixmap( i )->pixmap() :
QPixmap(),
m_menu.clear();
for( int i = 0; i < model()->size(); ++i )
{
QAction * a = m_menu.addAction(
model()->itemPixmap( i ) ?
model()->itemPixmap( i )->
pixmap() :
QPixmap(),
model()->itemText( i ) );
a->setData( i );
}
a->setData( i );
}
QPoint gpos = mapToGlobal( QPoint( 0, height() ) );
if( gpos.y() + m_menu.sizeHint().height() <
QPoint gpos = mapToGlobal( QPoint( 0, height() ) );
if( gpos.y() + m_menu.sizeHint().height() <
qApp->desktop()->height() )
{
m_menu.exec( gpos );
{
m_menu.exec( gpos );
}
else
{
m_menu.exec( mapToGlobal(
QPoint( width(), 0 ) ) );
}
m_pressed = FALSE;
update();
}
else
else if( _me->button() == Qt::LeftButton )
{
m_menu.exec( mapToGlobal( QPoint( width(), 0 ) ) );
model()->setInitValue( model()->value() + 1 );
update();
}
m_pressed = FALSE;
update();
}
else if( _me->button() == Qt::LeftButton )
{
model()->setInitValue( model()->value() + 1 );
update();
}
else if( _me->button() == Qt::RightButton )
{
model()->setInitValue( model()->value() - 1 );
update();
}
else
{
automatableModelView::mousePressEvent( _me );
}
}

View File

@@ -43,7 +43,7 @@
controllerRackView::controllerRackView( ) :
QWidget(),
modelView( NULL )
modelView( NULL, this )
{
setFixedSize( 250, 250 );
setWindowIcon( embed::getIconPixmap( "controller" ) );

View File

@@ -47,7 +47,7 @@
controllerView::controllerView( controller * _model, QWidget * _parent ) :
QWidget( _parent ),
modelView( _model ),
modelView( _model, this ),
m_bg( embed::getIconPixmap( "controller_bg" ) ),
m_subWindow( NULL ),
m_controllerDlg( NULL ),

View File

@@ -40,7 +40,7 @@
effectRackView::effectRackView( effectChain * _model, QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL )
modelView( NULL, this )
{
setFixedSize( 250, 250 );

View File

@@ -91,7 +91,7 @@ QPixmap * envelopeAndLFOView::s_lfoGraph = NULL;
envelopeAndLFOView::envelopeAndLFOView( QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL ),
modelView( NULL, this ),
m_params( NULL )
{
if( s_envGraph == NULL )

View File

@@ -52,13 +52,13 @@
#include "fader.h"
#include "embed.h"
#include "caption_menu.h"
#include "automation_pattern.h"
#include "main_window.h"
fader::fader( floatModel * _model, QWidget * _parent ) :
QWidget( _parent ),
floatModelView( _model ),
floatModelView( _model, this ),
m_model( _model ),
m_fPeakValue_L( 0.0 ),
m_fPeakValue_R( 0.0 ),
@@ -86,13 +86,10 @@ fader::~fader()
void fader::contextMenuEvent( QContextMenuEvent * _ev )
{
if( !model()->nullTrack() )
{
captionMenu contextMenu( accessibleName() );
addDefaultActions( &contextMenu );
contextMenu.exec( QCursor::pos() );
_ev->accept();
}
captionMenu contextMenu( accessibleName() );
addDefaultActions( &contextMenu );
contextMenu.exec( QCursor::pos() );
_ev->accept();
}
@@ -110,17 +107,24 @@ void fader::mouseMoveEvent( QMouseEvent *ev )
void fader::mousePressEvent(QMouseEvent *ev)
void fader::mousePressEvent( QMouseEvent * _me )
{
if( ev->button() == Qt::LeftButton )
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
{
mouseMoveEvent( ev );
ev->accept();
mouseMoveEvent( _me );
_me->accept();
}
else
{
automatableModelView::mousePressEvent( _me );
}
}
void fader::wheelEvent ( QWheelEvent *ev )
{
ev->accept();
@@ -178,6 +182,7 @@ void fader::setPeak_R( float fPeak )
void fader::paintEvent( QPaintEvent * ev)
{
QPainter painter(this);
@@ -226,6 +231,7 @@ void fader::paintEvent( QPaintEvent * ev)
void fader::setMaxPeak( float fMax )
{
m_fMaxPeak = fMax;
@@ -233,6 +239,7 @@ void fader::setMaxPeak( float fMax )
void fader::setMinPeak( float fMin )
{
m_fMinPeak = fMin;

View File

@@ -42,7 +42,7 @@ using namespace std;
graph::graph( QWidget * _parent, graphStyle _style ) :
QWidget( _parent ),
/* TODO: size, background? */
modelView( new graphModel( -1.0, 1.0, 128, NULL, NULL, TRUE ) ),
modelView( new graphModel( -1.0, 1.0, 128, NULL, TRUE ), this ),
m_graphStyle( _style )
{
m_mouseDown = false;
@@ -343,8 +343,7 @@ void graph::updateGraph( void )
graphModel::graphModel( float _min, float _max, Uint32 _length,
::model * _parent, track * _track,
bool _default_constructed ) :
::model * _parent, bool _default_constructed ) :
model( _parent, _default_constructed ),
m_samples( _length ),
m_minValue( _min ),

View File

@@ -46,7 +46,7 @@ QPixmap * groupBox::s_ledBg = NULL;
groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
QWidget( _parent ),
boolModelView( NULL ),
boolModelView( NULL, this ),
m_caption( _caption )
{
if( s_ledBg == NULL )

View File

@@ -55,7 +55,7 @@ const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y;
chordCreatorView::chordCreatorView( chordCreator * _cc, QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL ),
modelView( NULL, this ),
m_cc( _cc ),
m_chordsGroupBox( new groupBox( tr( "CHORDS" ), this ) ),
m_chordsComboBox( new comboBox( m_chordsGroupBox ) ),
@@ -108,7 +108,7 @@ void chordCreatorView::modelChanged( void )
arpeggiatorView::arpeggiatorView( arpeggiator * _arp, QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL ),
modelView( NULL, this ),
m_a( _arp ),
m_arpGroupBox( new groupBox( tr( "ARPEGGIO" ), this ) ),
m_arpComboBox( new comboBox( m_arpGroupBox) ),

View File

@@ -43,7 +43,7 @@
instrumentMidiIOView::instrumentMidiIOView( QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL ),
modelView( NULL, this ),
m_rpBtn( NULL ),
m_wpBtn( NULL )
{

View File

@@ -48,7 +48,7 @@ const int FILTER_GROUPBOX_HEIGHT = 245-FILTER_GROUPBOX_Y;
instrumentSoundShapingView::instrumentSoundShapingView( QWidget * _parent ) :
QWidget( _parent ),
modelView( NULL ),
modelView( NULL, this ),
m_ss( NULL )
{
m_targetsTabWidget = new tabWidget( tr( "TARGET" ), this );

View File

@@ -60,7 +60,7 @@ textFloat * knob::s_textFloat = NULL;
knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
QWidget( _parent ),
floatModelView( new knobModel( 0, 0, 0, 1, NULL, _name, TRUE ) ),
floatModelView( new knobModel( 0, 0, 0, 1, NULL, _name, TRUE ), this ),
m_knobNum( _knob_num ),
m_label( "" ),
m_knobPixmap( NULL ),
@@ -75,8 +75,6 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
s_textFloat = new textFloat;
}
setAcceptDrops( TRUE );
setAccessibleName( _name );
if( m_knobNum != knobStyled ) {
@@ -404,7 +402,7 @@ void knob::contextMenuEvent( QContextMenuEvent * )
void knob::dragEnterEvent( QDragEnterEvent * _dee )
{
stringPairDrag::processDragEnterEvent( _dee, "float_value,"
"link_object" );
"automatable_model" );
}
@@ -419,7 +417,7 @@ void knob::dropEvent( QDropEvent * _de )
model()->setValue( val.toFloat() );
_de->accept();
}
else if( type == "link_object" )
else if( type == "automatable_model" )
{
automatableModel * mod = dynamic_cast<automatableModel *>(
engine::getProjectJournal()->
@@ -456,23 +454,15 @@ void knob::mousePressEvent( QMouseEvent * _me )
m_buttonPressed = TRUE;
}
else if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE/* &&
engine::getMainWindow()->isShiftPressed() == FALSE*/ )
engine::getMainWindow()->isShiftPressed() == TRUE )
{
new stringPairDrag( "float_value",
QString::number( model()->value() ),
QPixmap(), this );
}
else if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isShiftPressed() == TRUE )
else
{
new stringPairDrag( "link_object",
QString::number( model()->id() ),
QPixmap(), this );
}
else if( _me->button() == Qt::MidButton )
{
model()->reset();
automatableModelView::mousePressEvent( _me );
}
}
@@ -498,10 +488,7 @@ void knob::mouseReleaseEvent( QMouseEvent * /* _me*/ )
{
model()->addJournalEntryFromOldToCurVal();
if( m_buttonPressed )
{
m_buttonPressed = TRUE;
}
m_buttonPressed = FALSE;
m_mouseOffset = 0;
emit sliderReleased();

View File

@@ -36,7 +36,7 @@
ladspaControlView::ladspaControlView( QWidget * _parent,
ladspaControl * _ctl ) :
QWidget( _parent ),
modelView( _ctl ),
modelView( _ctl, this ),
m_ctl( _ctl )
{
QHBoxLayout * layout = new QHBoxLayout( this );

View File

@@ -4,7 +4,7 @@
* lcd_spinbox.cpp - class lcdSpinBox, an improved QLCDNumber
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Paul Giblock <pgllama/at/gmail.com>
* Copyright (c) 2008 Paul Giblock <pgllama/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,7 +26,6 @@
*/
#include "lcd_spinbox.h"
#include <QtGui/QApplication>
#include <QtGui/QLabel>
@@ -35,16 +34,19 @@
#include <QtGui/QFontMetrics>
#include <QtGui/QStyleOptionFrameV2>
#include "lcd_spinbox.h"
#include "caption_menu.h"
#include "embed.h"
#include "gui_templates.h"
#include "templates.h"
#include "main_window.h"
lcdSpinBox::lcdSpinBox( int _num_digits, QWidget * _parent,
const QString & _name ) :
QWidget( _parent ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ), this ),
m_label(),
m_numDigits( _num_digits ),
m_origMousePos()
@@ -69,7 +71,7 @@ lcdSpinBox::lcdSpinBox( int _num_digits, QWidget * _parent,
lcdSpinBox::lcdSpinBox( int _num_digits, const QString & _lcd_style,
QWidget * _parent, const QString & _name ) :
QWidget( _parent ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ), this ),
m_label(),
m_numDigits( _num_digits ),
m_origMousePos()
@@ -264,12 +266,6 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me )
{
m_origMousePos = _me->globalPos();
if( model()->nullTrack() )
{
QWidget::contextMenuEvent( _me );
return;
}
// for the case, the user clicked right while pressing left mouse-
// button, the context-menu appears while mouse-cursor is still hidden
// and it isn't shown again until user does something which causes
@@ -286,12 +282,18 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me )
void lcdSpinBox::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton && _me->y() < m_cellHeight + 2 )
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE &&
_me->y() < m_cellHeight + 2 )
{
m_origMousePos = _me->globalPos();
QApplication::setOverrideCursor( Qt::BlankCursor );
model()->prepareJournalEntryFromOldVal();
}
else
{
automatableModelView::mousePressEvent( _me );
}
}

View File

@@ -34,7 +34,7 @@
meterDialog::meterDialog( QWidget * _parent, bool _simple ) :
QWidget( _parent ),
modelView( NULL )
modelView( NULL, this )
{
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 0 );

View File

@@ -30,7 +30,7 @@
midiPortMenu::midiPortMenu( midiPort::Modes _mode ) :
modelView( NULL ),
modelView( NULL, this ),
m_mode( _mode )
{
setFont( pointSize<9>( font() ) );

View File

@@ -47,7 +47,7 @@ tempoSyncKnobModel::tempoSyncKnobModel( const float _val, const float _min,
m_tempoSyncMode( SyncNone ),
m_tempoLastSyncMode( SyncNone ),
m_scale( _scale ),
m_custom( _parent, NULL )
m_custom( _parent )
{
connect( engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( calculateTempoSyncTime( bpm_t ) ) );

View File

@@ -4,6 +4,7 @@
* automation_track.cpp - automationTrack handles automation of objects without
* a track
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -27,12 +28,15 @@
#include "automation_track.h"
#include "automation_pattern.h"
#include "embed.h"
#include "name_label.h"
automationTrack::automationTrack( trackContainer * _tc ) :
track( AutomationTrack, _tc )
automationTrack::automationTrack( trackContainer * _tc, bool _hidden ) :
track( _hidden ? HiddenAutomationTrack : AutomationTrack, _tc )
{
}
@@ -49,16 +53,36 @@ automationTrack::~automationTrack()
bool automationTrack::play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base, Sint16 _tco_num )
{
sendMidiTime( _start );
tcoVector tcos;
getTCOsInRange( tcos, _start, _start + static_cast<int>(
_frames / engine::framesPerTick() ) );
for( tcoVector::iterator it = tcos.begin(); it != tcos.end(); ++it )
{
automationPattern * p =
dynamic_cast<automationPattern *>( *it );
if( p == NULL || ( *it )->isMuted() )
{
continue;
}
p->processMidiTime( _start - p->startPosition() );
}
return( FALSE );
}
trackView * automationTrack::createView( trackContainerView * _tcv )
{
return( new automationTrackView( this, _tcv ) );
}
trackContentObject * automationTrack::createTCO( const midiTime & )
{
return( NULL );
return( new automationPattern( this ) );
}
@@ -78,4 +102,31 @@ void automationTrack::loadTrackSpecificSettings( const QDomElement & _this )
automationTrackView::automationTrackView( automationTrack * _at,
trackContainerView * _tcv ) :
trackView( _at, _tcv )
{
setFixedHeight( 32 );
m_trackLabel = new nameLabel( _at->name(), getTrackSettingsWidget() );
m_trackLabel->setPixmap( embed::getIconPixmap( "automation" ) );
m_trackLabel->setGeometry( 1, 1, DEFAULT_SETTINGS_WIDGET_WIDTH - 2,
29 );
m_trackLabel->show();
connect( m_trackLabel, SIGNAL( nameChanged( const QString & ) ),
_at, SLOT( setName( const QString & ) ) );
setModel( _at );
}
automationTrackView::~automationTrackView()
{
}
#endif

View File

@@ -351,8 +351,6 @@ bbTrack::~bbTrack()
bool bbTrack::play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _offset, Sint16 _tco_num )
{
sendMidiTime( _start );
if( _tco_num >= 0 )
{
return( engine::getBBTrackContainer()->play( _start, _frames,
@@ -360,7 +358,7 @@ bool bbTrack::play( const midiTime & _start, const fpp_t _frames,
s_infoMap[this] ) );
}
QList<trackContentObject *> tcos;
tcoVector tcos;
getTCOsInRange( tcos, _start, _start + static_cast<int>( _frames /
engine::framesPerTick() ) );
@@ -371,8 +369,7 @@ bool bbTrack::play( const midiTime & _start, const fpp_t _frames,
midiTime lastPosition;
midiTime lastLen;
for( QList<trackContentObject *>::iterator it = tcos.begin();
it != tcos.end(); ++it )
for( tcoVector::iterator it = tcos.begin(); it != tcos.end(); ++it )
{
if( !( *it )->isMuted() &&
( *it )->startPosition() >= lastPosition )
@@ -409,7 +406,7 @@ trackContentObject * bbTrack::createTCO( const midiTime & _pos )
// if we're creating a new bbTCO, we colorize it according to the
// previous bbTCO, so we have to get all TCOs from 0 to _pos and
// pickup the last and take the color if it
QList<trackContentObject *> tcos;
tcoVector tcos;
getTCOsInRange( tcos, 0, _pos );
if( tcos.size() > 0 && dynamic_cast<bbTCO *>( tcos.back() ) != NULL )
{
@@ -439,19 +436,6 @@ void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc,
( (journallingObject *)( engine::getBBTrackContainer() ) )->
saveState( _doc, _this );
}
int track_num = 0;
QList<track *> tracks = engine::getBBTrackContainer()->tracks();
for( int i = 0; i < tracks.size(); ++i, ++track_num )
{
if( automationDisabled( tracks[i] ) )
{
QDomElement disabled = _doc.createElement(
"automation-disabled" );
disabled.setAttribute( "track", track_num );
_this.appendChild( disabled );
}
}
}
@@ -479,19 +463,6 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this )
{
engine::getBBEditor()->setCurrentBB( s_infoMap[this] );
}*/
QList<track *> tracks = engine::getBBTrackContainer()->tracks();
node = _this.firstChild();
while( !node.isNull() )
{
if( node.isElement()
&& node.nodeName() == "automation-disabled" )
{
disableAutomation( tracks[node.toElement().attribute(
"track" ).toInt()] );
}
node = node.nextSibling();
}
}

View File

@@ -103,9 +103,9 @@ const int INSTRUMENT_WINDOW_CACHE_SIZE = 8;
instrumentTrack::instrumentTrack( trackContainer * _tc ) :
track( InstrumentTrack, _tc ),
midiEventProcessor(),
m_audioPort( tr( "unnamed_track" ), this ),
m_audioPort( tr( "unnamed_track" ) ),
m_midiPort( tr( "unnamed_track" ), engine::getMixer()->getMIDIClient(),
this, this, this ),
this, this ),
m_notes(),
m_baseNoteModel( 0, 0, KeysPerOctave * NumOctaves - 1, this ),
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 1.0f, this,
@@ -120,18 +120,12 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
m_chordCreator( this ),
m_piano( this )
{
m_baseNoteModel.setTrack( this );
m_baseNoteModel.setInitValue( DefaultKey );
connect( &m_baseNoteModel, SIGNAL( dataChanged() ),
this, SLOT( updateBaseNote() ) );
connect( &m_pitchModel, SIGNAL( dataChanged() ),
this, SLOT( updateBaseNote() ) );
m_volumeModel.setTrack( this );
m_panningModel.setTrack( this );
m_pitchModel.setTrack( this );
m_effectChannelModel.setTrack( this );
for( int i = 0; i < NumKeys; ++i )
{
@@ -525,25 +519,18 @@ bool instrumentTrack::play( const midiTime & _start,
{
const float frames_per_tick = engine::framesPerTick();
QList<trackContentObject *> tcos;
tcoVector tcos;
bbTrack * bb_track;
if( _tco_num >= 0 )
{
trackContentObject * tco = getTCO( _tco_num );
tcos.push_back( tco );
bb_track = bbTrack::findBBTrack( _tco_num );
if( !( ( bb_track && bb_track->automationDisabled( this ) )
|| dynamic_cast<pattern *>( tco )->empty() ) )
{
sendMidiTime( _start );
}
}
else
{
getTCOsInRange( tcos, _start, _start + static_cast<int>(
_frames / frames_per_tick ) );
bb_track = NULL;
sendMidiTime( _start );
}
// Handle automation: detuning
@@ -560,8 +547,7 @@ bool instrumentTrack::play( const midiTime & _start,
bool played_a_note = FALSE; // will be return variable
for( QList<trackContentObject *>::iterator it = tcos.begin();
it != tcos.end(); ++it )
for( tcoVector::iterator it = tcos.begin(); it != tcos.end(); ++it )
{
pattern * p = dynamic_cast<pattern *>( *it );
// everything which is not a pattern or muted won't be played
@@ -705,9 +691,9 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
m_volumeModel.loadSettings( _this, "vol" );
// compat-hacks - move to mmp::upgrade
if( _this.hasAttribute( "surpos" ) || _this.hasAttribute( "surpos-x" ) ||
!_this.firstChildElement( "automation-pattern" ).
firstChildElement( "surpos-x" ).isNull() )
if( _this.hasAttribute( "surpos" ) || _this.hasAttribute( "surpos-x" )
|| !_this.firstChildElement( "automationpattern" ).
firstChildElement( "surpos-x" ).isNull() )
{
surroundAreaModel m( this, this );
m.loadSettings( _this, "surpos" );
@@ -765,7 +751,8 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
node.toElement() );
}
else if( automationPattern::classNodeName() !=
node.nodeName() )
node.nodeName() &&
!node.toElement().hasAttribute( "id" ) )
{
// if node-name doesn't match any known one,
// we assume that it is an instrument-plugin
@@ -1085,7 +1072,7 @@ class fxLineLcdSpinBox : public lcdSpinBox
// #### ITW:
instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
QWidget(),
modelView( NULL ),
modelView( NULL, this ),
m_track( _itv->model() ),
m_itv( _itv ),
m_instrumentView( NULL )

View File

@@ -857,14 +857,6 @@ void patternView::update( void )
void patternView::openInPianoRoll( void )
{
openInPianoRoll( FALSE );
}
void patternView::openInPianoRoll( bool )
{
engine::getPianoRoll()->setCurrentPattern( m_pat );
engine::getPianoRoll()->parentWidget()->show();
@@ -915,8 +907,8 @@ void patternView::constructContextMenu( QMenu * _cm )
QAction * a = new QAction( embed::getIconPixmap( "piano" ),
tr( "Open in piano-roll" ), _cm );
_cm->insertAction( _cm->actions()[0], a );
connect( a, SIGNAL( triggered( bool ) ), this,
SLOT( openInPianoRoll( bool ) ) );
connect( a, SIGNAL( triggered( bool ) ),
this, SLOT( openInPianoRoll() ) );
_cm->insertSeparator( _cm->actions()[1] );
_cm->addSeparator();
@@ -988,7 +980,7 @@ void patternView::mouseDoubleClickEvent( QMouseEvent * _me )
_me->y() > height() - s_stepBtnOff->height() ) )
{
openInPianoRoll();
}
}
}
@@ -1136,28 +1128,20 @@ void patternView::paintEvent( QPaintEvent * )
/ (float) m_pat->length().getTact() :
pixelsPerTact();
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact tact_num = 1; tact_num <
m_pat->length().getTact(); ++tact_num )
{
p.drawLine(
x_base + static_cast<int>(
ppt * tact_num ) - 1,
TCO_BORDER_WIDTH,
x_base + static_cast<int>(
ppt * tact_num ) - 1,
5 );
p.drawLine(
x_base + static_cast<int>(
ppt * tact_num ) - 1,
height() - ( 4 + 2 *
TCO_BORDER_WIDTH ),
x_base + static_cast<int>(
ppt * tact_num ) - 1,
height() - 2 *
TCO_BORDER_WIDTH );
}
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
height() - 2 * TCO_BORDER_WIDTH );
}
if( m_pat->m_patternType == pattern::MelodyPattern )
{
int central_key = 0;
@@ -1183,20 +1167,8 @@ void patternView::paintEvent( QPaintEvent * )
int central_y = height() / 2;
int y_base = central_y + TCO_BORDER_WIDTH -1;
/* for( tact tact_num = 1; tact_num <
m_pat->length().getTact(); ++tact_num )
{
p.drawLine(
x_base + static_cast<int>(
ppt * tact_num ) - 1,
TCO_BORDER_WIDTH,
x_base + static_cast<int>(
ppt * tact_num ) - 1,
height() - 2 *
TCO_BORDER_WIDTH );
}*/
if( m_pat->getTrack()->isMuted() ||
m_pat->isMuted() )
m_pat->isMuted() )
{
p.setPen( QColor( 160, 160, 160 ) );
}

View File

@@ -218,8 +218,7 @@ midiTime sampleTCO::getSampleLength( void ) const
void FASTCALL sampleTCO::saveSettings( QDomDocument & _doc,
QDomElement & _this )
void sampleTCO::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
if( _this.parentNode().nodeName() == "clipboard" )
{
@@ -243,7 +242,7 @@ void FASTCALL sampleTCO::saveSettings( QDomDocument & _doc,
void FASTCALL sampleTCO::loadSettings( const QDomElement & _this )
void sampleTCO::loadSettings( const QDomElement & _this )
{
if( _this.attribute( "pos" ).toInt() >= 0 )
{
@@ -377,8 +376,7 @@ sampleTrack::~sampleTrack()
bool FASTCALL sampleTrack::play( const midiTime & _start,
const fpp_t _frames,
bool sampleTrack::play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _offset,
Sint16 /*_tco_num*/ )
{