cmDevCfg.h/c:Added label to domain specific cfg records.

This commit is contained in:
kevin 2013-04-10 00:33:24 -07:00
parent 1194710744
commit 1be236f8d2
2 changed files with 125 additions and 119 deletions

View File

@ -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 )
@ -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;
@ -756,18 +757,19 @@ 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.label = cp->dcLabelStr;
cp->u.a.inDevLabelStr = cmMemAllocStr(inDevNameStr==NULL?"":inDevNameStr); cp->u.a.inDevLabelStr = cmMemAllocStr(inDevNameStr==NULL?"":inDevNameStr);
cp->u.a.outDevLabelStr = cmMemAllocStr(outDevNameStr==NULL?"":outDevNameStr); cp->u.a.outDevLabelStr = cmMemAllocStr(outDevNameStr==NULL?"":outDevNameStr);
cp->u.a.activeFl = activeFl; cp->u.a.activeFl = activeFl;
cp->u.a.audioSysArgs.rpt = p->err.rpt; cp->u.a.rtSysArgs.rpt = p->err.rpt;
cp->u.a.audioSysArgs.inDevIdx = inDevIdx; cp->u.a.rtSysArgs.inDevIdx = inDevIdx;
cp->u.a.audioSysArgs.outDevIdx = outDevIdx; cp->u.a.rtSysArgs.outDevIdx = outDevIdx;
cp->u.a.audioSysArgs.syncInputFl = syncInputFl; cp->u.a.rtSysArgs.syncInputFl = syncInputFl;
cp->u.a.audioSysArgs.msgQueueByteCnt = msgQueueByteCnt; cp->u.a.rtSysArgs.msgQueueByteCnt = msgQueueByteCnt;
cp->u.a.audioSysArgs.devFramesPerCycle = devFramesPerCycle; cp->u.a.rtSysArgs.devFramesPerCycle = devFramesPerCycle;
cp->u.a.audioSysArgs.dspFramesPerCycle = dspFramesPerCycle; cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
cp->u.a.audioSysArgs.audioBufCnt = audioBufCnt; cp->u.a.rtSysArgs.audioBufCnt = audioBufCnt;
cp->u.a.audioSysArgs.srate = srate; 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); 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;
} }
@ -978,6 +980,7 @@ 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;
@ -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 )
{ {
@ -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, 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;
@ -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;

View File

@ -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,15 +77,17 @@ 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
{ {
const cmChar_t* label; // cfg label
cmChar_t* sockAddr; // socket address. cmChar_t* sockAddr; // socket address.
unsigned portNumber; // socket port number unsigned portNumber; // socket port number
bool localFl; // this is the local port bool localFl; // this is the local port