Commit 2d0670d1 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Allow a track to be muted

parent 71a96244
......@@ -41,7 +41,7 @@ MainWorkflow::MainWorkflow( int trackCount ) :
memset( MainWorkflow::blackOutput, 0, VIDEOHEIGHT * VIDEOWIDTH * 3 );
m_tracks = new Toggleable<TrackWorkflow*>[trackCount];
for (int i = 0; i < trackCount; ++i)
for ( int i = 0; i < trackCount; ++i )
{
m_tracks[i].setPtr( new TrackWorkflow( i ) );
connect( m_tracks[i], SIGNAL( trackEndReached( unsigned int ) ), this, SLOT( trackEndReached(unsigned int) ) );
......@@ -49,6 +49,7 @@ MainWorkflow::MainWorkflow( int trackCount ) :
connect( m_tracks[i], SIGNAL( trackUnpaused() ), this, SLOT( trackUnpaused() ) );
connect( m_tracks[i], SIGNAL( renderCompleted( unsigned int ) ), this, SLOT( tracksRenderCompleted( unsigned int ) ), Qt::QueuedConnection );
}
muteTrack( 0 );
m_renderStartedLock = new QReadWriteLock;
m_renderMutex = new QMutex;
m_highestTrackNumberMutex = new QMutex;
......@@ -356,3 +357,13 @@ void MainWorkflow::cancelSynchronisation()
}
m_synchroneRenderWaitCondition->wakeAll();
}
void MainWorkflow::muteTrack( unsigned int trackId )
{
m_tracks[trackId].setHardDeactivation( true );
}
void MainWorkflow::unmuteTrack( unsigned int trackId )
{
m_tracks[trackId].setHardDeactivation( false );
}
......@@ -90,6 +90,9 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
*/
void cancelSynchronisation();
void muteTrack( unsigned int trackId );
void unmuteTrack( unsigned int trackId );
private:
static MainWorkflow* m_instance;
......
......@@ -32,7 +32,7 @@ template <typename T>
class Toggleable
{
public:
Toggleable() : m_ptr( NULL ), m_activated( true )
Toggleable() : m_ptr( NULL ), m_activated( true ), m_hardDeactivated( false )
{
}
void setPtr( T ptr )
......@@ -51,11 +51,11 @@ class Toggleable
}
bool activated() const
{
return m_activated;
return ( m_hardDeactivated == false && m_activated == true );
}
bool deactivated() const
{
return !m_activated;
return ( m_hardDeactivated == true || m_activated == false );
}
void activate()
{
......@@ -65,10 +65,15 @@ class Toggleable
{
m_activated = false;
}
void setHardDeactivation( bool val )
{
m_hardDeactivated = val;
}
private:
T m_ptr;
bool m_activated;
bool m_hardDeactivated;
};
#endif // TOGGLEABLE_HPP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment