cmDevCfg.h/c:Added label to domain specific cfg records.
This commit is contained in:
parent
1194710744
commit
1be236f8d2
75
cmDevCfg.c
75
cmDevCfg.c
@ -134,7 +134,7 @@ void _cmDcmDuplAudio( cmDcmAudio_t* d, const cmDcmAudio_t* s )
|
||||
{
|
||||
d->inDevLabelStr = cmMemAllocStr(s->inDevLabelStr);
|
||||
d->outDevLabelStr = cmMemAllocStr(s->outDevLabelStr);
|
||||
d->audioSysArgs = s->audioSysArgs;
|
||||
d->rtSysArgs = s->rtSysArgs;
|
||||
}
|
||||
|
||||
void _cmDcmFreeNet( cmDcmNet_t* r )
|
||||
@ -228,7 +228,7 @@ cmDcmLoc_t* _cmDcmFindLoc( cmDcm_t* p, const cmChar_t* labelStr )
|
||||
{
|
||||
cmDcmLoc_t* lp = p->loc;
|
||||
for(; lp!=NULL; lp=lp->next)
|
||||
if(strcmp(lp->labelStr,labelStr)==0)
|
||||
if(strcmp(lp->labelStr,labelStr) == 0)
|
||||
return lp;
|
||||
return NULL;
|
||||
}
|
||||
@ -352,7 +352,7 @@ cmDcRC_t cmDevCfgAlloc( cmCtx_t* c, cmDevCfgH_t* hp, const cmChar_t* fn )
|
||||
cmDcRC_t cmDevCfgFree( cmDevCfgH_t* hp )
|
||||
{
|
||||
cmDcRC_t rc = kOkDcRC;
|
||||
if( hp == NULL || cmDevCfgIsValid(*hp)==false )
|
||||
if( hp == NULL || cmDevCfgIsValid(*hp) == false )
|
||||
return rc;
|
||||
|
||||
cmDcm_t* p = _cmDcmHandleToPtr(*hp);
|
||||
@ -370,7 +370,7 @@ bool cmDevCfgIsValid( cmDevCfgH_t h )
|
||||
|
||||
unsigned cmDevCfgCount( cmDevCfgH_t h, cmTypeDcmId_t typeId )
|
||||
{
|
||||
unsigned n=0;
|
||||
unsigned n = 0;
|
||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||
|
||||
assert( p->clp != NULL);
|
||||
@ -384,7 +384,7 @@ unsigned cmDevCfgCount( cmDevCfgH_t h, cmTypeDcmId_t typeId )
|
||||
|
||||
cmDcmCfg_t* _cmDevCfgIndexToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, unsigned index, bool errFl )
|
||||
{
|
||||
unsigned n=0;
|
||||
unsigned n = 0;
|
||||
assert( p->clp != NULL);
|
||||
cmDcmCfg_t* cp = p->clp->cfg;
|
||||
for(; cp!= NULL; cp=cp->next)
|
||||
@ -428,7 +428,7 @@ cmDcmCfg_t* _cmDcmCfgLabelToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, const cmChar_
|
||||
for(; cp!= NULL; cp=cp->next)
|
||||
if( cp->typeId == typeId )
|
||||
{
|
||||
if( strcmp(cp->dcLabelStr,label)==0 )
|
||||
if( strcmp(cp->dcLabelStr,label) == 0 )
|
||||
return cp;
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ unsigned cmDevCfgLabelToIndex( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar
|
||||
for(; cp!= NULL; cp=cp->next)
|
||||
if( cp->typeId == typeId )
|
||||
{
|
||||
if( strcmp(cp->dcLabelStr,label)==0 )
|
||||
if( strcmp(cp->dcLabelStr,label) == 0 )
|
||||
return n;
|
||||
++n;
|
||||
}
|
||||
@ -646,6 +646,7 @@ cmDcRC_t cmDevCfgNameMidiPort(
|
||||
if((cp = _cmDcmFindOrCreateCfg(p,kMidiDcmTId, dcLabelStr)) == NULL )
|
||||
return cmErrLastRC(&p->err);
|
||||
|
||||
cp->u.m.label = cp->dcLabelStr;
|
||||
cp->u.m.devLabelStr = cmMemResizeStr(cp->u.m.devLabelStr,devLabelStr);
|
||||
cp->u.m.portLabelStr = cmMemResizeStr(cp->u.m.portLabelStr,portLabelStr);
|
||||
cp->u.m.inputFl = inputFl;
|
||||
@ -756,18 +757,19 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
||||
unsigned inChCnt = cmApDeviceChannelCount( inDevIdx, true );
|
||||
unsigned outChCnt = cmApDeviceChannelCount( outDevIdx, false );
|
||||
|
||||
cp->u.a.label = cp->dcLabelStr;
|
||||
cp->u.a.inDevLabelStr = cmMemAllocStr(inDevNameStr==NULL?"":inDevNameStr);
|
||||
cp->u.a.outDevLabelStr = cmMemAllocStr(outDevNameStr==NULL?"":outDevNameStr);
|
||||
cp->u.a.activeFl = activeFl;
|
||||
cp->u.a.audioSysArgs.rpt = p->err.rpt;
|
||||
cp->u.a.audioSysArgs.inDevIdx = inDevIdx;
|
||||
cp->u.a.audioSysArgs.outDevIdx = outDevIdx;
|
||||
cp->u.a.audioSysArgs.syncInputFl = syncInputFl;
|
||||
cp->u.a.audioSysArgs.msgQueueByteCnt = msgQueueByteCnt;
|
||||
cp->u.a.audioSysArgs.devFramesPerCycle = devFramesPerCycle;
|
||||
cp->u.a.audioSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
||||
cp->u.a.audioSysArgs.audioBufCnt = audioBufCnt;
|
||||
cp->u.a.audioSysArgs.srate = srate;
|
||||
cp->u.a.rtSysArgs.rpt = p->err.rpt;
|
||||
cp->u.a.rtSysArgs.inDevIdx = inDevIdx;
|
||||
cp->u.a.rtSysArgs.outDevIdx = outDevIdx;
|
||||
cp->u.a.rtSysArgs.syncInputFl = syncInputFl;
|
||||
cp->u.a.rtSysArgs.msgQueueByteCnt = msgQueueByteCnt;
|
||||
cp->u.a.rtSysArgs.devFramesPerCycle = devFramesPerCycle;
|
||||
cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
||||
cp->u.a.rtSysArgs.audioBufCnt = audioBufCnt;
|
||||
cp->u.a.rtSysArgs.srate = srate;
|
||||
cp->descStr = cmTsPrintfP(cp->descStr,"%sIn: Chs:%i %s\nOut: Chs:%i %s",activeFl?"":"INACTIVE ",inChCnt,cp->u.a.inDevLabelStr,outChCnt,cp->u.a.outDevLabelStr);
|
||||
return kOkDcRC;
|
||||
}
|
||||
@ -978,6 +980,7 @@ cmDcRC_t cmDevCfgNameNetPort(
|
||||
if((cp = _cmDcmFindOrCreateCfg(p,kNetDcmTId, dcLabelStr)) == NULL )
|
||||
return cmErrLastRC(&p->err);
|
||||
|
||||
cp->u.n.label = cp->dcLabelStr;
|
||||
cp->u.n.sockAddr = cmMemAllocStr(sockAddr);
|
||||
cp->u.n.portNumber = portNumber;
|
||||
cp->u.n.localFl = localFl;
|
||||
@ -1274,7 +1277,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
||||
unsigned tid,cfgId;
|
||||
cmJsonNode_t* mapObjNp;
|
||||
|
||||
if((mapObjNp = cmJsonArrayElement(mapArrNp,j))==NULL || cmJsonIsObject(mapObjNp)==false)
|
||||
if((mapObjNp = cmJsonArrayElement(mapArrNp,j)) == NULL || cmJsonIsObject(mapObjNp)==false)
|
||||
return _cmDcmJsonSyntaxErr(p,"cfg object");
|
||||
|
||||
if( cmJsonMemberValues( mapObjNp, &errLabelPtr,
|
||||
@ -1294,7 +1297,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
||||
const cmChar_t* descStr;
|
||||
unsigned cfgId, typeId;
|
||||
|
||||
if((cfgObjNp = cmJsonArrayElement(cfgArrNp,j))==NULL || cmJsonIsObject(cfgObjNp)==false)
|
||||
if((cfgObjNp = cmJsonArrayElement(cfgArrNp,j)) == NULL || cmJsonIsObject(cfgObjNp)==false)
|
||||
return _cmDcmJsonSyntaxErr(p,"cfg object");
|
||||
|
||||
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
||||
@ -1331,12 +1334,12 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
||||
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
||||
"inDevLabelStr", kStringTId, &a.inDevLabelStr,
|
||||
"outDevLabelStr", kStringTId, &a.outDevLabelStr,
|
||||
"syncInputFl", kBoolTId, &a.audioSysArgs.syncInputFl,
|
||||
"msgQueueByteCnt", kIntTId, &a.audioSysArgs.msgQueueByteCnt,
|
||||
"devFramesPerCycle", kIntTId, &a.audioSysArgs.devFramesPerCycle,
|
||||
"dspFramesPerCycle", kIntTId, &a.audioSysArgs.dspFramesPerCycle,
|
||||
"audioBufCnt", kIntTId, &a.audioSysArgs.audioBufCnt,
|
||||
"srate", kRealTId, &a.audioSysArgs.srate,
|
||||
"syncInputFl", kBoolTId, &a.rtSysArgs.syncInputFl,
|
||||
"msgQueueByteCnt", kIntTId, &a.rtSysArgs.msgQueueByteCnt,
|
||||
"devFramesPerCycle", kIntTId, &a.rtSysArgs.devFramesPerCycle,
|
||||
"dspFramesPerCycle", kIntTId, &a.rtSysArgs.dspFramesPerCycle,
|
||||
"audioBufCnt", kIntTId, &a.rtSysArgs.audioBufCnt,
|
||||
"srate", kRealTId, &a.rtSysArgs.srate,
|
||||
"active", kBoolTId, &a.activeFl,
|
||||
NULL ) != kOkJsRC )
|
||||
{
|
||||
@ -1345,12 +1348,12 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
||||
}
|
||||
|
||||
if((rc = cmDevCfgNameAudioPort(h,dcLabelStr,a.inDevLabelStr,a.outDevLabelStr,
|
||||
a.audioSysArgs.syncInputFl,
|
||||
a.audioSysArgs.msgQueueByteCnt,
|
||||
a.audioSysArgs.devFramesPerCycle,
|
||||
a.audioSysArgs.dspFramesPerCycle,
|
||||
a.audioSysArgs.audioBufCnt,
|
||||
a.audioSysArgs.srate,
|
||||
a.rtSysArgs.syncInputFl,
|
||||
a.rtSysArgs.msgQueueByteCnt,
|
||||
a.rtSysArgs.devFramesPerCycle,
|
||||
a.rtSysArgs.dspFramesPerCycle,
|
||||
a.rtSysArgs.audioBufCnt,
|
||||
a.rtSysArgs.srate,
|
||||
a.activeFl)) != kOkDcRC )
|
||||
{
|
||||
goto errLabel;
|
||||
@ -1463,12 +1466,12 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
||||
cmJsonInsertPairs(jsH, cfgObjNp,
|
||||
"inDevLabelStr", kStringTId, cp->u.a.inDevLabelStr,
|
||||
"outDevLabelStr", kStringTId, cp->u.a.outDevLabelStr,
|
||||
"syncInputFl", kBoolTId, cp->u.a.audioSysArgs.syncInputFl,
|
||||
"msgQueueByteCnt", kIntTId, cp->u.a.audioSysArgs.msgQueueByteCnt,
|
||||
"devFramesPerCycle", kIntTId, cp->u.a.audioSysArgs.devFramesPerCycle,
|
||||
"dspFramesPerCycle", kIntTId, cp->u.a.audioSysArgs.dspFramesPerCycle,
|
||||
"audioBufCnt", kIntTId, cp->u.a.audioSysArgs.audioBufCnt,
|
||||
"srate", kRealTId, cp->u.a.audioSysArgs.srate,
|
||||
"syncInputFl", kBoolTId, cp->u.a.rtSysArgs.syncInputFl,
|
||||
"msgQueueByteCnt", kIntTId, cp->u.a.rtSysArgs.msgQueueByteCnt,
|
||||
"devFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.devFramesPerCycle,
|
||||
"dspFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.dspFramesPerCycle,
|
||||
"audioBufCnt", kIntTId, cp->u.a.rtSysArgs.audioBufCnt,
|
||||
"srate", kRealTId, cp->u.a.rtSysArgs.srate,
|
||||
"active", kBoolTId, cp->u.a.activeFl,
|
||||
NULL );
|
||||
break;
|
||||
|
@ -67,6 +67,7 @@ extern "C" {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const cmChar_t* label; // cfg label
|
||||
cmChar_t* devLabelStr; // Midi device label.
|
||||
cmChar_t* portLabelStr; // Midi device port label.
|
||||
bool inputFl; // 'True' if this is an input port.
|
||||
@ -76,15 +77,17 @@ extern "C" {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const cmChar_t* label; // cfg label
|
||||
cmChar_t* inDevLabelStr; // Input audio device label.
|
||||
cmChar_t* outDevLabelStr; // Output audio device label.
|
||||
cmRtSysArgs_t audioSysArgs; // Audio system cfg recd
|
||||
cmRtSysArgs_t rtSysArgs; // RT system cfg recd
|
||||
bool dfltFl; // true if this is the default audio cfg.
|
||||
bool activeFl;
|
||||
} cmDcmAudio_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const cmChar_t* label; // cfg label
|
||||
cmChar_t* sockAddr; // socket address.
|
||||
unsigned portNumber; // socket port number
|
||||
bool localFl; // this is the local port
|
||||
|
Loading…
Reference in New Issue
Block a user