From a52909671f6c680492f01220040daedb0802c15e Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Dec 2013 18:44:35 -0500 Subject: [PATCH] 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. --- cmAudioSys.c | 7 ++++++- cmAudioSys.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmAudioSys.c b/cmAudioSys.c index 8b1d1ce..28c3761 100644 --- a/cmAudioSys.c +++ b/cmAudioSys.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" @@ -276,7 +277,8 @@ void _cmAsDspExecCallback( _cmAsCfg_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 ); // call the application provided DSP process cp->ctx.audioRateFl = true; @@ -554,6 +556,9 @@ cmAsRC_t _cmAudioSysEnable( cmAs_t* p, bool enableFl ) { _cmAsCfg_t* cp = p->ssArray + i; + cmApBufOnPortEnable(cp->ss.args.inDevIdx,enableFl); + cmApBufOnPortEnable(cp->ss.args.outDevIdx,enableFl); + if( enableFl ) { diff --git a/cmAudioSys.h b/cmAudioSys.h index 799e02f..f125e00 100644 --- a/cmAudioSys.h +++ b/cmAudioSys.h @@ -179,10 +179,12 @@ 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; } cmAudioSysCtx_t;