Browse Source

cmDevCfg.h/c: Added ipAddr,ipPort to audio cfg. Removed localFl from net cfg.

master
kevin 11 years ago
parent
commit
4afc25d682
2 changed files with 22 additions and 62 deletions
  1. 13
    54
      cmDevCfg.c
  2. 9
    8
      cmDevCfg.h

+ 13
- 54
cmDevCfg.c View File

@@ -14,8 +14,8 @@
14 14
 #include "cmMidiPort.h"
15 15
 #include "cmAudioPort.h"
16 16
 #include "cmUdpPort.h"
17
-#include "cmUdpNet.h"
18 17
 #include "cmRtSysMsg.h"
18
+#include "cmRtNet.h"
19 19
 #include "cmRtSys.h"
20 20
 
21 21
 #include "cmDevCfg.h"
@@ -146,7 +146,6 @@ void _cmDcmDuplNet( cmDcmNet_t* d, const cmDcmNet_t* s )
146 146
 {
147 147
   d->sockAddr   = cmMemAllocStr(s->sockAddr);
148 148
   d->portNumber = s->portNumber;
149
-  d->localFl    = s->localFl;
150 149
   d->activeFl   = s->activeFl;
151 150
 }
152 151
 
@@ -712,6 +711,8 @@ cmDcRC_t cmDevCfgNameAudioPort(
712 711
   unsigned        dspFramesPerCycle,
713 712
   unsigned        audioBufCnt,
714 713
   double          srate,
714
+  const cmChar_t* ipAddr,
715
+  cmUdpPort_t     ipPort,
715 716
   bool            activeFl )
716 717
 {
717 718
   cmDcm_t*    p         = _cmDcmHandleToPtr(h);
@@ -770,58 +771,14 @@ cmDcRC_t cmDevCfgNameAudioPort(
770 771
   cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
771 772
   cp->u.a.rtSysArgs.audioBufCnt       = audioBufCnt;
772 773
   cp->u.a.rtSysArgs.srate             = srate;
774
+  cp->u.a.ipAddr                      = ipAddr;
775
+  cp->u.a.ipPort                      = ipPort;
773 776
   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);
774 777
   return kOkDcRC;  
775 778
 }
776 779
 
777 780
 
778 781
 
779
-cmDcRC_t            cmDevCfgAudioSetDefaultCfgIndex( cmDevCfgH_t h, unsigned cfgIdx )
780
-{
781
-  cmDcm_t* p = _cmDcmHandleToPtr(h);
782
-
783
-  assert( p->clp != NULL );
784
-
785
-  cmDcmCfg_t* cp = p->clp->cfg;
786
-  unsigned    i;
787
-
788
-  for(i=0; cp!=NULL; cp=cp->next)
789
-    if( cp->typeId == kAudioDcmTId )
790
-    {
791
-      if( i == cfgIdx )
792
-        cp->u.a.dfltFl = true;
793
-      else
794
-      {
795
-        if( cp->u.a.dfltFl )
796
-          cp->u.a.dfltFl = false;
797
-      }
798
-
799
-      ++i;
800
-    }
801
-  
802
-
803
-  return kOkDcRC;
804
-}
805
-
806
-unsigned   cmDevCfgAudioGetDefaultCfgIndex( cmDevCfgH_t h )
807
-{
808
-  cmDcm_t* p = _cmDcmHandleToPtr(h);
809
-
810
-  assert( p->clp != NULL );
811
-
812
-  cmDcmCfg_t* cp = p->clp->cfg;
813
-  unsigned    i;
814
-
815
-  for(i=0; cp!=NULL; cp=cp->next)
816
-    if( cp->typeId == kAudioDcmTId )
817
-    {
818
-      if( cp->u.a.dfltFl )
819
-        return i;
820
-
821
-      ++i;
822
-    }
823
-  return cmInvalidIdx;
824
-}
825 782
 
826 783
 bool  cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
827 784
 {
@@ -961,7 +918,6 @@ cmDcRC_t cmDevCfgNameNetPort(
961 918
   const cmChar_t* dcLabelStr,
962 919
   const cmChar_t* sockAddr,
963 920
   unsigned        portNumber,
964
-  bool            localFl,
965 921
   bool            activeFl)
966 922
 {
967 923
 
@@ -983,9 +939,8 @@ cmDcRC_t cmDevCfgNameNetPort(
983 939
   cp->u.n.label      = cp->dcLabelStr;
984 940
   cp->u.n.sockAddr   = cmMemAllocStr(sockAddr);
985 941
   cp->u.n.portNumber = portNumber;
986
-  cp->u.n.localFl    = localFl;
987 942
   cp->u.n.activeFl   = activeFl;
988
-  cp->descStr        = cmTsPrintfP(cp->descStr,"%s %s %s:%i",activeFl?"":"INACTIVE",localFl?"local":"remote",sockAddr,portNumber);
943
+  cp->descStr        = cmTsPrintfP(cp->descStr,"%s %s:%i",activeFl?"":"INACTIVE",sockAddr,portNumber);
989 944
   
990 945
 
991 946
   return kOkDcRC;
@@ -1340,6 +1295,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1340 1295
               "dspFramesPerCycle", kIntTId,    &a.rtSysArgs.dspFramesPerCycle,
1341 1296
               "audioBufCnt",       kIntTId,    &a.rtSysArgs.audioBufCnt,
1342 1297
               "srate",             kRealTId,   &a.rtSysArgs.srate,
1298
+              "ipAddr",            kStringTId, &a.ipAddr,
1299
+              "ipPort",            kIntTId,    &a.ipPort,
1343 1300
               "active",            kBoolTId,   &a.activeFl,
1344 1301
               NULL ) != kOkJsRC )
1345 1302
           {
@@ -1354,6 +1311,8 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1354 1311
                 a.rtSysArgs.dspFramesPerCycle,
1355 1312
                 a.rtSysArgs.audioBufCnt,
1356 1313
                 a.rtSysArgs.srate,
1314
+                a.ipAddr,
1315
+                a.ipPort,
1357 1316
                 a.activeFl)) != kOkDcRC )
1358 1317
           {
1359 1318
             goto errLabel;
@@ -1365,7 +1324,6 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1365 1324
           if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
1366 1325
               "sockAddr",   kStringTId, &n.sockAddr,
1367 1326
               "portNumber", kIntTId,    &n.portNumber,
1368
-              "localFl",    kBoolTId,   &n.localFl,
1369 1327
               "activeFl",   kBoolTId,   &n.activeFl,
1370 1328
               NULL ) != kOkJsRC )
1371 1329
           {
@@ -1373,7 +1331,7 @@ cmDcRC_t _cmDevCfgRead( cmDcm_t* p, cmJsonH_t jsH, const cmJsonNode_t* rootObjPt
1373 1331
             goto errLabel;
1374 1332
           }
1375 1333
 
1376
-          if((rc = cmDevCfgNameNetPort(h,dcLabelStr,n.sockAddr,n.portNumber,n.localFl,n.activeFl)) != kOkDcRC )
1334
+          if((rc = cmDevCfgNameNetPort(h,dcLabelStr,n.sockAddr,n.portNumber,n.activeFl)) != kOkDcRC )
1377 1335
             goto errLabel;
1378 1336
 
1379 1337
           break;
@@ -1472,6 +1430,8 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
1472 1430
             "dspFramesPerCycle", kIntTId,    cp->u.a.rtSysArgs.dspFramesPerCycle,
1473 1431
             "audioBufCnt",       kIntTId,    cp->u.a.rtSysArgs.audioBufCnt,
1474 1432
             "srate",             kRealTId,   cp->u.a.rtSysArgs.srate,
1433
+            "ipAddr",            kStringTId, cp->u.a.ipAddr,
1434
+            "ipPort",            kIntTId,    cp->u.a.ipPort,
1475 1435
             "active",            kBoolTId,   cp->u.a.activeFl,
1476 1436
             NULL );
1477 1437
           break;
@@ -1480,7 +1440,6 @@ cmDcRC_t _cmDevCfgWrite( cmDcm_t* p, cmJsonH_t jsH, cmJsonNode_t* rootObjPtr )
1480 1440
           cmJsonInsertPairs(jsH, cfgObjNp,
1481 1441
             "sockAddr",  kStringTId, cp->u.n.sockAddr,
1482 1442
             "portNumber",kIntTId,    cp->u.n.portNumber,
1483
-            "localFl",   kBoolTId,   cp->u.n.localFl,
1484 1443
             "activeFl",  kBoolTId,   cp->u.n.activeFl,
1485 1444
             NULL );
1486 1445
           break;

+ 9
- 8
cmDevCfg.h View File

@@ -77,12 +77,13 @@ extern "C" {
77 77
 
78 78
   typedef struct
79 79
   {
80
-    const cmChar_t* label;         // cfg label
81
-    cmChar_t*     inDevLabelStr;  // Input audio device label.
82
-    cmChar_t*     outDevLabelStr; // Output audio device label.
83
-    cmRtSysArgs_t rtSysArgs;      // RT system  cfg recd
84
-    bool          dfltFl;         // true if this is the default audio cfg.
85
-    bool          activeFl;
80
+    const cmChar_t* label;          // cfg label
81
+    cmChar_t*       inDevLabelStr;  // Input audio device label.
82
+    cmChar_t*       outDevLabelStr; // Output audio device label.
83
+    cmRtSysArgs_t   rtSysArgs;      // RT system  cfg recd
84
+    const cmChar_t* ipAddr;         // local network addr or NULL for localhost
85
+    cmUdpPort_t     ipPort;         // local network port
86
+    bool            activeFl;
86 87
   } cmDcmAudio_t;
87 88
 
88 89
   typedef struct              
@@ -90,7 +91,6 @@ extern "C" {
90 91
     const cmChar_t* label;      // cfg label
91 92
     cmChar_t*       sockAddr;   // socket address.
92 93
     unsigned        portNumber; // socket port number
93
-    bool            localFl;    // this is the local port
94 94
     bool            activeFl;   // this port is active/inactive
95 95
   } cmDcmNet_t;
96 96
 
@@ -148,6 +148,8 @@ extern "C" {
148 148
     unsigned        dspFramesPerCycle,
149 149
     unsigned        audioBufCnt,
150 150
     double          srate,
151
+    const cmChar_t* ipAddr,
152
+    cmUdpPort_t     ipPort,
151 153
     bool            activeFl );
152 154
 
153 155
   bool                cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl );
@@ -167,7 +169,6 @@ extern "C" {
167 169
     const cmChar_t* dcLabelStr,
168 170
     const cmChar_t* sockAddr,
169 171
     unsigned        portNumber,
170
-    bool            localFl,
171 172
     bool            activeFl);
172 173
 
173 174
   unsigned          cmDevCfgNetActiveCount( cmDevCfgH_t h );

Loading…
Cancel
Save