From f4829a838d8bf1e74d7644f5e3e995ee962a6f96 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 8 Apr 2013 23:02:37 -0700 Subject: [PATCH] cmAudioSys.h/c and cmAudioSysMsg.h: Added several kAsDfltXXX values. cmAudioSysSsInitMsg_t now includes srate and dspFramesPerCycle. --- cmAudioSys.c | 23 ++++++++++++----------- cmAudioSys.h | 4 +++- cmAudioSysMsg.h | 2 ++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cmAudioSys.c b/cmAudioSys.c index 45f105a..8b1d1ce 100644 --- a/cmAudioSys.c +++ b/cmAudioSys.c @@ -21,7 +21,6 @@ #include "cmMath.h" -#include // usleep cmAudioSysH_t cmAudioSysNullHandle = { NULL }; @@ -130,13 +129,15 @@ cmAsRC_t _cmAsHostInitNotify( cmAs_t* p ) const char* inDevLabel = cp->ss.args.inDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.inDevIdx ); const char* outDevLabel = cp->ss.args.outDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.outDevIdx ); - m.asSubIdx = i; - m.selId = kSsInitSelAsId; - m.asSubCnt = p->ssCnt; - m.inDevIdx = cp->ss.args.inDevIdx; - m.outDevIdx = cp->ss.args.outDevIdx; - m.inChCnt = cp->status.iMeterCnt; - m.outChCnt = cp->status.oMeterCnt; + m.asSubIdx = i; + m.selId = kSsInitSelAsId; + m.asSubCnt = p->ssCnt; + m.inDevIdx = cp->ss.args.inDevIdx; + m.outDevIdx = cp->ss.args.outDevIdx; + m.dspFramesPerCycle = cp->ss.args.dspFramesPerCycle; + m.srate = cp->ss.args.srate; + m.inChCnt = cp->status.iMeterCnt; + m.outChCnt = cp->status.oMeterCnt; unsigned segCnt = 3; const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel }; @@ -495,7 +496,7 @@ void _cmAudioSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt ) asH.h = cp->p; unsigned selId = kMidiMsgArraySelAsId; - const void* msgPtrArray[] = { &cp->ctx.asSubIdx, &selId, &pkt->devIdx, &pkt->portIdx, &pkt->msgCnt, pkt->msgArray }; + const void* msgPtrArray[] = { &cp->ctx.asSubIdx, &selId, &pkt->devIdx, &pkt->portIdx, &pkt->msgCnt, pkt->msgArray }; unsigned msgByteCntArray[] = { sizeof(cp->ctx.asSubIdx), sizeof(selId), sizeof(pkt->devIdx), sizeof(pkt->portIdx), sizeof(pkt->msgCnt), pkt->msgCnt*sizeof(cmMidiMsg) }; unsigned msgSegCnt = sizeof(msgByteCntArray)/sizeof(unsigned); @@ -578,7 +579,7 @@ cmAsRC_t _cmAudioSysEnable( cmAs_t* p, bool enableFl ) } - cp->enableFl = enableFl; + cp->enableFl = enableFl; } return kOkAsRC; } @@ -610,7 +611,7 @@ cmAsRC_t _cmAudioSysFinalize( cmAs_t* p ) // cond variable from _cmAsAudioUpdate() otherwise the system may crash while( cp->audCbLock != 0 ) - { usleep(100000); } + { cmSleepUs(100000); } // signal the cond var to cause the thread to run if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC ) diff --git a/cmAudioSys.h b/cmAudioSys.h index 0c575ef..799e02f 100644 --- a/cmAudioSys.h +++ b/cmAudioSys.h @@ -89,7 +89,9 @@ extern "C" { kAsDfltBufCnt = 3, kAsDfltSrate = 44100, kAsDfltSyncToInputFl = 1, - kAsDfltMeterMs = 50 + kAsDfltMinMeterMs = 10, + kAsDfltMeterMs = 50, + kAsDfltMaxMeterMs = 1000 }; typedef cmHandle_t cmAudioSysH_t; //< Audio system handle type diff --git a/cmAudioSysMsg.h b/cmAudioSysMsg.h index 7121db9..d7b6efa 100644 --- a/cmAudioSysMsg.h +++ b/cmAudioSysMsg.h @@ -81,6 +81,8 @@ extern "C" { unsigned asSubCnt; ///< count of sub-systems unsigned inDevIdx; ///< input device index unsigned outDevIdx; ///< output device index + unsigned dspFramesPerCycle; + double srate; unsigned inChCnt; ///< input device channel count unsigned outChCnt; ///< outut device channel count } cmAudioSysSsInitMsg_t;