cmDevCfg.h/c:Added label to domain specific cfg records.
This commit is contained in:
parent
1194710744
commit
1be236f8d2
231
cmDevCfg.c
231
cmDevCfg.c
@ -25,10 +25,10 @@ cmDevCfgH_t cmDevCfgNullHandle = cmSTATIC_NULL_HANDLE;
|
|||||||
|
|
||||||
typedef struct cmDcmCfg_str
|
typedef struct cmDcmCfg_str
|
||||||
{
|
{
|
||||||
cmChar_t* dcLabelStr; // the cfg label
|
cmChar_t* dcLabelStr; // the cfg label
|
||||||
unsigned cfgId; // unique among all cfg's assigned to a loc
|
unsigned cfgId; // unique among all cfg's assigned to a loc
|
||||||
cmTypeDcmId_t typeId; // the cfg type id (e.g. midi, audio, net, ...)
|
cmTypeDcmId_t typeId; // the cfg type id (e.g. midi, audio, net, ...)
|
||||||
cmChar_t* descStr; // summary description string
|
cmChar_t* descStr; // summary description string
|
||||||
|
|
||||||
// NOTE: any fields added to this structure, type generic (above)
|
// NOTE: any fields added to this structure, type generic (above)
|
||||||
// or type specific (below), must be explicitely duplicated in cmDevCfgLocStore().
|
// or type specific (below), must be explicitely duplicated in cmDevCfgLocStore().
|
||||||
@ -46,9 +46,9 @@ typedef struct cmDcmCfg_str
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
cmTypeDcmId_t tid; // Type Id for this map or tInvalidDcmTId if the record is not active.
|
cmTypeDcmId_t tid; // Type Id for this map or tInvalidDcmTId if the record is not active.
|
||||||
unsigned cfgId; // cfgId of the cfg recd assoc'd with this map
|
unsigned cfgId; // cfgId of the cfg recd assoc'd with this map
|
||||||
cmDcmCfg_t* cfg; // pointer to the cfg recd assoc'd with this map (cfg->cfgId == cmDcmMap_t.cfgId)
|
cmDcmCfg_t* cfg; // pointer to the cfg recd assoc'd with this map (cfg->cfgId == cmDcmMap_t.cfgId)
|
||||||
} cmDcmMap_t;
|
} cmDcmMap_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -60,10 +60,10 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct cmDcmLoc_str
|
typedef struct cmDcmLoc_str
|
||||||
{
|
{
|
||||||
cmChar_t* labelStr;
|
cmChar_t* labelStr;
|
||||||
|
|
||||||
cmDcmApp_t* app;
|
cmDcmApp_t* app;
|
||||||
unsigned appCnt;
|
unsigned appCnt;
|
||||||
|
|
||||||
cmDcmCfg_t* cfg;
|
cmDcmCfg_t* cfg;
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void _cmDcmDuplAudio( cmDcmAudio_t* d, const cmDcmAudio_t* s )
|
|||||||
{
|
{
|
||||||
d->inDevLabelStr = cmMemAllocStr(s->inDevLabelStr);
|
d->inDevLabelStr = cmMemAllocStr(s->inDevLabelStr);
|
||||||
d->outDevLabelStr = cmMemAllocStr(s->outDevLabelStr);
|
d->outDevLabelStr = cmMemAllocStr(s->outDevLabelStr);
|
||||||
d->audioSysArgs = s->audioSysArgs;
|
d->rtSysArgs = s->rtSysArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cmDcmFreeNet( cmDcmNet_t* r )
|
void _cmDcmFreeNet( cmDcmNet_t* r )
|
||||||
@ -155,7 +155,7 @@ void _cmDcmFreeCfg( cmDcm_t* p, cmDcmLoc_t* lp, cmDcmCfg_t* cp )
|
|||||||
{
|
{
|
||||||
// unlink the cfg recd
|
// unlink the cfg recd
|
||||||
if( cp->prev == NULL )
|
if( cp->prev == NULL )
|
||||||
lp->cfg = cp->next;
|
lp->cfg = cp->next;
|
||||||
else
|
else
|
||||||
cp->prev->next = cp->next;
|
cp->prev->next = cp->next;
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ void _cmDcmFreeLoc( cmDcm_t* p, cmDcmLoc_t* lp )
|
|||||||
|
|
||||||
// unlink the loc recd
|
// unlink the loc recd
|
||||||
if( lp->prev == NULL )
|
if( lp->prev == NULL )
|
||||||
p->loc = lp->next;
|
p->loc = lp->next;
|
||||||
else
|
else
|
||||||
lp->prev->next = lp->next;
|
lp->prev->next = lp->next;
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ void _cmDcmFreeAllLocs( cmDcm_t* p )
|
|||||||
while( p->loc != NULL )
|
while( p->loc != NULL )
|
||||||
_cmDcmFreeLoc(p,p->loc);
|
_cmDcmFreeLoc(p,p->loc);
|
||||||
|
|
||||||
p->clp = NULL;
|
p->clp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmDcRC_t _cmDcmFree( cmDcm_t* p )
|
cmDcRC_t _cmDcmFree( cmDcm_t* p )
|
||||||
@ -226,9 +226,9 @@ cmDcRC_t _cmDcmFree( cmDcm_t* p )
|
|||||||
|
|
||||||
cmDcmLoc_t* _cmDcmFindLoc( cmDcm_t* p, const cmChar_t* labelStr )
|
cmDcmLoc_t* _cmDcmFindLoc( cmDcm_t* p, const cmChar_t* labelStr )
|
||||||
{
|
{
|
||||||
cmDcmLoc_t* lp = p->loc;
|
cmDcmLoc_t* lp = p->loc;
|
||||||
for(; lp!=NULL; lp=lp->next)
|
for(; lp!=NULL; lp=lp->next)
|
||||||
if(strcmp(lp->labelStr,labelStr)==0)
|
if(strcmp(lp->labelStr,labelStr) == 0)
|
||||||
return lp;
|
return lp;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -250,26 +250,26 @@ cmDcRC_t _cmDcmNewLoc( cmDcm_t* p, const cmChar_t* labelStr, cmDcmLoc_t** locRe
|
|||||||
return cmErrMsg(&p->err,kDuplLabelDcRC,"The location label '%s' is already in use.",labelStr);
|
return cmErrMsg(&p->err,kDuplLabelDcRC,"The location label '%s' is already in use.",labelStr);
|
||||||
|
|
||||||
// create a new loc recd
|
// create a new loc recd
|
||||||
lp = cmMemAllocZ(cmDcmLoc_t,1);
|
lp = cmMemAllocZ(cmDcmLoc_t,1);
|
||||||
lp->labelStr = cmMemAllocStr(labelStr);
|
lp->labelStr = cmMemAllocStr(labelStr);
|
||||||
|
|
||||||
// if the cur loc is not current set - then prepend loc
|
// if the cur loc is not current set - then prepend loc
|
||||||
if( p->clp == NULL )
|
if( p->clp == NULL )
|
||||||
{
|
{
|
||||||
lp->prev = NULL;
|
lp->prev = NULL;
|
||||||
lp->next = p->loc;
|
lp->next = p->loc;
|
||||||
if( p->loc == NULL )
|
if( p->loc == NULL )
|
||||||
p->loc = lp;
|
p->loc = lp;
|
||||||
else
|
else
|
||||||
p->loc->prev = lp;
|
p->loc->prev = lp;
|
||||||
}
|
}
|
||||||
else // otherwise insert loc after the cur loc
|
else // otherwise insert loc after the cur loc
|
||||||
{
|
{
|
||||||
lp->prev = p->clp;
|
lp->prev = p->clp;
|
||||||
lp->next = p->clp->next;
|
lp->next = p->clp->next;
|
||||||
if( p->clp->next != NULL )
|
if( p->clp->next != NULL )
|
||||||
p->clp->next->prev = lp;
|
p->clp->next->prev = lp;
|
||||||
p->clp->next = lp;
|
p->clp->next = lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the new loc the current loc
|
// make the new loc the current loc
|
||||||
@ -309,7 +309,7 @@ cmDcRC_t _cmDevCfgReadFile( cmDcm_t* p, const cmChar_t* fn )
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgAlloc( cmCtx_t* c, cmDevCfgH_t* hp, const cmChar_t* fn )
|
cmDcRC_t cmDevCfgAlloc( cmCtx_t* c, cmDevCfgH_t* hp, const cmChar_t* fn )
|
||||||
{
|
{
|
||||||
cmDcRC_t rc;
|
cmDcRC_t rc;
|
||||||
cmDcmLoc_t* lp;
|
cmDcmLoc_t* lp;
|
||||||
|
|
||||||
if((rc = cmDevCfgFree(hp)) != kOkDcRC )
|
if((rc = cmDevCfgFree(hp)) != kOkDcRC )
|
||||||
@ -351,8 +351,8 @@ cmDcRC_t cmDevCfgAlloc( cmCtx_t* c, cmDevCfgH_t* hp, const cmChar_t* fn )
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgFree( cmDevCfgH_t* hp )
|
cmDcRC_t cmDevCfgFree( cmDevCfgH_t* hp )
|
||||||
{
|
{
|
||||||
cmDcRC_t rc = kOkDcRC;
|
cmDcRC_t rc = kOkDcRC;
|
||||||
if( hp == NULL || cmDevCfgIsValid(*hp)==false )
|
if( hp == NULL || cmDevCfgIsValid(*hp) == false )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(*hp);
|
cmDcm_t* p = _cmDcmHandleToPtr(*hp);
|
||||||
@ -370,7 +370,7 @@ bool cmDevCfgIsValid( cmDevCfgH_t h )
|
|||||||
|
|
||||||
unsigned cmDevCfgCount( cmDevCfgH_t h, cmTypeDcmId_t typeId )
|
unsigned cmDevCfgCount( cmDevCfgH_t h, cmTypeDcmId_t typeId )
|
||||||
{
|
{
|
||||||
unsigned n=0;
|
unsigned n = 0;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL);
|
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 )
|
cmDcmCfg_t* _cmDevCfgIndexToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, unsigned index, bool errFl )
|
||||||
{
|
{
|
||||||
unsigned n=0;
|
unsigned n = 0;
|
||||||
assert( p->clp != NULL);
|
assert( p->clp != NULL);
|
||||||
cmDcmCfg_t* cp = p->clp->cfg;
|
cmDcmCfg_t* cp = p->clp->cfg;
|
||||||
for(; cp!= NULL; cp=cp->next)
|
for(; cp!= NULL; cp=cp->next)
|
||||||
@ -403,7 +403,7 @@ cmDcmCfg_t* _cmDevCfgIndexToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, unsigned inde
|
|||||||
|
|
||||||
const cmChar_t* cmDevCfgLabel( cmDevCfgH_t h, cmTypeDcmId_t typeId, unsigned index )
|
const cmChar_t* cmDevCfgLabel( cmDevCfgH_t h, cmTypeDcmId_t typeId, unsigned index )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
if((cp = _cmDevCfgIndexToPtr(p,typeId,index,false)) == NULL )
|
if((cp = _cmDevCfgIndexToPtr(p,typeId,index,false)) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -428,7 +428,7 @@ cmDcmCfg_t* _cmDcmCfgLabelToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, const cmChar_
|
|||||||
for(; cp!= NULL; cp=cp->next)
|
for(; cp!= NULL; cp=cp->next)
|
||||||
if( cp->typeId == typeId )
|
if( cp->typeId == typeId )
|
||||||
{
|
{
|
||||||
if( strcmp(cp->dcLabelStr,label)==0 )
|
if( strcmp(cp->dcLabelStr,label) == 0 )
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,14 +440,14 @@ cmDcmCfg_t* _cmDcmCfgLabelToPtr( cmDcm_t* p, cmTypeDcmId_t typeId, const cmChar_
|
|||||||
|
|
||||||
unsigned cmDevCfgLabelToIndex( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar_t* label )
|
unsigned cmDevCfgLabelToIndex( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar_t* label )
|
||||||
{
|
{
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
assert( p->clp != NULL);
|
assert( p->clp != NULL);
|
||||||
const cmDcmCfg_t* cp = p->clp->cfg;
|
const cmDcmCfg_t* cp = p->clp->cfg;
|
||||||
for(; cp!= NULL; cp=cp->next)
|
for(; cp!= NULL; cp=cp->next)
|
||||||
if( cp->typeId == typeId )
|
if( cp->typeId == typeId )
|
||||||
{
|
{
|
||||||
if( strcmp(cp->dcLabelStr,label)==0 )
|
if( strcmp(cp->dcLabelStr,label) == 0 )
|
||||||
return n;
|
return n;
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
@ -479,14 +479,14 @@ cmDcmCfg_t* _cmDcmFindOrCreateCfg( cmDcm_t* p, cmTypeDcmId_t typeId, const cmCh
|
|||||||
{
|
{
|
||||||
if( cp->cfgId > newCfgId )
|
if( cp->cfgId > newCfgId )
|
||||||
newCfgId = cp->cfgId;
|
newCfgId = cp->cfgId;
|
||||||
ep = cp;
|
ep = cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add one to the max cfgId to create a unique cfgId
|
// add one to the max cfgId to create a unique cfgId
|
||||||
newCfgId += 1;
|
newCfgId += 1;
|
||||||
|
|
||||||
// allocate a new cfg recd
|
// allocate a new cfg recd
|
||||||
cp = cmMemAllocZ(cmDcmCfg_t,1);
|
cp = cmMemAllocZ(cmDcmCfg_t,1);
|
||||||
cp->dcLabelStr = cmMemAllocStr(dcLabelStr);
|
cp->dcLabelStr = cmMemAllocStr(dcLabelStr);
|
||||||
cp->cfgId = newCfgId;
|
cp->cfgId = newCfgId;
|
||||||
cp->typeId = typeId;
|
cp->typeId = typeId;
|
||||||
@ -514,7 +514,7 @@ cmDcRC_t cmDevCfgDeleteCfg( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar_t*
|
|||||||
{
|
{
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
unsigned i,j;
|
unsigned i,j;
|
||||||
|
|
||||||
// locate the cfg to delete
|
// locate the cfg to delete
|
||||||
if((cp = _cmDcmCfgLabelToPtr(p,typeId,dcLabelStr,true)) == NULL )
|
if((cp = _cmDcmCfgLabelToPtr(p,typeId,dcLabelStr,true)) == NULL )
|
||||||
@ -604,7 +604,7 @@ cmDcmMap_t* _cmDcmFindMap( cmDcm_t* p, cmTypeDcmId_t typeId, unsigned usrAppId,
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgDeleteMap( cmDevCfgH_t h, cmTypeDcmId_t typeId, unsigned usrAppId, unsigned usrMapId )
|
cmDcRC_t cmDevCfgDeleteMap( cmDevCfgH_t h, cmTypeDcmId_t typeId, unsigned usrAppId, unsigned usrMapId )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmMap_t* mp;
|
cmDcmMap_t* mp;
|
||||||
|
|
||||||
if((mp = _cmDcmFindMap(p,typeId,usrAppId,usrMapId,false)) == NULL )
|
if((mp = _cmDcmFindMap(p,typeId,usrAppId,usrMapId,false)) == NULL )
|
||||||
@ -646,6 +646,7 @@ cmDcRC_t cmDevCfgNameMidiPort(
|
|||||||
if((cp = _cmDcmFindOrCreateCfg(p,kMidiDcmTId, dcLabelStr)) == NULL )
|
if((cp = _cmDcmFindOrCreateCfg(p,kMidiDcmTId, dcLabelStr)) == NULL )
|
||||||
return cmErrLastRC(&p->err);
|
return cmErrLastRC(&p->err);
|
||||||
|
|
||||||
|
cp->u.m.label = cp->dcLabelStr;
|
||||||
cp->u.m.devLabelStr = cmMemResizeStr(cp->u.m.devLabelStr,devLabelStr);
|
cp->u.m.devLabelStr = cmMemResizeStr(cp->u.m.devLabelStr,devLabelStr);
|
||||||
cp->u.m.portLabelStr = cmMemResizeStr(cp->u.m.portLabelStr,portLabelStr);
|
cp->u.m.portLabelStr = cmMemResizeStr(cp->u.m.portLabelStr,portLabelStr);
|
||||||
cp->u.m.inputFl = inputFl;
|
cp->u.m.inputFl = inputFl;
|
||||||
@ -658,7 +659,7 @@ cmDcRC_t cmDevCfgNameMidiPort(
|
|||||||
|
|
||||||
const cmDcmMidi_t* cmDevCfgMidiCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
const cmDcmMidi_t* cmDevCfgMidiCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
|
|
||||||
if((cp = _cmDevCfgIndexToPtr(p, kMidiDcmTId, cfgIdx, true )) == NULL )
|
if((cp = _cmDevCfgIndexToPtr(p, kMidiDcmTId, cfgIdx, true )) == NULL )
|
||||||
@ -669,7 +670,7 @@ const cmDcmMidi_t* cmDevCfgMidiCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
|||||||
|
|
||||||
const cmDcmMidi_t* cmDevCfgMidiDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
const cmDcmMidi_t* cmDevCfgMidiDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmMap_t* mp;
|
cmDcmMap_t* mp;
|
||||||
|
|
||||||
if((mp =_cmDcmFindMap(p,kMidiDcmTId, usrAppId, usrMapId, true )) == NULL )
|
if((mp =_cmDcmFindMap(p,kMidiDcmTId, usrAppId, usrMapId, true )) == NULL )
|
||||||
@ -713,10 +714,10 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
|||||||
double srate,
|
double srate,
|
||||||
bool activeFl )
|
bool activeFl )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
unsigned inDevIdx = cmInvalidIdx;
|
unsigned inDevIdx = cmInvalidIdx;
|
||||||
unsigned outDevIdx = cmInvalidIdx;
|
unsigned outDevIdx = cmInvalidIdx;
|
||||||
|
|
||||||
// validate the label
|
// validate the label
|
||||||
if((dcLabelStr = _cmDcmTrimLabel(p,dcLabelStr,"Audio cfg")) == NULL)
|
if((dcLabelStr = _cmDcmTrimLabel(p,dcLabelStr,"Audio cfg")) == NULL)
|
||||||
@ -756,19 +757,20 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
|||||||
unsigned inChCnt = cmApDeviceChannelCount( inDevIdx, true );
|
unsigned inChCnt = cmApDeviceChannelCount( inDevIdx, true );
|
||||||
unsigned outChCnt = cmApDeviceChannelCount( outDevIdx, false );
|
unsigned outChCnt = cmApDeviceChannelCount( outDevIdx, false );
|
||||||
|
|
||||||
cp->u.a.inDevLabelStr = cmMemAllocStr(inDevNameStr==NULL?"":inDevNameStr);
|
cp->u.a.label = cp->dcLabelStr;
|
||||||
cp->u.a.outDevLabelStr = cmMemAllocStr(outDevNameStr==NULL?"":outDevNameStr);
|
cp->u.a.inDevLabelStr = cmMemAllocStr(inDevNameStr==NULL?"":inDevNameStr);
|
||||||
cp->u.a.activeFl = activeFl;
|
cp->u.a.outDevLabelStr = cmMemAllocStr(outDevNameStr==NULL?"":outDevNameStr);
|
||||||
cp->u.a.audioSysArgs.rpt = p->err.rpt;
|
cp->u.a.activeFl = activeFl;
|
||||||
cp->u.a.audioSysArgs.inDevIdx = inDevIdx;
|
cp->u.a.rtSysArgs.rpt = p->err.rpt;
|
||||||
cp->u.a.audioSysArgs.outDevIdx = outDevIdx;
|
cp->u.a.rtSysArgs.inDevIdx = inDevIdx;
|
||||||
cp->u.a.audioSysArgs.syncInputFl = syncInputFl;
|
cp->u.a.rtSysArgs.outDevIdx = outDevIdx;
|
||||||
cp->u.a.audioSysArgs.msgQueueByteCnt = msgQueueByteCnt;
|
cp->u.a.rtSysArgs.syncInputFl = syncInputFl;
|
||||||
cp->u.a.audioSysArgs.devFramesPerCycle = devFramesPerCycle;
|
cp->u.a.rtSysArgs.msgQueueByteCnt = msgQueueByteCnt;
|
||||||
cp->u.a.audioSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
cp->u.a.rtSysArgs.devFramesPerCycle = devFramesPerCycle;
|
||||||
cp->u.a.audioSysArgs.audioBufCnt = audioBufCnt;
|
cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
||||||
cp->u.a.audioSysArgs.srate = srate;
|
cp->u.a.rtSysArgs.audioBufCnt = audioBufCnt;
|
||||||
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);
|
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;
|
return kOkDcRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,7 +778,7 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgAudioSetDefaultCfgIndex( cmDevCfgH_t h, unsigned cfgIdx )
|
cmDcRC_t cmDevCfgAudioSetDefaultCfgIndex( cmDevCfgH_t h, unsigned cfgIdx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -803,7 +805,7 @@ cmDcRC_t cmDevCfgAudioSetDefaultCfgIndex( cmDevCfgH_t h, unsigned cfg
|
|||||||
|
|
||||||
unsigned cmDevCfgAudioGetDefaultCfgIndex( cmDevCfgH_t h )
|
unsigned cmDevCfgAudioGetDefaultCfgIndex( cmDevCfgH_t h )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -823,7 +825,7 @@ unsigned cmDevCfgAudioGetDefaultCfgIndex( cmDevCfgH_t h )
|
|||||||
|
|
||||||
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
|
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -851,7 +853,7 @@ bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bo
|
|||||||
|
|
||||||
unsigned cmDevCfgAudioActiveCount( cmDevCfgH_t h )
|
unsigned cmDevCfgAudioActiveCount( cmDevCfgH_t h )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -867,7 +869,7 @@ unsigned cmDevCfgAudioActiveCount( cmDevCfgH_t h )
|
|||||||
|
|
||||||
const cmChar_t* cmDevCfgAudioActiveLabel( cmDevCfgH_t h, unsigned idx )
|
const cmChar_t* cmDevCfgAudioActiveLabel( cmDevCfgH_t h, unsigned idx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -888,7 +890,7 @@ const cmChar_t* cmDevCfgAudioActiveLabel( cmDevCfgH_t h, unsigned idx )
|
|||||||
|
|
||||||
const cmDcmAudio_t* cmDevCfgAudioActiveCfg( cmDevCfgH_t h, unsigned idx )
|
const cmDcmAudio_t* cmDevCfgAudioActiveCfg( cmDevCfgH_t h, unsigned idx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
assert( p->clp != NULL );
|
||||||
|
|
||||||
@ -909,7 +911,7 @@ const cmDcmAudio_t* cmDevCfgAudioActiveCfg( cmDevCfgH_t h, unsigned idx )
|
|||||||
|
|
||||||
unsigned cmDevCfgAudioActiveIndex( cmDevCfgH_t h, const cmChar_t* cfgLabel )
|
unsigned cmDevCfgAudioActiveIndex( cmDevCfgH_t h, const cmChar_t* cfgLabel )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
|
|
||||||
if( cfgLabel == NULL )
|
if( cfgLabel == NULL )
|
||||||
return cmInvalidIdx;
|
return cmInvalidIdx;
|
||||||
@ -933,7 +935,7 @@ unsigned cmDevCfgAudioActiveIndex( cmDevCfgH_t h, const cmChar_t* cfgLabel )
|
|||||||
|
|
||||||
const cmDcmAudio_t* cmDevCfgAudioCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
const cmDcmAudio_t* cmDevCfgAudioCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
|
|
||||||
if((cp = _cmDevCfgIndexToPtr(p, kAudioDcmTId, cfgIdx, true )) == NULL )
|
if((cp = _cmDevCfgIndexToPtr(p, kAudioDcmTId, cfgIdx, true )) == NULL )
|
||||||
@ -944,7 +946,7 @@ const cmDcmAudio_t* cmDevCfgAudioCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
|||||||
|
|
||||||
const cmDcmAudio_t* cmDevCfgAudioDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
const cmDcmAudio_t* cmDevCfgAudioDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmMap_t* mp;
|
cmDcmMap_t* mp;
|
||||||
|
|
||||||
if((mp =_cmDcmFindMap(p,kAudioDcmTId, usrAppId, usrMapId, true )) == NULL )
|
if((mp =_cmDcmFindMap(p,kAudioDcmTId, usrAppId, usrMapId, true )) == NULL )
|
||||||
@ -955,7 +957,7 @@ const cmDcmAudio_t* cmDevCfgAudioDevMap( cmDevCfgH_t h, unsigned usrAppId, un
|
|||||||
|
|
||||||
|
|
||||||
cmDcRC_t cmDevCfgNameNetPort(
|
cmDcRC_t cmDevCfgNameNetPort(
|
||||||
cmDevCfgH_t h,
|
cmDevCfgH_t h,
|
||||||
const cmChar_t* dcLabelStr,
|
const cmChar_t* dcLabelStr,
|
||||||
const cmChar_t* sockAddr,
|
const cmChar_t* sockAddr,
|
||||||
unsigned portNumber,
|
unsigned portNumber,
|
||||||
@ -963,7 +965,7 @@ cmDcRC_t cmDevCfgNameNetPort(
|
|||||||
bool activeFl)
|
bool activeFl)
|
||||||
{
|
{
|
||||||
|
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
|
|
||||||
if( portNumber > 0xffff )
|
if( portNumber > 0xffff )
|
||||||
@ -978,11 +980,12 @@ cmDcRC_t cmDevCfgNameNetPort(
|
|||||||
if((cp = _cmDcmFindOrCreateCfg(p,kNetDcmTId, dcLabelStr)) == NULL )
|
if((cp = _cmDcmFindOrCreateCfg(p,kNetDcmTId, dcLabelStr)) == NULL )
|
||||||
return cmErrLastRC(&p->err);
|
return cmErrLastRC(&p->err);
|
||||||
|
|
||||||
|
cp->u.n.label = cp->dcLabelStr;
|
||||||
cp->u.n.sockAddr = cmMemAllocStr(sockAddr);
|
cp->u.n.sockAddr = cmMemAllocStr(sockAddr);
|
||||||
cp->u.n.portNumber = portNumber;
|
cp->u.n.portNumber = portNumber;
|
||||||
cp->u.n.localFl = localFl;
|
cp->u.n.localFl = localFl;
|
||||||
cp->u.n.activeFl = activeFl;
|
cp->u.n.activeFl = activeFl;
|
||||||
cp->descStr = cmTsPrintfP(cp->descStr,"%s %s %s:%i",activeFl?"":"INACTIVE",localFl?"local":"remote",sockAddr,portNumber);
|
cp->descStr = cmTsPrintfP(cp->descStr,"%s %s %s:%i",activeFl?"":"INACTIVE",localFl?"local":"remote",sockAddr,portNumber);
|
||||||
|
|
||||||
|
|
||||||
return kOkDcRC;
|
return kOkDcRC;
|
||||||
@ -1028,7 +1031,7 @@ const cmDcmNet_t* cmDevCfgNetActiveCfg( cmDevCfgH_t h, unsigned idx )
|
|||||||
|
|
||||||
const cmDcmNet_t* cmDevCfgNetCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
const cmDcmNet_t* cmDevCfgNetCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmCfg_t* cp;
|
cmDcmCfg_t* cp;
|
||||||
|
|
||||||
if((cp = _cmDevCfgIndexToPtr(p, kNetDcmTId, cfgIdx, true )) == NULL )
|
if((cp = _cmDevCfgIndexToPtr(p, kNetDcmTId, cfgIdx, true )) == NULL )
|
||||||
@ -1039,7 +1042,7 @@ const cmDcmNet_t* cmDevCfgNetCfg( cmDevCfgH_t h, unsigned cfgIdx )
|
|||||||
|
|
||||||
const cmDcmNet_t* cmDevCfgNetDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
const cmDcmNet_t* cmDevCfgNetDevMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmMap_t* mp;
|
cmDcmMap_t* mp;
|
||||||
|
|
||||||
if((mp =_cmDcmFindMap(p,kNetDcmTId, usrAppId, usrMapId, true )) == NULL )
|
if((mp =_cmDcmFindMap(p,kNetDcmTId, usrAppId, usrMapId, true )) == NULL )
|
||||||
@ -1050,8 +1053,8 @@ const cmDcmNet_t* cmDevCfgNetDevMap( cmDevCfgH_t h, unsigned usrAppId, unsign
|
|||||||
|
|
||||||
unsigned cmDevCfgLocCount( cmDevCfgH_t h )
|
unsigned cmDevCfgLocCount( cmDevCfgH_t h )
|
||||||
{
|
{
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
const cmDcmLoc_t* lp = p->loc;
|
const cmDcmLoc_t* lp = p->loc;
|
||||||
for(; lp!=NULL; lp=lp->next)
|
for(; lp!=NULL; lp=lp->next)
|
||||||
++n;
|
++n;
|
||||||
@ -1059,9 +1062,9 @@ unsigned cmDevCfgLocCount( cmDevCfgH_t h )
|
|||||||
}
|
}
|
||||||
const cmChar_t* cmDevCfgLocLabel( cmDevCfgH_t h, unsigned locIdx )
|
const cmChar_t* cmDevCfgLocLabel( cmDevCfgH_t h, unsigned locIdx )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
const cmDcmLoc_t* lp = p->loc;
|
const cmDcmLoc_t* lp = p->loc;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for(i=0; lp!=NULL; lp=lp->next,++i)
|
for(i=0; lp!=NULL; lp=lp->next,++i)
|
||||||
if( i == locIdx )
|
if( i == locIdx )
|
||||||
return lp->labelStr;
|
return lp->labelStr;
|
||||||
@ -1076,7 +1079,7 @@ cmDcmLoc_t* _cmDcmLocLabelToPtr( cmDcm_t* p, const cmChar_t* locLabelStr, bool e
|
|||||||
if((locLabelStr = _cmDcmTrimLabel(p,locLabelStr,"location")) == NULL )
|
if((locLabelStr = _cmDcmTrimLabel(p,locLabelStr,"location")) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cmDcmLoc_t* lp = p->loc;
|
cmDcmLoc_t* lp = p->loc;
|
||||||
for(; lp!=NULL; lp=lp->next)
|
for(; lp!=NULL; lp=lp->next)
|
||||||
if( strcmp(lp->labelStr,locLabelStr) == 0 )
|
if( strcmp(lp->labelStr,locLabelStr) == 0 )
|
||||||
return lp;
|
return lp;
|
||||||
@ -1090,8 +1093,8 @@ cmDcmLoc_t* _cmDcmLocLabelToPtr( cmDcm_t* p, const cmChar_t* locLabelStr, bool e
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgLocStore( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
cmDcRC_t cmDevCfgLocStore( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
||||||
{
|
{
|
||||||
cmDcRC_t rc = kOkDcRC;
|
cmDcRC_t rc = kOkDcRC;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
unsigned i,j;
|
unsigned i,j;
|
||||||
|
|
||||||
// if this location label is already in use then it has already been stored.
|
// if this location label is already in use then it has already been stored.
|
||||||
@ -1143,9 +1146,9 @@ cmDcRC_t cmDevCfgLocStore( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
|||||||
cmDcmApp_t* oap = olp->app + i;
|
cmDcmApp_t* oap = olp->app + i;
|
||||||
|
|
||||||
//nap->usrAppId = oap->usrAppId;
|
//nap->usrAppId = oap->usrAppId;
|
||||||
nap->activeFl = oap->activeFl;
|
nap->activeFl = oap->activeFl;
|
||||||
nap->mapCnt = oap->mapCnt;
|
nap->mapCnt = oap->mapCnt;
|
||||||
nap->map = cmMemAllocZ(cmDcmMap_t,nap->mapCnt);
|
nap->map = cmMemAllocZ(cmDcmMap_t,nap->mapCnt);
|
||||||
|
|
||||||
for(j=0; j<nap->mapCnt; ++j)
|
for(j=0; j<nap->mapCnt; ++j)
|
||||||
{
|
{
|
||||||
@ -1156,7 +1159,7 @@ cmDcRC_t cmDevCfgLocStore( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
|||||||
nmp->cfgId = omp->cfgId;
|
nmp->cfgId = omp->cfgId;
|
||||||
|
|
||||||
if( omp->tid != kInvalidDcmTId && omp->cfg->dcLabelStr != NULL )
|
if( omp->tid != kInvalidDcmTId && omp->cfg->dcLabelStr != NULL )
|
||||||
nmp->cfg = _cmDcmCfgLabelToPtr(p,nmp->tid,omp->cfg->dcLabelStr,true);
|
nmp->cfg = _cmDcmCfgLabelToPtr(p,nmp->tid,omp->cfg->dcLabelStr,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,7 +1173,7 @@ cmDcRC_t cmDevCfgLocStore( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
|||||||
|
|
||||||
cmDcRC_t cmDevCfgLocRecall( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
cmDcRC_t cmDevCfgLocRecall( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmLoc_t* lp;
|
cmDcmLoc_t* lp;
|
||||||
|
|
||||||
if((lp = _cmDcmLocLabelToPtr(p,locLabelStr,true)) == NULL)
|
if((lp = _cmDcmLocLabelToPtr(p,locLabelStr,true)) == NULL)
|
||||||
@ -1182,7 +1185,7 @@ cmDcRC_t cmDevCfgLocRecall( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
|||||||
}
|
}
|
||||||
cmDcRC_t cmDevCfgLocDelete( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
cmDcRC_t cmDevCfgLocDelete( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmLoc_t* lp;
|
cmDcmLoc_t* lp;
|
||||||
|
|
||||||
if((lp = _cmDcmLocLabelToPtr(p,locLabelStr,true)) == NULL )
|
if((lp = _cmDcmLocLabelToPtr(p,locLabelStr,true)) == NULL )
|
||||||
@ -1195,8 +1198,8 @@ cmDcRC_t cmDevCfgLocDelete( cmDevCfgH_t h, const cmChar_t* locLabelStr )
|
|||||||
|
|
||||||
unsigned cmDevCfgLocCurIndex( cmDevCfgH_t h )
|
unsigned cmDevCfgLocCurIndex( cmDevCfgH_t h )
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
cmDcmLoc_t* lp = p->loc;
|
cmDcmLoc_t* lp = p->loc;
|
||||||
for(i=0; lp!=NULL; lp=lp->next,++i)
|
for(i=0; lp!=NULL; lp=lp->next,++i)
|
||||||
if( lp == p->clp )
|
if( lp == p->clp )
|
||||||
@ -1216,10 +1219,10 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
{
|
{
|
||||||
cmDcRC_t rc = kOkDcRC;
|
cmDcRC_t rc = kOkDcRC;
|
||||||
const cmChar_t* errLabelPtr = NULL;
|
const cmChar_t* errLabelPtr = NULL;
|
||||||
cmJsonNode_t* cfgNp, *locArrNp;
|
cmJsonNode_t* cfgNp, *locArrNp;
|
||||||
unsigned i,j;
|
unsigned i,j;
|
||||||
cmDevCfgH_t h;
|
cmDevCfgH_t h;
|
||||||
h.h = p;
|
h.h = p;
|
||||||
|
|
||||||
// clear the all locations
|
// clear the all locations
|
||||||
_cmDcmFreeAllLocs(p);
|
_cmDcmFreeAllLocs(p);
|
||||||
@ -1234,7 +1237,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
// for each loc object
|
// for each loc object
|
||||||
for(i=0; i<cmJsonChildCount(locArrNp); ++i)
|
for(i=0; i<cmJsonChildCount(locArrNp); ++i)
|
||||||
{
|
{
|
||||||
cmJsonNode_t* locObjNp, *cfgArrNp;
|
cmJsonNode_t* locObjNp, *cfgArrNp;
|
||||||
const cmChar_t* locLabelStr = NULL;
|
const cmChar_t* locLabelStr = NULL;
|
||||||
|
|
||||||
// get the loc object
|
// get the loc object
|
||||||
@ -1249,7 +1252,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
{ return _cmDcmJsonNotFound(p,errLabelPtr); }
|
{ return _cmDcmJsonNotFound(p,errLabelPtr); }
|
||||||
|
|
||||||
// create a new location recd
|
// create a new location recd
|
||||||
cmDcmLoc_t* locPtr = NULL;
|
cmDcmLoc_t* locPtr = NULL;
|
||||||
if((rc = _cmDcmNewLoc(p,locLabelStr,&locPtr)) != kOkDcRC )
|
if((rc = _cmDcmNewLoc(p,locLabelStr,&locPtr)) != kOkDcRC )
|
||||||
return cmErrMsg(&p->err,kJsonFailDcRC,"Location '%s' create failed.",cmStringNullGuard(locLabelStr));
|
return cmErrMsg(&p->err,kJsonFailDcRC,"Location '%s' create failed.",cmStringNullGuard(locLabelStr));
|
||||||
|
|
||||||
@ -1274,7 +1277,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
unsigned tid,cfgId;
|
unsigned tid,cfgId;
|
||||||
cmJsonNode_t* mapObjNp;
|
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");
|
return _cmDcmJsonSyntaxErr(p,"cfg object");
|
||||||
|
|
||||||
if( cmJsonMemberValues( mapObjNp, &errLabelPtr,
|
if( cmJsonMemberValues( mapObjNp, &errLabelPtr,
|
||||||
@ -1289,12 +1292,12 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
// read each cfg object
|
// read each cfg object
|
||||||
for(j=0; j<cmJsonChildCount(cfgArrNp); ++j)
|
for(j=0; j<cmJsonChildCount(cfgArrNp); ++j)
|
||||||
{
|
{
|
||||||
cmJsonNode_t* cfgObjNp;
|
cmJsonNode_t* cfgObjNp;
|
||||||
const cmChar_t* dcLabelStr;
|
const cmChar_t* dcLabelStr;
|
||||||
const cmChar_t* descStr;
|
const cmChar_t* descStr;
|
||||||
unsigned cfgId, typeId;
|
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");
|
return _cmDcmJsonSyntaxErr(p,"cfg object");
|
||||||
|
|
||||||
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
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,
|
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
||||||
"inDevLabelStr", kStringTId, &a.inDevLabelStr,
|
"inDevLabelStr", kStringTId, &a.inDevLabelStr,
|
||||||
"outDevLabelStr", kStringTId, &a.outDevLabelStr,
|
"outDevLabelStr", kStringTId, &a.outDevLabelStr,
|
||||||
"syncInputFl", kBoolTId, &a.audioSysArgs.syncInputFl,
|
"syncInputFl", kBoolTId, &a.rtSysArgs.syncInputFl,
|
||||||
"msgQueueByteCnt", kIntTId, &a.audioSysArgs.msgQueueByteCnt,
|
"msgQueueByteCnt", kIntTId, &a.rtSysArgs.msgQueueByteCnt,
|
||||||
"devFramesPerCycle", kIntTId, &a.audioSysArgs.devFramesPerCycle,
|
"devFramesPerCycle", kIntTId, &a.rtSysArgs.devFramesPerCycle,
|
||||||
"dspFramesPerCycle", kIntTId, &a.audioSysArgs.dspFramesPerCycle,
|
"dspFramesPerCycle", kIntTId, &a.rtSysArgs.dspFramesPerCycle,
|
||||||
"audioBufCnt", kIntTId, &a.audioSysArgs.audioBufCnt,
|
"audioBufCnt", kIntTId, &a.rtSysArgs.audioBufCnt,
|
||||||
"srate", kRealTId, &a.audioSysArgs.srate,
|
"srate", kRealTId, &a.rtSysArgs.srate,
|
||||||
"active", kBoolTId, &a.activeFl,
|
"active", kBoolTId, &a.activeFl,
|
||||||
NULL ) != kOkJsRC )
|
NULL ) != kOkJsRC )
|
||||||
{
|
{
|
||||||
@ -1344,13 +1347,13 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((rc = cmDevCfgNameAudioPort(h,dcLabelStr,a.inDevLabelStr,a.outDevLabelStr,
|
if((rc = cmDevCfgNameAudioPort(h,dcLabelStr,a.inDevLabelStr,a.outDevLabelStr,
|
||||||
a.audioSysArgs.syncInputFl,
|
a.rtSysArgs.syncInputFl,
|
||||||
a.audioSysArgs.msgQueueByteCnt,
|
a.rtSysArgs.msgQueueByteCnt,
|
||||||
a.audioSysArgs.devFramesPerCycle,
|
a.rtSysArgs.devFramesPerCycle,
|
||||||
a.audioSysArgs.dspFramesPerCycle,
|
a.rtSysArgs.dspFramesPerCycle,
|
||||||
a.audioSysArgs.audioBufCnt,
|
a.rtSysArgs.audioBufCnt,
|
||||||
a.audioSysArgs.srate,
|
a.rtSysArgs.srate,
|
||||||
a.activeFl)) != kOkDcRC )
|
a.activeFl)) != kOkDcRC )
|
||||||
{
|
{
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -1388,7 +1391,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
|
|
||||||
cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
||||||
{
|
{
|
||||||
cmDcRC_t rc = kOkDcRC;
|
cmDcRC_t rc = kOkDcRC;
|
||||||
const cmDcmLoc_t* lp = p->loc;
|
const cmDcmLoc_t* lp = p->loc;
|
||||||
|
|
||||||
cmJsonNode_t* cfgNp = cmJsonInsertPairObject(jsH, rootObjPtr, "cfg" );
|
cmJsonNode_t* cfgNp = cmJsonInsertPairObject(jsH, rootObjPtr, "cfg" );
|
||||||
@ -1463,12 +1466,12 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
|||||||
cmJsonInsertPairs(jsH, cfgObjNp,
|
cmJsonInsertPairs(jsH, cfgObjNp,
|
||||||
"inDevLabelStr", kStringTId, cp->u.a.inDevLabelStr,
|
"inDevLabelStr", kStringTId, cp->u.a.inDevLabelStr,
|
||||||
"outDevLabelStr", kStringTId, cp->u.a.outDevLabelStr,
|
"outDevLabelStr", kStringTId, cp->u.a.outDevLabelStr,
|
||||||
"syncInputFl", kBoolTId, cp->u.a.audioSysArgs.syncInputFl,
|
"syncInputFl", kBoolTId, cp->u.a.rtSysArgs.syncInputFl,
|
||||||
"msgQueueByteCnt", kIntTId, cp->u.a.audioSysArgs.msgQueueByteCnt,
|
"msgQueueByteCnt", kIntTId, cp->u.a.rtSysArgs.msgQueueByteCnt,
|
||||||
"devFramesPerCycle", kIntTId, cp->u.a.audioSysArgs.devFramesPerCycle,
|
"devFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.devFramesPerCycle,
|
||||||
"dspFramesPerCycle", kIntTId, cp->u.a.audioSysArgs.dspFramesPerCycle,
|
"dspFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.dspFramesPerCycle,
|
||||||
"audioBufCnt", kIntTId, cp->u.a.audioSysArgs.audioBufCnt,
|
"audioBufCnt", kIntTId, cp->u.a.rtSysArgs.audioBufCnt,
|
||||||
"srate", kRealTId, cp->u.a.audioSysArgs.srate,
|
"srate", kRealTId, cp->u.a.rtSysArgs.srate,
|
||||||
"active", kBoolTId, cp->u.a.activeFl,
|
"active", kBoolTId, cp->u.a.activeFl,
|
||||||
NULL );
|
NULL );
|
||||||
break;
|
break;
|
||||||
|
13
cmDevCfg.h
13
cmDevCfg.h
@ -67,6 +67,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
const cmChar_t* label; // cfg label
|
||||||
cmChar_t* devLabelStr; // Midi device label.
|
cmChar_t* devLabelStr; // Midi device label.
|
||||||
cmChar_t* portLabelStr; // Midi device port label.
|
cmChar_t* portLabelStr; // Midi device port label.
|
||||||
bool inputFl; // 'True' if this is an input port.
|
bool inputFl; // 'True' if this is an input port.
|
||||||
@ -76,19 +77,21 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
const cmChar_t* label; // cfg label
|
||||||
cmChar_t* inDevLabelStr; // Input audio device label.
|
cmChar_t* inDevLabelStr; // Input audio device label.
|
||||||
cmChar_t* outDevLabelStr; // Output 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 dfltFl; // true if this is the default audio cfg.
|
||||||
bool activeFl;
|
bool activeFl;
|
||||||
} cmDcmAudio_t;
|
} cmDcmAudio_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
cmChar_t* sockAddr; // socket address.
|
const cmChar_t* label; // cfg label
|
||||||
unsigned portNumber; // socket port number
|
cmChar_t* sockAddr; // socket address.
|
||||||
bool localFl; // this is the local port
|
unsigned portNumber; // socket port number
|
||||||
bool activeFl; // this port is active/inactive
|
bool localFl; // this is the local port
|
||||||
|
bool activeFl; // this port is active/inactive
|
||||||
} cmDcmNet_t;
|
} cmDcmNet_t;
|
||||||
|
|
||||||
extern cmDevCfgH_t cmDevCfgNullHandle;
|
extern cmDevCfgH_t cmDevCfgNullHandle;
|
||||||
|
Loading…
Reference in New Issue
Block a user