cmDevCfg.h/c: Added ipAddr,ipPort to audio cfg. Removed localFl from net cfg.
This commit is contained in:
parent
6074e052f0
commit
4afc25d682
67
cmDevCfg.c
67
cmDevCfg.c
@ -14,8 +14,8 @@
|
|||||||
#include "cmMidiPort.h"
|
#include "cmMidiPort.h"
|
||||||
#include "cmAudioPort.h"
|
#include "cmAudioPort.h"
|
||||||
#include "cmUdpPort.h"
|
#include "cmUdpPort.h"
|
||||||
#include "cmUdpNet.h"
|
|
||||||
#include "cmRtSysMsg.h"
|
#include "cmRtSysMsg.h"
|
||||||
|
#include "cmRtNet.h"
|
||||||
#include "cmRtSys.h"
|
#include "cmRtSys.h"
|
||||||
|
|
||||||
#include "cmDevCfg.h"
|
#include "cmDevCfg.h"
|
||||||
@ -146,7 +146,6 @@ void _cmDcmDuplNet( cmDcmNet_t* d, const cmDcmNet_t* s )
|
|||||||
{
|
{
|
||||||
d->sockAddr = cmMemAllocStr(s->sockAddr);
|
d->sockAddr = cmMemAllocStr(s->sockAddr);
|
||||||
d->portNumber = s->portNumber;
|
d->portNumber = s->portNumber;
|
||||||
d->localFl = s->localFl;
|
|
||||||
d->activeFl = s->activeFl;
|
d->activeFl = s->activeFl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,6 +711,8 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
|||||||
unsigned dspFramesPerCycle,
|
unsigned dspFramesPerCycle,
|
||||||
unsigned audioBufCnt,
|
unsigned audioBufCnt,
|
||||||
double srate,
|
double srate,
|
||||||
|
const cmChar_t* ipAddr,
|
||||||
|
cmUdpPort_t ipPort,
|
||||||
bool activeFl )
|
bool activeFl )
|
||||||
{
|
{
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
||||||
@ -770,58 +771,14 @@ cmDcRC_t cmDevCfgNameAudioPort(
|
|||||||
cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
|
||||||
cp->u.a.rtSysArgs.audioBufCnt = audioBufCnt;
|
cp->u.a.rtSysArgs.audioBufCnt = audioBufCnt;
|
||||||
cp->u.a.rtSysArgs.srate = srate;
|
cp->u.a.rtSysArgs.srate = srate;
|
||||||
|
cp->u.a.ipAddr = ipAddr;
|
||||||
|
cp->u.a.ipPort = ipPort;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cmDcRC_t cmDevCfgAudioSetDefaultCfgIndex( cmDevCfgH_t h, unsigned cfgIdx )
|
|
||||||
{
|
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
|
||||||
|
|
||||||
cmDcmCfg_t* cp = p->clp->cfg;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
for(i=0; cp!=NULL; cp=cp->next)
|
|
||||||
if( cp->typeId == kAudioDcmTId )
|
|
||||||
{
|
|
||||||
if( i == cfgIdx )
|
|
||||||
cp->u.a.dfltFl = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( cp->u.a.dfltFl )
|
|
||||||
cp->u.a.dfltFl = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return kOkDcRC;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned cmDevCfgAudioGetDefaultCfgIndex( cmDevCfgH_t h )
|
|
||||||
{
|
|
||||||
cmDcm_t* p = _cmDcmHandleToPtr(h);
|
|
||||||
|
|
||||||
assert( p->clp != NULL );
|
|
||||||
|
|
||||||
cmDcmCfg_t* cp = p->clp->cfg;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
for(i=0; cp!=NULL; cp=cp->next)
|
|
||||||
if( cp->typeId == kAudioDcmTId )
|
|
||||||
{
|
|
||||||
if( cp->u.a.dfltFl )
|
|
||||||
return i;
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return cmInvalidIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
|
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
|
||||||
{
|
{
|
||||||
@ -961,7 +918,6 @@ cmDcRC_t cmDevCfgNameNetPort(
|
|||||||
const cmChar_t* dcLabelStr,
|
const cmChar_t* dcLabelStr,
|
||||||
const cmChar_t* sockAddr,
|
const cmChar_t* sockAddr,
|
||||||
unsigned portNumber,
|
unsigned portNumber,
|
||||||
bool localFl,
|
|
||||||
bool activeFl)
|
bool activeFl)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -983,9 +939,8 @@ cmDcRC_t cmDevCfgNameNetPort(
|
|||||||
cp->u.n.label = cp->dcLabelStr;
|
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.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:%i",activeFl?"":"INACTIVE",sockAddr,portNumber);
|
||||||
|
|
||||||
|
|
||||||
return kOkDcRC;
|
return kOkDcRC;
|
||||||
@ -1340,6 +1295,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
"dspFramesPerCycle", kIntTId, &a.rtSysArgs.dspFramesPerCycle,
|
"dspFramesPerCycle", kIntTId, &a.rtSysArgs.dspFramesPerCycle,
|
||||||
"audioBufCnt", kIntTId, &a.rtSysArgs.audioBufCnt,
|
"audioBufCnt", kIntTId, &a.rtSysArgs.audioBufCnt,
|
||||||
"srate", kRealTId, &a.rtSysArgs.srate,
|
"srate", kRealTId, &a.rtSysArgs.srate,
|
||||||
|
"ipAddr", kStringTId, &a.ipAddr,
|
||||||
|
"ipPort", kIntTId, &a.ipPort,
|
||||||
"active", kBoolTId, &a.activeFl,
|
"active", kBoolTId, &a.activeFl,
|
||||||
NULL ) != kOkJsRC )
|
NULL ) != kOkJsRC )
|
||||||
{
|
{
|
||||||
@ -1354,6 +1311,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
a.rtSysArgs.dspFramesPerCycle,
|
a.rtSysArgs.dspFramesPerCycle,
|
||||||
a.rtSysArgs.audioBufCnt,
|
a.rtSysArgs.audioBufCnt,
|
||||||
a.rtSysArgs.srate,
|
a.rtSysArgs.srate,
|
||||||
|
a.ipAddr,
|
||||||
|
a.ipPort,
|
||||||
a.activeFl)) != kOkDcRC )
|
a.activeFl)) != kOkDcRC )
|
||||||
{
|
{
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -1365,7 +1324,6 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
|
||||||
"sockAddr", kStringTId, &n.sockAddr,
|
"sockAddr", kStringTId, &n.sockAddr,
|
||||||
"portNumber", kIntTId, &n.portNumber,
|
"portNumber", kIntTId, &n.portNumber,
|
||||||
"localFl", kBoolTId, &n.localFl,
|
|
||||||
"activeFl", kBoolTId, &n.activeFl,
|
"activeFl", kBoolTId, &n.activeFl,
|
||||||
NULL ) != kOkJsRC )
|
NULL ) != kOkJsRC )
|
||||||
{
|
{
|
||||||
@ -1373,7 +1331,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((rc = cmDevCfgNameNetPort(h,dcLabelStr,n.sockAddr,n.portNumber,n.localFl,n.activeFl)) != kOkDcRC )
|
if((rc = cmDevCfgNameNetPort(h,dcLabelStr,n.sockAddr,n.portNumber,n.activeFl)) != kOkDcRC )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1472,6 +1430,8 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
|||||||
"dspFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.dspFramesPerCycle,
|
"dspFramesPerCycle", kIntTId, cp->u.a.rtSysArgs.dspFramesPerCycle,
|
||||||
"audioBufCnt", kIntTId, cp->u.a.rtSysArgs.audioBufCnt,
|
"audioBufCnt", kIntTId, cp->u.a.rtSysArgs.audioBufCnt,
|
||||||
"srate", kRealTId, cp->u.a.rtSysArgs.srate,
|
"srate", kRealTId, cp->u.a.rtSysArgs.srate,
|
||||||
|
"ipAddr", kStringTId, cp->u.a.ipAddr,
|
||||||
|
"ipPort", kIntTId, cp->u.a.ipPort,
|
||||||
"active", kBoolTId, cp->u.a.activeFl,
|
"active", kBoolTId, cp->u.a.activeFl,
|
||||||
NULL );
|
NULL );
|
||||||
break;
|
break;
|
||||||
@ -1480,7 +1440,6 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
|
|||||||
cmJsonInsertPairs(jsH, cfgObjNp,
|
cmJsonInsertPairs(jsH, cfgObjNp,
|
||||||
"sockAddr", kStringTId, cp->u.n.sockAddr,
|
"sockAddr", kStringTId, cp->u.n.sockAddr,
|
||||||
"portNumber",kIntTId, cp->u.n.portNumber,
|
"portNumber",kIntTId, cp->u.n.portNumber,
|
||||||
"localFl", kBoolTId, cp->u.n.localFl,
|
|
||||||
"activeFl", kBoolTId, cp->u.n.activeFl,
|
"activeFl", kBoolTId, cp->u.n.activeFl,
|
||||||
NULL );
|
NULL );
|
||||||
break;
|
break;
|
||||||
|
@ -81,7 +81,8 @@ extern "C" {
|
|||||||
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 rtSysArgs; // RT system cfg recd
|
cmRtSysArgs_t rtSysArgs; // RT system cfg recd
|
||||||
bool dfltFl; // true if this is the default audio cfg.
|
const cmChar_t* ipAddr; // local network addr or NULL for localhost
|
||||||
|
cmUdpPort_t ipPort; // local network port
|
||||||
bool activeFl;
|
bool activeFl;
|
||||||
} cmDcmAudio_t;
|
} cmDcmAudio_t;
|
||||||
|
|
||||||
@ -90,7 +91,6 @@ extern "C" {
|
|||||||
const cmChar_t* label; // cfg label
|
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 activeFl; // this port is active/inactive
|
bool activeFl; // this port is active/inactive
|
||||||
} cmDcmNet_t;
|
} cmDcmNet_t;
|
||||||
|
|
||||||
@ -148,6 +148,8 @@ extern "C" {
|
|||||||
unsigned dspFramesPerCycle,
|
unsigned dspFramesPerCycle,
|
||||||
unsigned audioBufCnt,
|
unsigned audioBufCnt,
|
||||||
double srate,
|
double srate,
|
||||||
|
const cmChar_t* ipAddr,
|
||||||
|
cmUdpPort_t ipPort,
|
||||||
bool activeFl );
|
bool activeFl );
|
||||||
|
|
||||||
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl );
|
bool cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl );
|
||||||
@ -167,7 +169,6 @@ extern "C" {
|
|||||||
const cmChar_t* dcLabelStr,
|
const cmChar_t* dcLabelStr,
|
||||||
const cmChar_t* sockAddr,
|
const cmChar_t* sockAddr,
|
||||||
unsigned portNumber,
|
unsigned portNumber,
|
||||||
bool localFl,
|
|
||||||
bool activeFl);
|
bool activeFl);
|
||||||
|
|
||||||
unsigned cmDevCfgNetActiveCount( cmDevCfgH_t h );
|
unsigned cmDevCfgNetActiveCount( cmDevCfgH_t h );
|
||||||
|
Loading…
Reference in New Issue
Block a user