Browse Source

cmAudioFileDev.c,cmMidiFilePlay.c:Replaced calls to clock_gettime() with equivalent calls to cmTimeGet().

master
kevin 11 years ago
parent
commit
0507290dfe
2 changed files with 8 additions and 23 deletions
  1. 3
    12
      cmAudioFileDev.c
  2. 5
    11
      cmMidiFilePlay.c

+ 3
- 12
cmAudioFileDev.c View File

8
 #include "cmThread.h"
8
 #include "cmThread.h"
9
 #include "cmAudioPort.h"
9
 #include "cmAudioPort.h"
10
 #include "cmAudioFileDev.h"
10
 #include "cmAudioFileDev.h"
11
-
12
-
13
-#ifdef OS_OSX
14
-#include "osx/clock_gettime_stub.h"
15
-#endif
16
-
17
-#ifdef OS_LINUX
18
-#include <time.h> // clock_gettime()
19
-#endif
20
-
11
+#include "cmTime.h"
21
 
12
 
22
 cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE;
13
 cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE;
23
 
14
 
148
   if( p->cycleCnt == 0 )
139
   if( p->cycleCnt == 0 )
149
   {
140
   {
150
     // get the baseTime - all other times will be relative to this time
141
     // get the baseTime - all other times will be relative to this time
151
-    clock_gettime(CLOCK_REALTIME,&p->baseTime);
142
+    cmTimeGet(&p->baseTime);
152
     p->nextTime = p->baseTime;
143
     p->nextTime = p->baseTime;
153
     p->nextTime.tv_sec = 0;
144
     p->nextTime.tv_sec = 0;
154
     _cmAfdIncrNextTime(p);
145
     _cmAfdIncrNextTime(p);
158
   if( p->runFl )
149
   if( p->runFl )
159
   {
150
   {
160
     // get the current time as an offset from baseTime.
151
     // get the current time as an offset from baseTime.
161
-    clock_gettime(CLOCK_REALTIME,&t0);
152
+    cmTimeGet(&t0);
162
     t0.tv_sec -= p->baseTime.tv_sec;
153
     t0.tv_sec -= p->baseTime.tv_sec;
163
 
154
 
164
     // get length of time to next exec point
155
     // get length of time to next exec point

+ 5
- 11
cmMidiFilePlay.c View File

12
 #include "cmMidiFile.h"
12
 #include "cmMidiFile.h"
13
 #include "cmMidiFilePlay.h"
13
 #include "cmMidiFilePlay.h"
14
 #include "cmThread.h" // cmSleepUs()
14
 #include "cmThread.h" // cmSleepUs()
15
+#include "cmTime.h"
15
 
16
 
16
-#ifdef OS_OSX
17
-#include "osx/clock_gettime_stub.h"
18
-#endif
19
-
20
-#ifdef OS_LINUX
21
-#include <time.h> // clock_gettime()
22
-#endif
23
 
17
 
24
 typedef struct
18
 typedef struct
25
 {
19
 {
286
   
280
   
287
   // t0 will be the base time which all other times will be 
281
   // t0 will be the base time which all other times will be 
288
   // set relative to.
282
   // set relative to.
289
-  clock_gettime(CLOCK_REALTIME,&t0);
283
+  cmTimeGet(&t0);
290
   t2 = t0;
284
   t2 = t0;
291
   t2.tv_sec = 0;
285
   t2.tv_sec = 0;
292
 
286
 
295
     cmSleepUs(suspendUsecs);
289
     cmSleepUs(suspendUsecs);
296
 
290
 
297
     
291
     
298
-    clock_gettime(CLOCK_REALTIME,&t1);
292
+    cmTimeGet(&t1);
299
     t1.tv_sec -= t0.tv_sec;
293
     t1.tv_sec -= t0.tv_sec;
300
 
294
 
301
     unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1);
295
     unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1);
350
   if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC )
344
   if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC )
351
     goto errLabel;
345
     goto errLabel;
352
 
346
 
353
-  clock_gettime(CLOCK_REALTIME,&base);
347
+  cmTimeGet(&base);
354
   t0 = base;
348
   t0 = base;
355
   t0.tv_sec = 0;
349
   t0.tv_sec = 0;
356
 
350
 
359
   {
353
   {
360
     cmSleepUs(suspendUsecs);
354
     cmSleepUs(suspendUsecs);
361
     
355
     
362
-    clock_gettime(CLOCK_REALTIME,&t1);    
356
+    cmTimeGet(&t1);    
363
     t1.tv_sec -= base.tv_sec;
357
     t1.tv_sec -= base.tv_sec;
364
 
358
 
365
     unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);
359
     unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);

Loading…
Cancel
Save