Browse Source

cmAudioSys.h/c : cmAudioSysCtx_t now have time stamps which are set in

the cmApBufGetIO() calls in _cmAsDspExecCallback().
_cmAudioSysEnable() now calls cmApBufOnPortEnable() to that cmApBuf() can
be aware to when audio streaming is starting and stopping.
master
kevin 10 years ago
parent
commit
a52909671f
2 changed files with 8 additions and 1 deletions
  1. 6
    1
      cmAudioSys.c
  2. 2
    0
      cmAudioSys.h

+ 6
- 1
cmAudioSys.c View File

@@ -6,6 +6,7 @@
6 6
 #include "cmCtx.h"
7 7
 #include "cmMem.h"
8 8
 #include "cmMallocDebug.h"
9
+#include "cmTime.h"
9 10
 #include "cmAudioPort.h"
10 11
 #include "cmAudioNrtDev.h"
11 12
 #include "cmAudioPortFile.h"
@@ -276,7 +277,8 @@ void _cmAsDspExecCallback( _cmAsCfg_t* cp )
276 277
   //   1) Buffers associated with disabled input/output channels will be set to NULL in iChArray[]/oChArray[].
277 278
   //   2) Buffers associated with channels marked for pass-through will be set to NULL in oChArray[].
278 279
   //   3) All samples returned in oChArray[] buffers will be set to zero.
279
-  cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt  );
280
+  cmApBufGetIO(cp->ss.args.inDevIdx,  cp->ctx.iChArray, cp->ctx.iChCnt, &cp->ctx.iTimeStamp, 
281
+               cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt, &cp->ctx.oTimeStamp  );
280 282
 
281 283
   // call the application provided DSP process
282 284
   cp->ctx.audioRateFl = true;
@@ -554,6 +556,9 @@ cmAsRC_t _cmAudioSysEnable( cmAs_t* p, bool enableFl )
554 556
   {
555 557
     _cmAsCfg_t* cp = p->ssArray + i;
556 558
 
559
+    cmApBufOnPortEnable(cp->ss.args.inDevIdx,enableFl);
560
+    cmApBufOnPortEnable(cp->ss.args.outDevIdx,enableFl);
561
+    
557 562
     if( enableFl )
558 563
     {
559 564
 

+ 2
- 0
cmAudioSys.h View File

@@ -179,10 +179,12 @@ extern "C" {
179 179
                                        // output (playback) buffers
180 180
     cmSample_t**        oChArray;      // each ele is a ptr to buffer with cfg.dspFramesPerCycle samples
181 181
     unsigned            oChCnt;        // count of output channels (ele's in oChArray[])
182
+    cmTimeSpec_t        oTimeStamp;
182 183
 
183 184
                                        // input (recording) buffers
184 185
     cmSample_t**        iChArray;      // each ele is a ptr to buffer with cfg.dspFramesPerCycle samples
185 186
     unsigned            iChCnt;        // count of input channels (ele's in iChArray[])
187
+    cmTimeSpec_t        iTimeStamp;
186 188
     
187 189
   } cmAudioSysCtx_t;
188 190
 

Loading…
Cancel
Save