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.
This commit is contained in:
kevin 2013-12-15 18:44:35 -05:00
parent 40a649dfc1
commit a52909671f
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include "cmCtx.h" #include "cmCtx.h"
#include "cmMem.h" #include "cmMem.h"
#include "cmMallocDebug.h" #include "cmMallocDebug.h"
#include "cmTime.h"
#include "cmAudioPort.h" #include "cmAudioPort.h"
#include "cmAudioNrtDev.h" #include "cmAudioNrtDev.h"
#include "cmAudioPortFile.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[]. // 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[]. // 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. // 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 // call the application provided DSP process
cp->ctx.audioRateFl = true; cp->ctx.audioRateFl = true;
@ -554,6 +556,9 @@ cmAsRC_t _cmAudioSysEnable( cmAs_t* p, bool enableFl )
{ {
_cmAsCfg_t* cp = p->ssArray + i; _cmAsCfg_t* cp = p->ssArray + i;
cmApBufOnPortEnable(cp->ss.args.inDevIdx,enableFl);
cmApBufOnPortEnable(cp->ss.args.outDevIdx,enableFl);
if( enableFl ) if( enableFl )
{ {

View File

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