Commit 90aacb3b authored by sletz's avatar sletz
Browse files

Move GetCurrentTransportFrame code from JackClient to JackTransportEngine.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2795 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 8144caa0
......@@ -22,6 +22,10 @@ Florian Faber
Jackdmp changes log
---------------------------
2008-08-22 Stephane Letz <letz@grame.fr>
* Move GetCurrentTransportFrame code from JackClient to JackTransportEngine.
2008-08-03 Stephane Letz <letz@grame.fr>
* Fix JackFrameTimer::Time2Frames and JackTimer::Frames2Time, jack_cpu compiled again.
......
......@@ -669,16 +669,7 @@ jack_transport_state_t JackClient::TransportQuery(jack_position_t* pos)
jack_nframes_t JackClient::GetCurrentTransportFrame()
{
jack_position_t pos;
jack_transport_state_t state = TransportQuery(&pos);
if (state == JackTransportRolling) {
float usecs = GetMicroSeconds() - pos.usecs;
jack_nframes_t elapsed = (jack_nframes_t)floor((((float) pos.frame_rate) / 1000000.0f) * usecs);
return pos.frame + elapsed;
} else {
return pos.frame;
}
return GetEngineControl()->fTransport.GetCurrentFrame();
}
// Must be RT safe: directly write in the transport shared mem
......
......@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackError.h"
#include "JackTime.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
using namespace std;
......@@ -262,6 +263,20 @@ jack_transport_state_t JackTransportEngine::Query(jack_position_t* pos)
return GetState();
}
jack_nframes_t JackTransportEngine::GetCurrentFrame()
{
jack_position_t pos;
ReadCurrentPos(&pos);
if (fTransportState == JackTransportRolling) {
float usecs = GetMicroSeconds() - pos.usecs;
jack_nframes_t elapsed = (jack_nframes_t)floor((((float) pos.frame_rate) / 1000000.0f) * usecs);
return pos.frame + elapsed;
} else {
return pos.frame;
}
}
// RT, client
void JackTransportEngine::CopyPosition(jack_position_t* from, jack_position_t* to)
{
......
......@@ -170,6 +170,8 @@ class EXPORT JackTransportEngine : public JackAtomicArrayState<jack_position_t>
void RequestNewPos(jack_position_t* pos);
jack_transport_state_t Query(jack_position_t* pos);
jack_nframes_t GetCurrentFrame();
static void CopyPosition(jack_position_t* from, jack_position_t* to);
......
Supports Markdown
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