cmAudioSys.h/c and cmAudioSysMsg.h: Added several kAsDfltXXX values. cmAudioSysSsInitMsg_t now includes srate and dspFramesPerCycle.

This commit is contained in:
kevin 2013-04-08 23:02:37 -07:00
parent 0955f67cb3
commit f4829a838d
3 changed files with 17 additions and 12 deletions

View File

@ -21,7 +21,6 @@
#include "cmMath.h" #include "cmMath.h"
#include <unistd.h> // usleep
cmAudioSysH_t cmAudioSysNullHandle = { NULL }; 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* inDevLabel = cp->ss.args.inDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.inDevIdx );
const char* outDevLabel = cp->ss.args.outDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.outDevIdx ); const char* outDevLabel = cp->ss.args.outDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.outDevIdx );
m.asSubIdx = i; m.asSubIdx = i;
m.selId = kSsInitSelAsId; m.selId = kSsInitSelAsId;
m.asSubCnt = p->ssCnt; m.asSubCnt = p->ssCnt;
m.inDevIdx = cp->ss.args.inDevIdx; m.inDevIdx = cp->ss.args.inDevIdx;
m.outDevIdx = cp->ss.args.outDevIdx; m.outDevIdx = cp->ss.args.outDevIdx;
m.inChCnt = cp->status.iMeterCnt; m.dspFramesPerCycle = cp->ss.args.dspFramesPerCycle;
m.outChCnt = cp->status.oMeterCnt; m.srate = cp->ss.args.srate;
m.inChCnt = cp->status.iMeterCnt;
m.outChCnt = cp->status.oMeterCnt;
unsigned segCnt = 3; unsigned segCnt = 3;
const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel }; const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel };
@ -495,7 +496,7 @@ void _cmAudioSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt )
asH.h = cp->p; asH.h = cp->p;
unsigned selId = kMidiMsgArraySelAsId; 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 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); unsigned msgSegCnt = sizeof(msgByteCntArray)/sizeof(unsigned);
@ -610,7 +611,7 @@ cmAsRC_t _cmAudioSysFinalize( cmAs_t* p )
// cond variable from _cmAsAudioUpdate() otherwise the system may crash // cond variable from _cmAsAudioUpdate() otherwise the system may crash
while( cp->audCbLock != 0 ) while( cp->audCbLock != 0 )
{ usleep(100000); } { cmSleepUs(100000); }
// signal the cond var to cause the thread to run // signal the cond var to cause the thread to run
if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC ) if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC )

View File

@ -89,7 +89,9 @@ extern "C" {
kAsDfltBufCnt = 3, kAsDfltBufCnt = 3,
kAsDfltSrate = 44100, kAsDfltSrate = 44100,
kAsDfltSyncToInputFl = 1, kAsDfltSyncToInputFl = 1,
kAsDfltMeterMs = 50 kAsDfltMinMeterMs = 10,
kAsDfltMeterMs = 50,
kAsDfltMaxMeterMs = 1000
}; };
typedef cmHandle_t cmAudioSysH_t; //< Audio system handle type typedef cmHandle_t cmAudioSysH_t; //< Audio system handle type

View File

@ -81,6 +81,8 @@ extern "C" {
unsigned asSubCnt; ///< count of sub-systems unsigned asSubCnt; ///< count of sub-systems
unsigned inDevIdx; ///< input device index unsigned inDevIdx; ///< input device index
unsigned outDevIdx; ///< output device index unsigned outDevIdx; ///< output device index
unsigned dspFramesPerCycle;
double srate;
unsigned inChCnt; ///< input device channel count unsigned inChCnt; ///< input device channel count
unsigned outChCnt; ///< outut device channel count unsigned outChCnt; ///< outut device channel count
} cmAudioSysSsInitMsg_t; } cmAudioSysSsInitMsg_t;