Ver código fonte

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

master
kevin 11 anos atrás
pai
commit
4afc25d682
2 arquivos alterados com 22 adições e 62 exclusões
  1. 13
    54
      cmDevCfg.c
  2. 9
    8
      cmDevCfg.h

+ 13
- 54
cmDevCfg.c Ver arquivo

14
 #include "cmMidiPort.h"
14
 #include "cmMidiPort.h"
15
 #include "cmAudioPort.h"
15
 #include "cmAudioPort.h"
16
 #include "cmUdpPort.h"
16
 #include "cmUdpPort.h"
17
-#include "cmUdpNet.h"
18
 #include "cmRtSysMsg.h"
17
 #include "cmRtSysMsg.h"
18
+#include "cmRtNet.h"
19
 #include "cmRtSys.h"
19
 #include "cmRtSys.h"
20
 
20
 
21
 #include "cmDevCfg.h"
21
 #include "cmDevCfg.h"
146
 {
146
 {
147
   d->sockAddr   = cmMemAllocStr(s->sockAddr);
147
   d->sockAddr   = cmMemAllocStr(s->sockAddr);
148
   d->portNumber = s->portNumber;
148
   d->portNumber = s->portNumber;
149
-  d->localFl    = s->localFl;
150
   d->activeFl   = s->activeFl;
149
   d->activeFl   = s->activeFl;
151
 }
150
 }
152
 
151
 
712
   unsigned        dspFramesPerCycle,
711
   unsigned        dspFramesPerCycle,
713
   unsigned        audioBufCnt,
712
   unsigned        audioBufCnt,
714
   double          srate,
713
   double          srate,
714
+  const cmChar_t* ipAddr,
715
+  cmUdpPort_t     ipPort,
715
   bool            activeFl )
716
   bool            activeFl )
716
 {
717
 {
717
   cmDcm_t*    p         = _cmDcmHandleToPtr(h);
718
   cmDcm_t*    p         = _cmDcmHandleToPtr(h);
770
   cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
771
   cp->u.a.rtSysArgs.dspFramesPerCycle = dspFramesPerCycle;
771
   cp->u.a.rtSysArgs.audioBufCnt       = audioBufCnt;
772
   cp->u.a.rtSysArgs.audioBufCnt       = audioBufCnt;
772
   cp->u.a.rtSysArgs.srate             = srate;
773
   cp->u.a.rtSysArgs.srate             = srate;
774
+  cp->u.a.ipAddr                      = ipAddr;
775
+  cp->u.a.ipPort                      = ipPort;
773
   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);
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
   return kOkDcRC;  
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
 bool  cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
783
 bool  cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl )
827
 {
784
 {
961
   const cmChar_t* dcLabelStr,
918
   const cmChar_t* dcLabelStr,
962
   const cmChar_t* sockAddr,
919
   const cmChar_t* sockAddr,
963
   unsigned        portNumber,
920
   unsigned        portNumber,
964
-  bool            localFl,
965
   bool            activeFl)
921
   bool            activeFl)
966
 {
922
 {
967
 
923
 
983
   cp->u.n.label      = cp->dcLabelStr;
939
   cp->u.n.label      = cp->dcLabelStr;
984
   cp->u.n.sockAddr   = cmMemAllocStr(sockAddr);
940
   cp->u.n.sockAddr   = cmMemAllocStr(sockAddr);
985
   cp->u.n.portNumber = portNumber;
941
   cp->u.n.portNumber = portNumber;
986
-  cp->u.n.localFl    = localFl;
987
   cp->u.n.activeFl   = activeFl;
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
   return kOkDcRC;
946
   return kOkDcRC;
1340
               "dspFramesPerCycle", kIntTId,    &a.rtSysArgs.dspFramesPerCycle,
1295
               "dspFramesPerCycle", kIntTId,    &a.rtSysArgs.dspFramesPerCycle,
1341
               "audioBufCnt",       kIntTId,    &a.rtSysArgs.audioBufCnt,
1296
               "audioBufCnt",       kIntTId,    &a.rtSysArgs.audioBufCnt,
1342
               "srate",             kRealTId,   &a.rtSysArgs.srate,
1297
               "srate",             kRealTId,   &a.rtSysArgs.srate,
1298
+              "ipAddr",            kStringTId, &a.ipAddr,
1299
+              "ipPort",            kIntTId,    &a.ipPort,
1343
               "active",            kBoolTId,   &a.activeFl,
1300
               "active",            kBoolTId,   &a.activeFl,
1344
               NULL ) != kOkJsRC )
1301
               NULL ) != kOkJsRC )
1345
           {
1302
           {
1354
                 a.rtSysArgs.dspFramesPerCycle,
1311
                 a.rtSysArgs.dspFramesPerCycle,
1355
                 a.rtSysArgs.audioBufCnt,
1312
                 a.rtSysArgs.audioBufCnt,
1356
                 a.rtSysArgs.srate,
1313
                 a.rtSysArgs.srate,
1314
+                a.ipAddr,
1315
+                a.ipPort,
1357
                 a.activeFl)) != kOkDcRC )
1316
                 a.activeFl)) != kOkDcRC )
1358
           {
1317
           {
1359
             goto errLabel;
1318
             goto errLabel;
1365
           if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
1324
           if( cmJsonMemberValues( cfgObjNp, &errLabelPtr,
1366
               "sockAddr",   kStringTId, &n.sockAddr,
1325
               "sockAddr",   kStringTId, &n.sockAddr,
1367
               "portNumber", kIntTId,    &n.portNumber,
1326
               "portNumber", kIntTId,    &n.portNumber,
1368
-              "localFl",    kBoolTId,   &n.localFl,
1369
               "activeFl",   kBoolTId,   &n.activeFl,
1327
               "activeFl",   kBoolTId,   &n.activeFl,
1370
               NULL ) != kOkJsRC )
1328
               NULL ) != kOkJsRC )
1371
           {
1329
           {
1373
             goto errLabel;
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
             goto errLabel;
1335
             goto errLabel;
1378
 
1336
 
1379
           break;
1337
           break;
1472
             "dspFramesPerCycle", kIntTId,    cp->u.a.rtSysArgs.dspFramesPerCycle,
1430
             "dspFramesPerCycle", kIntTId,    cp->u.a.rtSysArgs.dspFramesPerCycle,
1473
             "audioBufCnt",       kIntTId,    cp->u.a.rtSysArgs.audioBufCnt,
1431
             "audioBufCnt",       kIntTId,    cp->u.a.rtSysArgs.audioBufCnt,
1474
             "srate",             kRealTId,   cp->u.a.rtSysArgs.srate,
1432
             "srate",             kRealTId,   cp->u.a.rtSysArgs.srate,
1433
+            "ipAddr",            kStringTId, cp->u.a.ipAddr,
1434
+            "ipPort",            kIntTId,    cp->u.a.ipPort,
1475
             "active",            kBoolTId,   cp->u.a.activeFl,
1435
             "active",            kBoolTId,   cp->u.a.activeFl,
1476
             NULL );
1436
             NULL );
1477
           break;
1437
           break;
1480
           cmJsonInsertPairs(jsH, cfgObjNp,
1440
           cmJsonInsertPairs(jsH, cfgObjNp,
1481
             "sockAddr",  kStringTId, cp->u.n.sockAddr,
1441
             "sockAddr",  kStringTId, cp->u.n.sockAddr,
1482
             "portNumber",kIntTId,    cp->u.n.portNumber,
1442
             "portNumber",kIntTId,    cp->u.n.portNumber,
1483
-            "localFl",   kBoolTId,   cp->u.n.localFl,
1484
             "activeFl",  kBoolTId,   cp->u.n.activeFl,
1443
             "activeFl",  kBoolTId,   cp->u.n.activeFl,
1485
             NULL );
1444
             NULL );
1486
           break;
1445
           break;

+ 9
- 8
cmDevCfg.h Ver arquivo

77
 
77
 
78
   typedef struct
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
   } cmDcmAudio_t;
87
   } cmDcmAudio_t;
87
 
88
 
88
   typedef struct              
89
   typedef struct              
90
     const cmChar_t* label;      // cfg label
91
     const cmChar_t* label;      // cfg label
91
     cmChar_t*       sockAddr;   // socket address.
92
     cmChar_t*       sockAddr;   // socket address.
92
     unsigned        portNumber; // socket port number
93
     unsigned        portNumber; // socket port number
93
-    bool            localFl;    // this is the local port
94
     bool            activeFl;   // this port is active/inactive
94
     bool            activeFl;   // this port is active/inactive
95
   } cmDcmNet_t;
95
   } cmDcmNet_t;
96
 
96
 
148
     unsigned        dspFramesPerCycle,
148
     unsigned        dspFramesPerCycle,
149
     unsigned        audioBufCnt,
149
     unsigned        audioBufCnt,
150
     double          srate,
150
     double          srate,
151
+    const cmChar_t* ipAddr,
152
+    cmUdpPort_t     ipPort,
151
     bool            activeFl );
153
     bool            activeFl );
152
 
154
 
153
   bool                cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl );
155
   bool                cmDevCfgAudioIsDeviceActive( cmDevCfgH_t h, const cmChar_t* devNameStr, bool inputFl );
167
     const cmChar_t* dcLabelStr,
169
     const cmChar_t* dcLabelStr,
168
     const cmChar_t* sockAddr,
170
     const cmChar_t* sockAddr,
169
     unsigned        portNumber,
171
     unsigned        portNumber,
170
-    bool            localFl,
171
     bool            activeFl);
172
     bool            activeFl);
172
 
173
 
173
   unsigned          cmDevCfgNetActiveCount( cmDevCfgH_t h );
174
   unsigned          cmDevCfgNetActiveCount( cmDevCfgH_t h );

Carregando…
Cancelar
Salvar