Commit cd228678 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Sound is now working with more that one track :)

parent e875537c
......@@ -137,7 +137,8 @@ MainWorkflow::getOutput( TrackType trackType )
{
QReadLocker lock2( m_currentFrameLock );
m_tracks[trackType]->getOutput( m_currentFrame[trackType] );
m_tracks[trackType]->getOutput( m_currentFrame[VideoTrack],
m_currentFrame[trackType] );
if ( trackType == MainWorkflow::VideoTrack )
{
m_effectEngine->render();
......
......@@ -105,7 +105,7 @@ TrackHandler::getLength() const
}
void
TrackHandler::getOutput( qint64 currentFrame )
TrackHandler::getOutput( qint64 currentFrame, qint64 subFrame )
{
m_tmpAudioBuffer = NULL;
for ( unsigned int i = 0; i < m_trackCount; ++i )
......@@ -116,7 +116,7 @@ TrackHandler::getOutput( qint64 currentFrame )
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
else
{
void* ret = m_tracks[i]->getOutput( currentFrame );
void* ret = m_tracks[i]->getOutput( currentFrame, subFrame );
if ( ret == NULL )
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
else
......@@ -129,7 +129,7 @@ TrackHandler::getOutput( qint64 currentFrame )
}
else
{
void* ret = m_tracks[i]->getOutput( currentFrame );
void* ret = m_tracks[i]->getOutput( currentFrame, subFrame );
//m_tmpAudioBuffer is NULl by default, so it will remain NULL if we continue;
if ( ret == NULL )
continue ;
......
......@@ -49,10 +49,13 @@ class TrackHandler : public QObject
void startRender();
/**
* \param currentFrame The current rendering frame (ie the video frame, in all case)
* \param subFrame The type-dependent frame. IE, for a video track,
* it's the same as currentFrame, but for an audio
* track, it will be different.
* \todo This should probably be partialy handled by the trackHandler, as the work
* is exactly the same for both audio and video trackWorkflow in most of the case... or not.
*/
void getOutput( qint64 currentFrame );
void getOutput( qint64 currentFrame, qint64 subFrame );
void pause();
void unpause();
void activateAll();
......
......@@ -135,7 +135,6 @@ void* TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
cw->getStateLock()->lockForRead();
// qDebug() << "TrackWorkflow::renderClip. currentFrame:" << currentFrame << "trackType:" << m_trackType;
// qDebug() << "Rendering clip" << cw << "state:" << cw->getState() << "Type:" << m_trackType;
if ( cw->getState() == ClipWorkflow::Rendering ||
cw->getState() == ClipWorkflow::Paused ||
cw->getState() == ClipWorkflow::PauseRequired ||
......@@ -244,7 +243,7 @@ void TrackWorkflow::releasePreviousRender()
}
}
void* TrackWorkflow::getOutput( qint64 currentFrame )
void* TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame )
{
releasePreviousRender();
QReadLocker lock( m_clipsLock );
......@@ -266,10 +265,10 @@ void* TrackWorkflow::getOutput( qint64 currentFrame )
needRepositioning = true;
m_forceRepositionning = false;
}
else if ( m_paused == true && currentFrame != m_lastFrame )
else if ( m_paused == true && subFrame != m_lastFrame )
needRepositioning = true;
else
needRepositioning = ( abs( currentFrame - m_lastFrame ) > 1 ) ? true : false;
needRepositioning = ( abs( subFrame - m_lastFrame ) > 1 ) ? true : false;
}
while ( it != end )
......@@ -297,7 +296,7 @@ void* TrackWorkflow::getOutput( qint64 currentFrame )
stopClipWorkflow( cw );
++it;
}
m_lastFrame = currentFrame;
m_lastFrame = subFrame;
return ret;
}
......
......@@ -58,7 +58,8 @@ class TrackWorkflow : public QObject
TrackWorkflow( unsigned int trackId, MainWorkflow::TrackType type );
~TrackWorkflow();
void* getOutput( qint64 currentFrame );
void* getOutput( qint64 currentFrame,
qint64 subFrame );
qint64 getLength() const;
void stop();
void pause();
......
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