From 58f2040529bf2ec206257e8822ccd61498c481a3 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Dec 2013 18:49:49 -0500 Subject: [PATCH] cmRtSys.h/c: cmRtSysCtx.h now have cmTimeSpec_t timestamps. These timestamps are set in _cmRtDspExecCallback() by cmApBufGetIO(). _cmRtSysEnable() now calls cmApBufOnPortEnable() to allow cmApBuf to be aware of the audio stream starting and stopping. --- cmRtSys.c | 7 ++++++- cmRtSys.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmRtSys.c b/cmRtSys.c index 60e030a..4d5ad98 100644 --- a/cmRtSys.c +++ b/cmRtSys.c @@ -6,6 +6,7 @@ #include "cmCtx.h" #include "cmMem.h" #include "cmMallocDebug.h" +#include "cmTime.h" #include "cmAudioPort.h" #include "cmAudioNrtDev.h" #include "cmAudioPortFile.h" @@ -294,7 +295,8 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp ) // 1) Buffers associated with disabled input/output channels will be set to NULL in iChArray[]/oChArray[]. // 2) Buffers associated with channels marked for pass-through will be set to NULL in oChArray[]. // 3) All samples returned in oChArray[] buffers will be set to zero. - cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt ); + cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, &cp->ctx.iTimeStamp, + cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt, &cp->ctx.oTimeStamp ); // calling this function results in callbacks to _cmRtSysNetRecv() @@ -605,6 +607,9 @@ cmRtRC_t _cmRtSysEnable( cmRt_t* p, bool enableFl ) { _cmRtCfg_t* cp = p->ssArray + i; + cmApBufOnPortEnable(cp->ss.args.inDevIdx,enableFl); + cmApBufOnPortEnable(cp->ss.args.outDevIdx,enableFl); + if( enableFl ) { cp->cmdId = kNoCmdId; diff --git a/cmRtSys.h b/cmRtSys.h index 048e25f..6b7b8c6 100644 --- a/cmRtSys.h +++ b/cmRtSys.h @@ -201,10 +201,11 @@ extern "C" { // output (playback) buffers cmSample_t** oChArray; // each ele is a ptr to buffer with cfg.dspFramesPerCycle samples unsigned oChCnt; // count of output channels (ele's in oChArray[]) - + cmTimeSpec_t oTimeStamp; // input (recording) buffers cmSample_t** iChArray; // each ele is a ptr to buffer with cfg.dspFramesPerCycle samples unsigned iChCnt; // count of input channels (ele's in iChArray[]) + cmTimeSpec_t iTimeStamp; } cmRtSysCtx_t;