Create BB-related TCOs along with BB-related tracks (#2981)

This commit is contained in:
Javier Serrano Polo
2016-08-19 04:12:16 +02:00
parent 820a06eeff
commit 703a42e77c
4 changed files with 28 additions and 22 deletions

View File

@@ -1954,6 +1954,8 @@ Track::~Track()
*/
Track * Track::create( TrackTypes tt, TrackContainer * tc )
{
Engine::mixer()->requestChangeInModel();
Track * t = NULL;
switch( tt )
@@ -1969,8 +1971,16 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc )
default: break;
}
if( tc == Engine::getBBTrackContainer() && t )
{
t->createTCOsForBB( Engine::getBBTrackContainer()->numOfBBs()
- 1 );
}
tc->updateAfterTrackAdd();
Engine::mixer()->doneChangeInModel();
return t;
}
@@ -2332,6 +2342,20 @@ void Track::swapPositionOfTCOs( int tcoNum1, int tcoNum2 )
void Track::createTCOsForBB( int bb )
{
while( numOfTCOs() < bb + 1 )
{
MidiTime position = MidiTime( numOfTCOs(), 0 );
TrackContentObject * tco = createTCO( position );
tco->movePosition( position );
tco->changeLength( MidiTime( 1, 0 ) );
}
}
/*! \brief Move all the trackContentObjects after a certain time later by one bar.
*
* \param pos The time at which we want to insert the bar.