Merge branch 'master' into ed_refac

Conflicts:
	src/gui/editors/PianoRoll.cpp
This commit is contained in:
Lukas W
2015-01-11 13:25:55 +01:00
57 changed files with 557 additions and 332 deletions

View File

@@ -51,6 +51,21 @@ AutomationPattern::AutomationPattern( AutomationTrack * _auto_track ) :
m_lastRecordedValue( 0 )
{
changeLength( MidiTime( 1, 0 ) );
if( getTrack() )
{
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
}
@@ -69,6 +84,18 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) :
m_timeMap[it.key()] = it.value();
m_tangents[it.key()] = _pat_to_copy.m_tangents[it.key()];
}
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
@@ -186,7 +213,7 @@ MidiTime AutomationPattern::putValue( const MidiTime & _time,
timeMap::const_iterator it = m_timeMap.find( newTime );
if( it != m_timeMap.begin() )
{
it--;
--it;
}
generateTangents(it, 3);
@@ -219,7 +246,7 @@ void AutomationPattern::removeValue( const MidiTime & _time,
timeMap::const_iterator it = m_timeMap.lowerBound( newTime );
if( it != m_timeMap.begin() )
{
it--;
--it;
}
generateTangents(it, 3);
@@ -260,7 +287,7 @@ MidiTime AutomationPattern::setDragValue( const MidiTime & _time, const float _v
//Restore to the state before it the point were being dragged
m_timeMap = m_oldTimeMap;
for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); it++ )
for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); ++it )
{
generateTangents(it, 3);
}

View File

@@ -42,6 +42,7 @@ BBTrackContainer::BBTrackContainer() :
// not change upon setCurrentBB()-call
connect( &m_bbComboBoxModel, SIGNAL( dataUnchanged() ),
this, SLOT( currentBBChanged() ) );
setType( BBContainer );
}

View File

@@ -230,7 +230,7 @@ int FxMixer::createChannel()
void FxMixer::activateSolo()
{
for (int i = 0; i < m_fxChannels.size(); ++i)
for (int i = 1; i < m_fxChannels.size(); ++i)
{
m_fxChannels[i]->m_muteBeforeSolo = m_fxChannels[i]->m_muteModel.value();
m_fxChannels[i]->m_muteModel.setValue( true );
@@ -239,7 +239,7 @@ void FxMixer::activateSolo()
void FxMixer::deactivateSolo()
{
for (int i = 0; i < m_fxChannels.size(); ++i)
for (int i = 1; i < m_fxChannels.size(); ++i)
{
m_fxChannels[i]->m_muteModel.setValue( m_fxChannels[i]->m_muteBeforeSolo );
}

View File

@@ -32,7 +32,7 @@ Ladspa2LMMS::Ladspa2LMMS()
l_sortable_plugin_t plugins = getSortedPlugins();
for( l_sortable_plugin_t::iterator it = plugins.begin();
it != plugins.end(); it++ )
it != plugins.end(); ++it )
{
ladspa_key_t key = (*it).second;
ladspaManagerDescription * desc = getDescription( key );

View File

@@ -96,7 +96,7 @@ LadspaManager::LadspaManager()
l_ladspa_key_t keys = m_ladspaManagerMap.keys();
for( l_ladspa_key_t::iterator it = keys.begin();
it != keys.end(); it++ )
it != keys.end(); ++it )
{
m_sortedPlugins.append( qMakePair( getName( *it ), *it ) );
}

View File

@@ -147,9 +147,19 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
else
{
DataFile dataFile( _preset_file );
s_previewTC->previewInstrumentTrack()->
loadTrackSpecificSettings(
dataFile.content().firstChild().toElement() );
// vestige previews are bug prone; fallback on 3xosc with volume of 0
// without an instrument in preview track, it will segfault
if(dataFile.content().elementsByTagName( "vestige" ).length() == 0 )
{
s_previewTC->previewInstrumentTrack()->
loadTrackSpecificSettings(
dataFile.content().firstChild().toElement() );
}
else
{
s_previewTC->previewInstrumentTrack()->loadInstrument("tripleoscillator");
s_previewTC->previewInstrumentTrack()->setVolume( 0 );
}
}
Engine::setSuppressMessages( false );

View File

@@ -98,14 +98,15 @@ SamplePlayHandle::~SamplePlayHandle()
void SamplePlayHandle::play( sampleFrame * buffer )
{
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
//play( 0, _try_parallelizing );
if( framesDone() >= totalFrames() )
{
memset( buffer, 0, sizeof( sampleFrame ) * fpp );
return;
}
sampleFrame * workingBuffer = buffer;
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
f_cnt_t frames = fpp;
// apply offset for the first period

View File

@@ -116,6 +116,7 @@ Song::Song() :
this, SLOT( masterPitchChanged() ) );*/
qRegisterMetaType<Note>( "note" );
setType( SongContainer );
}

View File

@@ -249,7 +249,6 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * _tco,
m_tco( _tco ),
m_trackView( _tv ),
m_action( NoAction ),
m_autoResize( false ),
m_initialMousePos( QPoint( 0, 0 ) ),
m_initialMouseGlobalPos( QPoint( 0, 0 ) ),
m_hint( NULL ),
@@ -657,7 +656,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * _me )
"a copy." ),
embed::getIconPixmap( "hint" ), 0 );
}
else if( m_autoResize == false )
else if( !m_tco->getAutoResize() )
{
m_action = Resize;
m_oldTime = m_tco->length();
@@ -847,7 +846,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
}
else
{
if( _me->x() > width() - RESIZE_GRIP_WIDTH && !_me->buttons() )
if( _me->x() > width() - RESIZE_GRIP_WIDTH && !_me->buttons() && !m_tco->getAutoResize() )
{
if( QApplication::overrideCursor() != NULL &&
QApplication::overrideCursor()->shape() !=
@@ -958,19 +957,6 @@ float TrackContentObjectView::pixelsPerTact()
/*! \brief Set whether this trackContentObjectView can resize.
*
* \param _e The boolean state of whether this track content object view
* is allowed to resize.
*/
void TrackContentObjectView::setAutoResizeEnabled( bool _e )
{
m_autoResize = _e;
}
/*! \brief Detect whether the mouse moved more than n pixels on screen.
*
* \param _me The QMouseEvent.
@@ -1403,6 +1389,11 @@ bool TrackContentWidget::pasteSelection( MidiTime tcoPos, QDropEvent * _de )
{
tco->selectViewOnCreate( true );
}
//check tco name, if the same as source track name dont copy
if( tco->name() == tracks[trackIndex]->name() )
{
tco->setName( "" );
}
}
AutomationPattern::resolveAllIDs();
@@ -1770,7 +1761,7 @@ void TrackOperationsWidget::recordingOn()
if( atv )
{
const Track::tcoVector & tcov = atv->getTrack()->getTCOs();
for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ )
for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); ++it )
{
AutomationPattern * ap = dynamic_cast<AutomationPattern *>( *it );
if( ap ) { ap->setRecording( true ); }
@@ -1786,7 +1777,7 @@ void TrackOperationsWidget::recordingOff()
if( atv )
{
const Track::tcoVector & tcov = atv->getTrack()->getTCOs();
for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ )
for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); ++it )
{
AutomationPattern * ap = dynamic_cast<AutomationPattern *>( *it );
if( ap ) { ap->setRecording( false ); }

View File

@@ -120,6 +120,7 @@ bool AudioFileOgg::startEncoding()
printf( "Mode initialization failed: invalid parameters for "
"bitrate\n" );
vorbis_info_clear( &m_vi );
delete[] user_comments;
return false;
}

View File

@@ -54,7 +54,6 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
ToolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );
@@ -267,7 +266,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
if( isSelected() == true )
{
c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
}
lingrad.setColorAt( 1, c.darker( 300 ) );

View File

@@ -709,7 +709,8 @@ Directory::Directory(const QString & filename, const QString & path,
const QString & filter ) :
QTreeWidgetItem( QStringList( filename ), TypeDirectoryItem ),
m_directories( path ),
m_filter( filter )
m_filter( filter ),
m_dirCount( 0 )
{
initPixmaps();
@@ -763,6 +764,7 @@ void Directory::update( void )
setIcon( 0, *s_folderOpenedPixmap );
if( !childCount() )
{
m_dirCount = 0;
for( QStringList::iterator it = m_directories.begin();
it != m_directories.end(); ++it )
{
@@ -777,7 +779,7 @@ void Directory::update( void )
"--- Factory files ---" ) );
sep->setIcon( 0, embed::getIconPixmap(
"factory_files" ) );
insertChild( top_index, sep );
insertChild( m_dirCount + top_index - 1, sep );
}
}
}
@@ -815,6 +817,7 @@ bool Directory::addItems(const QString & path )
insertChild( i, new Directory( cur_file,
path, m_filter ) );
orphan = false;
m_dirCount++;
break;
}
else if( cur_file == d->text( 0 ) )
@@ -828,6 +831,7 @@ bool Directory::addItems(const QString & path )
{
addChild( new Directory( cur_file, path,
m_filter ) );
m_dirCount++;
}
added_something = true;

View File

@@ -1235,7 +1235,7 @@ void MainWindow::collectErrors(const QList<QString>* errors )
void MainWindow::collectError( const QString error )
void MainWindow::collectError( const QString & error )
{
m_errors->append( error );
}
@@ -1249,7 +1249,7 @@ void MainWindow::clearErrors()
void MainWindow::showErrors( const QString message )
void MainWindow::showErrors( const QString & message )
{
if ( m_errors->length() != 0 )
{ QString* errors = new QString();

View File

@@ -99,8 +99,8 @@ PluginDescList::PluginDescList(QWidget *parent) :
std::sort(m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore);
for(Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin();
it != m_pluginDescriptors.constEnd(); it++)
for( Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin();
it != m_pluginDescriptors.constEnd(); ++it )
{
if( it->type == Plugin::Instrument )
{

View File

@@ -325,7 +325,9 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>(
Track::create( Track::InstrumentTrack,
m_tc ) );
it->loadInstrument( value );
InstrumentLoaderThread *ilt = new InstrumentLoaderThread(
this, it, value );
ilt->start();
//it->toggledInstrumentTrackButton( true );
_de->accept();
}
@@ -453,6 +455,22 @@ void TrackContainerView::scrollArea::wheelEvent( QWheelEvent * _we )
InstrumentLoaderThread::InstrumentLoaderThread( QObject *parent, InstrumentTrack *it, QString name ) :
QThread( parent ),
m_it( it ),
m_name( name )
{
m_containerThread = thread();
}
void InstrumentLoaderThread::run()
{
Instrument *i = m_it->loadInstrument( m_name );
QObject *parent = i->parent();
i->setParent( 0 );
i->moveToThread( m_containerThread );
i->setParent( parent );
}

File diff suppressed because it is too large Load Diff

View File

@@ -107,12 +107,13 @@ void TimeDisplayWidget::updateTime()
break;
case BarsTicks:
m_majorLCD.setValue( s->getTacts() + 1 );
m_minorLCD.setValue( ( s->getTicks() % s->ticksPerTact() ) /
( s->ticksPerTact() / s->getTimeSigModel().getNumerator() ) +1 );
;
m_milliSecondsLCD.setValue( ( s->getTicks() % s->ticksPerTact() ) %
( s->ticksPerTact() / s->getTimeSigModel().getNumerator() ) );
int tick;
tick = ( s->getMilliseconds() * s->getTempo() * (DefaultTicksPerTact / 4 ) ) / 60000 ;
m_majorLCD.setValue( (int)(tick / s->ticksPerTact() ) + 1);
m_minorLCD.setValue( ( tick % s->ticksPerTact() ) /
( s->ticksPerTact() / s->getTimeSigModel().getNumerator() ) +1 );
m_milliSecondsLCD.setValue( ( tick % s->ticksPerTact() ) %
( s->ticksPerTact() / s->getTimeSigModel().getNumerator() ) );
break;
default: break;

View File

@@ -59,6 +59,7 @@ BBTCO::BBTCO( Track * _track ) :
changeLength( MidiTime( t, 0 ) );
restoreJournallingState();
}
setAutoResize( false );
}
@@ -216,18 +217,23 @@ void BBTCOView::paintEvent( QPaintEvent * )
{
QPainter p( this );
QColor col = m_bbTCO->m_useStyleColor
? p.pen().brush().color()
: m_bbTCO->colorObj();
QColor col;
if( m_bbTCO->getTrack()->isMuted() || m_bbTCO->isMuted() )
{
col = QColor( 160, 160, 160 );
}
else if ( m_bbTCO->m_useStyleColor )
{
col = p.pen().brush().color();
}
else
{
col = m_bbTCO->colorObj();
}
if( isSelected() == true )
{
col = QColor( qMax( col.red() - 128, 0 ), qMax( col.green() - 128, 0 ), 255 );
col.setRgb( qMax( col.red() - 128, 0 ), qMax( col.green() - 128, 0 ), 255 );
}
QLinearGradient lingrad( 0, 0, 0, height() );

View File

@@ -66,6 +66,7 @@ Pattern::Pattern( InstrumentTrack * _instrument_track ) :
{
setName( _instrument_track->name() );
init();
setAutoResize( true );
}
@@ -83,6 +84,18 @@ Pattern::Pattern( const Pattern& other ) :
}
init();
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
@@ -486,12 +499,15 @@ void Pattern::ensureBeatNotes()
for( int i = 0; i < m_steps; ++i )
{
bool found = false;
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); ++it )
NoteVector::Iterator it;
for( it = m_notes.begin(); it != m_notes.end(); ++it )
{
Note *note = *it;
// if a note in this position is the one we want
if( ( *it )->pos() ==
if( note->pos() ==
( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact()
&& ( *it )->length() <= 0 )
&& note->length() <= 0 )
{
found = true;
break;
@@ -511,10 +527,12 @@ void Pattern::ensureBeatNotes()
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); )
{
bool needed = false;
Note *note = *it;
for( int i = 0; i < m_steps; ++i )
{
if( ( *it )->pos() == ( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact()
|| ( *it )->length() != 0 )
if( note->pos() == ( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact()
|| note->length() != 0 )
{
needed = true;
break;
@@ -522,10 +540,12 @@ void Pattern::ensureBeatNotes()
}
if( needed == false )
{
delete *it;
delete note;
it = m_notes.erase( it );
}
else ++it;
else {
++it;
}
}
}
@@ -635,7 +655,6 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
}
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
ToolTip::add( this,
tr( "double-click to open this pattern in piano-roll\n"
@@ -905,16 +924,19 @@ void PatternView::paintEvent( QPaintEvent * )
QLinearGradient lingrad( 0, 0, 0, height() );
QColor c;
if(( m_pat->m_patternType != Pattern::BeatPattern ) &&
!( m_pat->getTrack()->isMuted() || m_pat->isMuted() ))
!( m_pat->getTrack()->isMuted() || m_pat->isMuted() ))
{
c = styleColor;
}
else
{
c = QColor( 80, 80, 80 );
}
if( isSelected() == true )
{
c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
}
if( m_pat->m_patternType != Pattern::BeatPattern )

View File

@@ -63,6 +63,18 @@ SampleTCO::SampleTCO( Track * _track ) :
// change length of this TCO
connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( updateLength( bpm_t ) ) );
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
@@ -341,13 +353,17 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe )
QColor c;
if( !( m_tco->getTrack()->isMuted() || m_tco->isMuted() ) )
{
c = styleColor;
}
else
{
c = QColor( 80, 80, 80 );
}
if( isSelected() == true )
{
c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 );
}
QLinearGradient grad( 0, 0, 0, height() );