Explorar el Código

cmDevCfg.h/c:Removed net cfg and added broadcast address and node label to audio cfg.

master
kevin hace 11 años
padre
commit
3838d0d888
Se han modificado 2 ficheros con 35 adiciones y 12 borrados
  1. 26
    10
      cmDevCfg.c
  2. 9
    2
      cmDevCfg.h

+ 26
- 10
cmDevCfg.c Ver fichero

@@ -37,7 +37,7 @@ typedef struct cmDcmCfg_str
37 37
   {
38 38
     cmDcmMidi_t  m;
39 39
     cmDcmAudio_t a;
40
-    cmDcmNet_t   n;
40
+    //cmDcmNet_t   n;
41 41
   } u;
42 42
 
43 43
   struct cmDcmCfg_str* next;
@@ -128,6 +128,9 @@ void _cmDcmFreeAudio( cmDcmAudio_t* r )
128 128
 {
129 129
   cmMemFree(r->inDevLabelStr);
130 130
   cmMemFree(r->outDevLabelStr);
131
+  cmMemFree((cmChar_t*)r->netNodeLabel);
132
+  cmMemFree((cmChar_t*)r->bcastAddr);
133
+  cmMemFree((cmChar_t*)r->ipAddr);
131 134
 }
132 135
 
133 136
 void _cmDcmDuplAudio( cmDcmAudio_t* d, const cmDcmAudio_t* s )
@@ -136,7 +139,7 @@ void _cmDcmDuplAudio( cmDcmAudio_t* d, const cmDcmAudio_t* s )
136 139
   d->outDevLabelStr = cmMemAllocStr(s->outDevLabelStr);
137 140
   d->rtSysArgs      = s->rtSysArgs;
138 141
 }
139
-
142
+/*
140 143
 void _cmDcmFreeNet( cmDcmNet_t* r )
141 144
 {
142 145
   cmMemFree(r->sockAddr);
@@ -148,7 +151,7 @@ void _cmDcmDuplNet( cmDcmNet_t* d, const cmDcmNet_t* s )
148 151
   d->portNumber = s->portNumber;
149 152
   d->activeFl   = s->activeFl;
150 153
 }
151
-
154
+*/
152 155
 
153 156
 void _cmDcmFreeCfg( cmDcm_t* p, cmDcmLoc_t* lp, cmDcmCfg_t* cp )
154 157
 {
@@ -168,7 +171,7 @@ void _cmDcmFreeCfg( cmDcm_t* p, cmDcmLoc_t* lp, cmDcmCfg_t* cp )
168 171
   {
169 172
     case kMidiDcmTId:  _cmDcmFreeMidi(&cp->u.m); break;
170 173
     case kAudioDcmTId: _cmDcmFreeAudio(&cp->u.a); break;
171
-    case kNetDcmTId:   _cmDcmFreeNet(&cp->u.n); break;
174
+      //case kNetDcmTId:   _cmDcmFreeNet(&cp->u.n); break;
172 175
     default:
173 176
       assert(0);
174 177
       break;
@@ -711,6 +714,8 @@ cmDcRC_t cmDevCfgNameAudioPort(
711 714
   unsigned        dspFramesPerCycle,
712 715
   unsigned        audioBufCnt,
713 716
   double          srate,
717
+  const cmChar_t* netNodeLabel,
718
+  const cmChar_t* bcastAddr,
714 719
   const cmChar_t* ipAddr,
715 720
   cmUdpPort_t     ipPort,
716 721
   bool            activeFl )
@@ -771,7 +776,9 @@ cmDcRC_t cmDevCfgNameAudioPort(
771 776
   cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
772 777
   cp->u.a.rtSysArgs.audioBufCnt       = audioBufCnt;
773 778
   cp->u.a.rtSysArgs.srate             = srate;
774
-  cp->u.a.ipAddr                      = ipAddr;
779
+  cp->u.a.netNodeLabel                = netNodeLabel==NULL ? NULL : cmMemAllocStr(netNodeLabel);
780
+  cp->u.a.bcastAddr                   = bcastAddr   ==NULL ? NULL : cmMemAllocStr(bcastAddr);
781
+  cp->u.a.ipAddr                      = ipAddr      ==NULL ? NULL : cmMemAllocStr(ipAddr);
775 782
   cp->u.a.ipPort                      = ipPort;
776 783
   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);
777 784
   return kOkDcRC;  
@@ -912,7 +919,7 @@ const cmDcmAudio_t* cmDevCfgAudioDevMap(    cmDevCfgH_t h, unsigned usrAppId, un
912 919
   return &mp->cfg->u.a;
913 920
 }
914 921
 
915
-
922
+/*
916 923
 cmDcRC_t cmDevCfgNameNetPort(
917 924
   cmDevCfgH_t     h,
918 925
   const cmChar_t* dcLabelStr,
@@ -1005,6 +1012,7 @@ const cmDcmNet_t* cmDevCfgNetDevMap(    cmDevCfgH_t h, unsigned usrAppId, unsign
1005 1012
 
1006 1013
   return &mp->cfg->u.n;
1007 1014
 }
1015
+*/
1008 1016
 
1009 1017
 unsigned        cmDevCfgLocCount(  cmDevCfgH_t h )
1010 1018
 {
@@ -1084,7 +1092,7 @@ cmDcRC_t cmDevCfgLocStore(  cmDevCfgH_t h, const cmChar_t* locLabelStr )
1084 1092
     {
1085 1093
       case kMidiDcmTId:  _cmDcmDuplMidi(&ncp->u.m,&ocp->u.m);  break;
1086 1094
       case kAudioDcmTId: _cmDcmDuplAudio(&ncp->u.a,&ocp->u.a); break;
1087
-      case kNetDcmTId:   _cmDcmDuplNet(  &ncp->u.n,&ocp->u.n); break;
1095
+        //case kNetDcmTId:   _cmDcmDuplNet(  &ncp->u.n,&ocp->u.n); break;
1088 1096
       default:
1089 1097
         assert(0);
1090 1098
         break;
@@ -1265,7 +1273,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1265 1273
 
1266 1274
       cmDcmMidi_t  m;
1267 1275
       cmDcmAudio_t a;
1268
-      cmDcmNet_t   n;
1276
+      //cmDcmNet_t   n;
1269 1277
       
1270 1278
       switch( typeId )
1271 1279
       {
@@ -1295,6 +1303,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1295 1303
               "dspFramesPerCycle", kIntTId,    &a.rtSysArgs.dspFramesPerCycle,
1296 1304
               "audioBufCnt",       kIntTId,    &a.rtSysArgs.audioBufCnt,
1297 1305
               "srate",             kRealTId,   &a.rtSysArgs.srate,
1306
+              "netNodeLabel",      kStringTId, &a.netNodeLabel,
1307
+              "bcastAddr",         kStringTId, &a.bcastAddr,
1298 1308
               "ipAddr",            kStringTId, &a.ipAddr,
1299 1309
               "ipPort",            kIntTId,    &a.ipPort,
1300 1310
               "active",            kBoolTId,   &a.activeFl,
@@ -1311,6 +1321,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1311 1321
                 a.rtSysArgs.dspFramesPerCycle,
1312 1322
                 a.rtSysArgs.audioBufCnt,
1313 1323
                 a.rtSysArgs.srate,
1324
+                a.netNodeLabel,
1325
+                a.bcastAddr,
1314 1326
                 a.ipAddr,
1315 1327
                 a.ipPort,
1316 1328
                 a.activeFl)) != kOkDcRC )
@@ -1319,7 +1331,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1319 1331
           }
1320 1332
 
1321 1333
           break;
1322
-
1334
+          /*
1323 1335
         case kNetDcmTId:
1324 1336
           if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
1325 1337
               "sockAddr",   kStringTId, &n.sockAddr,
@@ -1335,6 +1347,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1335 1347
             goto errLabel;
1336 1348
 
1337 1349
           break;
1350
+          */
1338 1351
 
1339 1352
         default:
1340 1353
           assert(0);
@@ -1430,12 +1443,15 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
1430 1443
             "dspFramesPerCycle", kIntTId,    cp->u.a.rtSysArgs.dspFramesPerCycle,
1431 1444
             "audioBufCnt",       kIntTId,    cp->u.a.rtSysArgs.audioBufCnt,
1432 1445
             "srate",             kRealTId,   cp->u.a.rtSysArgs.srate,
1446
+            "netNodeLabel",      kStringTId, cp->u.a.netNodeLabel,
1447
+            "bcastAddr",         kStringTId, cp->u.a.bcastAddr,
1433 1448
             "ipAddr",            kStringTId, cp->u.a.ipAddr,
1434 1449
             "ipPort",            kIntTId,    cp->u.a.ipPort,
1435 1450
             "active",            kBoolTId,   cp->u.a.activeFl,
1436 1451
             NULL );
1437 1452
           break;
1438 1453
 
1454
+          /*
1439 1455
         case kNetDcmTId:
1440 1456
           cmJsonInsertPairs(jsH, cfgObjNp,
1441 1457
             "sockAddr",  kStringTId, cp->u.n.sockAddr,
@@ -1443,7 +1459,7 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
1443 1459
             "activeFl",  kBoolTId,   cp->u.n.activeFl,
1444 1460
             NULL );
1445 1461
           break;
1446
-
1462
+          */
1447 1463
         default:
1448 1464
           assert(0);
1449 1465
           break;

+ 9
- 2
cmDevCfg.h Ver fichero

@@ -59,7 +59,7 @@ extern "C" {
59 59
     kInvalidDcmTId, // kInvalidDcmTId must be zero
60 60
     kMidiDcmTId,
61 61
     kAudioDcmTId,
62
-    kNetDcmTId
62
+    //kNetDcmTId
63 63
   } cmTypeDcmId_t;
64 64
 
65 65
   typedef cmRC_t     cmDcRC_t;
@@ -81,11 +81,14 @@ extern "C" {
81 81
     cmChar_t*       inDevLabelStr;  // Input audio device label.
82 82
     cmChar_t*       outDevLabelStr; // Output audio device label.
83 83
     cmRtSysArgs_t   rtSysArgs;      // RT system  cfg recd
84
+    const cmChar_t* netNodeLabel;
85
+    const cmChar_t* bcastAddr;      // network broadcast address
84 86
     const cmChar_t* ipAddr;         // local network addr or NULL for localhost
85 87
     cmUdpPort_t     ipPort;         // local network port
86 88
     bool            activeFl;
87 89
   } cmDcmAudio_t;
88 90
 
91
+  /*
89 92
   typedef struct              
90 93
   {
91 94
     const cmChar_t* label;      // cfg label
@@ -93,6 +96,7 @@ extern "C" {
93 96
     unsigned        portNumber; // socket port number
94 97
     bool            activeFl;   // this port is active/inactive
95 98
   } cmDcmNet_t;
99
+  */
96 100
 
97 101
   extern cmDevCfgH_t cmDevCfgNullHandle;
98 102
 
@@ -148,6 +152,8 @@ extern "C" {
148 152
     unsigned        dspFramesPerCycle,
149 153
     unsigned        audioBufCnt,
150 154
     double          srate,
155
+    const cmChar_t* netNodeLabel,
156
+    const cmChar_t* bcastAddr,
151 157
     const cmChar_t* ipAddr,
152 158
     cmUdpPort_t     ipPort,
153 159
     bool            activeFl );
@@ -163,7 +169,7 @@ extern "C" {
163 169
   
164 170
 
165 171
   const struct cmRtSysArgs_str* cmDevCfgRtSysArgs( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId );
166
-
172
+  /*
167 173
   cmDcRC_t cmDevCfgNameNetPort(
168 174
     cmDevCfgH_t      h,
169 175
     const cmChar_t* dcLabelStr,
@@ -176,6 +182,7 @@ extern "C" {
176 182
 
177 183
   const cmDcmNet_t* cmDevCfgNetCfg( cmDevCfgH_t h, unsigned cfgIdx );
178 184
   const cmDcmNet_t* cmDevCfgNetMap( cmDevCfgH_t h, unsigned usrAppId, unsigned usrMapId );
185
+  */
179 186
 
180 187
   //---------------------------------------------------------------------------------------
181 188
   // Location Management Functions:

Loading…
Cancelar
Guardar