cmAudioFileDev.c,cmMidiFilePlay.c:Replaced calls to clock_gettime() with equivalent calls to cmTimeGet().
This commit is contained in:
parent
8d00e8fe23
commit
0507290dfe
@ -8,16 +8,7 @@
|
|||||||
#include "cmThread.h"
|
#include "cmThread.h"
|
||||||
#include "cmAudioPort.h"
|
#include "cmAudioPort.h"
|
||||||
#include "cmAudioFileDev.h"
|
#include "cmAudioFileDev.h"
|
||||||
|
#include "cmTime.h"
|
||||||
|
|
||||||
#ifdef OS_OSX
|
|
||||||
#include "osx/clock_gettime_stub.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OS_LINUX
|
|
||||||
#include <time.h> // clock_gettime()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE;
|
cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE;
|
||||||
|
|
||||||
@ -148,7 +139,7 @@ bool _cmAudioDevThreadFunc(void* param)
|
|||||||
if( p->cycleCnt == 0 )
|
if( p->cycleCnt == 0 )
|
||||||
{
|
{
|
||||||
// get the baseTime - all other times will be relative to this time
|
// get the baseTime - all other times will be relative to this time
|
||||||
clock_gettime(CLOCK_REALTIME,&p->baseTime);
|
cmTimeGet(&p->baseTime);
|
||||||
p->nextTime = p->baseTime;
|
p->nextTime = p->baseTime;
|
||||||
p->nextTime.tv_sec = 0;
|
p->nextTime.tv_sec = 0;
|
||||||
_cmAfdIncrNextTime(p);
|
_cmAfdIncrNextTime(p);
|
||||||
@ -158,7 +149,7 @@ bool _cmAudioDevThreadFunc(void* param)
|
|||||||
if( p->runFl )
|
if( p->runFl )
|
||||||
{
|
{
|
||||||
// get the current time as an offset from baseTime.
|
// get the current time as an offset from baseTime.
|
||||||
clock_gettime(CLOCK_REALTIME,&t0);
|
cmTimeGet(&t0);
|
||||||
t0.tv_sec -= p->baseTime.tv_sec;
|
t0.tv_sec -= p->baseTime.tv_sec;
|
||||||
|
|
||||||
// get length of time to next exec point
|
// get length of time to next exec point
|
||||||
|
@ -12,14 +12,8 @@
|
|||||||
#include "cmMidiFile.h"
|
#include "cmMidiFile.h"
|
||||||
#include "cmMidiFilePlay.h"
|
#include "cmMidiFilePlay.h"
|
||||||
#include "cmThread.h" // cmSleepUs()
|
#include "cmThread.h" // cmSleepUs()
|
||||||
|
#include "cmTime.h"
|
||||||
|
|
||||||
#ifdef OS_OSX
|
|
||||||
#include "osx/clock_gettime_stub.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OS_LINUX
|
|
||||||
#include <time.h> // clock_gettime()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -286,7 +280,7 @@ void _cmMfpTestTimer()
|
|||||||
|
|
||||||
// t0 will be the base time which all other times will be
|
// t0 will be the base time which all other times will be
|
||||||
// set relative to.
|
// set relative to.
|
||||||
clock_gettime(CLOCK_REALTIME,&t0);
|
cmTimeGet(&t0);
|
||||||
t2 = t0;
|
t2 = t0;
|
||||||
t2.tv_sec = 0;
|
t2.tv_sec = 0;
|
||||||
|
|
||||||
@ -295,7 +289,7 @@ void _cmMfpTestTimer()
|
|||||||
cmSleepUs(suspendUsecs);
|
cmSleepUs(suspendUsecs);
|
||||||
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME,&t1);
|
cmTimeGet(&t1);
|
||||||
t1.tv_sec -= t0.tv_sec;
|
t1.tv_sec -= t0.tv_sec;
|
||||||
|
|
||||||
unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1);
|
unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1);
|
||||||
@ -350,7 +344,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx )
|
|||||||
if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC )
|
if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME,&base);
|
cmTimeGet(&base);
|
||||||
t0 = base;
|
t0 = base;
|
||||||
t0.tv_sec = 0;
|
t0.tv_sec = 0;
|
||||||
|
|
||||||
@ -359,7 +353,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx )
|
|||||||
{
|
{
|
||||||
cmSleepUs(suspendUsecs);
|
cmSleepUs(suspendUsecs);
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME,&t1);
|
cmTimeGet(&t1);
|
||||||
t1.tv_sec -= base.tv_sec;
|
t1.tv_sec -= base.tv_sec;
|
||||||
|
|
||||||
unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);
|
unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);
|
||||||
|
Loading…
Reference in New Issue
Block a user