Browse Source

cmRtSys.h: Replace cmRtSysInitialize() with cmRtSysBeginCfg/Cfg/EndCfg().

master
kevin 11 years ago
parent
commit
674e5fba31
2 changed files with 309 additions and 194 deletions
  1. 268
    165
      cmRtSys.c
  2. 41
    29
      cmRtSys.h

+ 268
- 165
cmRtSys.c View File

@@ -15,6 +15,7 @@
15 15
 #include "cmUdpPort.h"
16 16
 #include "cmUdpNet.h"
17 17
 #include "cmRtSysMsg.h"
18
+#include "cmRtNet.h"
18 19
 #include "cmRtSys.h"
19 20
 #include "cmMidi.h"
20 21
 #include "cmMidiPort.h"
@@ -34,14 +35,14 @@ struct cmRt_str;
34 35
 
35 36
 typedef struct
36 37
 {
37
-  struct cmRt_str* p;           // pointer to the audio system instance which owns this sub-system
38
+  struct cmRt_str* p;           // pointer to the real-time system instance which owns this sub-system
38 39
   cmRtSysSubSys_t  ss;          // sub-system configuration record
39 40
   cmRtSysCtx_t     ctx;         // DSP context
40 41
   cmRtSysStatus_t  status;      // current runtime status of this sub-system
41
-  cmThreadH_t      threadH;     // audio system thread
42
+  cmThreadH_t      threadH;     // real-time system thread
42 43
   cmTsMp1cH_t      htdQueueH;   // host-to-dsp thread safe msg queue
43 44
   cmThreadMutexH_t engMutexH;   // thread mutex and condition variable
44
-  cmUdpH_t         udpH;
45
+  cmRtNetH_t       netH;
45 46
   bool             runFl;       // false during finalization otherwise true
46 47
   bool             statusFl;    // true if regular status notifications should be sent
47 48
   bool             syncInputFl;
@@ -60,11 +61,16 @@ typedef struct
60 61
 typedef struct cmRt_str
61 62
 {
62 63
   cmErr_t     err;
64
+  cmCtx_t*    ctx;
63 65
   _cmRtCfg_t* ssArray;
64 66
   unsigned    ssCnt;
65 67
   unsigned    waitRtSubIdx; // index of the next sub-system to try with cmRtSysIsMsgWaiting().
66 68
   cmTsMp1cH_t dthQueH;
67
-  bool        initFl;       // true if the audio system is initialized
69
+  bool        initFl;       // true if the real-time system is initialized
70
+
71
+  cmTsQueueCb_t clientCbFunc; // These fields are only used during configuration. 
72
+  void*         clientCbArg;  // See cmRtBeginCfg() and cmRtCfg().
73
+
68 74
 } cmRt_t;
69 75
 
70 76
 
@@ -190,7 +196,7 @@ cmRtRC_t  _cmRtParseNonSubSysMsg(  cmRt_t* p, const void* msg, unsigned msgByteC
190 196
   return rc;
191 197
 }
192 198
 
193
-// Process a UI msg sent from the host to the audio system  
199
+// Process a UI msg sent from the host to the real-time system  
194 200
 cmRtRC_t  _cmRtHandleNonSubSysMsg(  cmRt_t* p, const void* msgDataPtrArray[], unsigned msgByteCntArray[], unsigned msgSegCnt )
195 201
 {
196 202
   cmRtRC_t rc = kOkRtRC;
@@ -275,10 +281,15 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp )
275 281
   cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt  );
276 282
 
277 283
 
278
-  // calling this function results in callbacks to _gtNetRecv()
284
+  // calling this function results in callbacks to _cmRtNetRecv()
279 285
   // which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
280 286
   // which are then transferred to the DSP processes by the the call to 
281 287
   // _cmRtDeliverMsgWithLock() below.
288
+  if( cmRtNetIsValid(cp->netH) )
289
+    if( cmRtNetReceive(cp->netH) != kOkNetRC )
290
+      _cmRtError(cp->p,kNetErrRtRC,"Network receive failed.");
291
+
292
+
282 293
   //if( cp->cbEnableFl )
283 294
   //  cmUdpGetAvailData(cp->udpH,NULL,NULL,NULL);
284 295
     
@@ -350,7 +361,7 @@ bool _cmRtBufIsReady( const _cmRtCfg_t* cp )
350 361
 
351 362
 
352 363
 
353
-// This is the main audio system loop (and thread callback function).
364
+// This is the main real-time system loop (and thread callback function).
354 365
 // It blocks by waiting on a cond. var (which simultaneously unlocks a mutex).
355 366
 // With the mutex unlocked messages can pass directly to the DSP process
356 367
 // via calls to cmRtDeliverMsg(). 
@@ -477,7 +488,7 @@ void   _cmRtSysAudioUpdate( cmApAudioPacket_t* inPktArray, unsigned inPktCnt, cm
477 488
     //printf("%i %i %i %i\n",testBufFl,cp->syncInputFl,inPktCnt,outPktCnt);
478 489
 
479 490
     // if the input/output buffer contain samples to be processed then signal the condition variable 
480
-    // - this will cause the audio system thread to unblock and the used defined DSP process will be called.
491
+    // - this will cause the real-time system thread to unblock and the used defined DSP process will be called.
481 492
     if( testBufFl && _cmRtBufIsReady(cp) )
482 493
     {
483 494
       if( cmThreadMutexSignalCondVar(cp->engMutexH) != kOkThRC )
@@ -527,7 +538,34 @@ void _cmRtSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt )
527 538
 
528 539
 }
529 540
 
530
-cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmRpt_t* rpt, const cmRtSysCfg_t* cfg )
541
+// This funciton is called from the real-time thread
542
+void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
543
+{
544
+  _cmRtCfg_t*      cp = (_cmRtCfg_t*)cbArg;
545
+  cmRtSysMsgHdr_t* hdr  = (cmRtSysMsgHdr_t*)data;
546
+
547
+  // is this a network sync. msg.
548
+  if( hdr->selId == kNetSyncSelRtId )
549
+  {
550
+    if( cmRtNetSyncModeRecv(cp->netH, data, dataByteCnt, fromAddr ) != kOkNetRC )
551
+      cmErrMsg(&cp->p->err,kNetErrRtRC,"Network sync mode receive failed.");
552
+  }
553
+  else
554
+  {
555
+    cmRtSysH_t h;
556
+    h.h = cp->p;
557
+    cmRtSysDeliverMsg(h,data,dataByteCnt,cmInvalidId);
558
+  }
559
+
560
+  // If the network is in sync mode 
561
+  if( cmRtNetIsValid(cp->netH) && cmRtNetIsInSyncMode(cp->netH) )
562
+    if( cmRtNetSyncModeSend(cp->netH) != kOkNetRC )
563
+      cmErrMsg(&cp->p->err,kNetErrRtRC,"Net sync send failed.");
564
+
565
+}
566
+
567
+
568
+cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )
531 569
 {
532 570
   cmRtRC_t rc;
533 571
 
@@ -536,14 +574,11 @@ cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmRpt_t* rpt, const cmRtSysCfg_t* cfg
536 574
 
537 575
   cmRt_t*  p = cmMemAllocZ( cmRt_t, 1 );
538 576
 
539
-  cmErrSetup(&p->err,rpt,"Audio System");
577
+  cmErrSetup(&p->err,&ctx->rpt,"Real-Time System");
578
+  p->ctx = ctx;
540 579
 
541 580
   hp->h = p;
542 581
 
543
-  if( cfg != NULL )
544
-    if((rc = cmRtSysInitialize( *hp, cfg )) != kOkRtRC )
545
-      cmRtSysFree(hp);
546
-
547 582
   return rc;
548 583
 }
549 584
 
@@ -608,6 +643,16 @@ cmRtRC_t _cmRtSysEnable( cmRt_t* p, bool enableFl )
608 643
 
609 644
   }
610 645
 
646
+  // enable network sync mode
647
+  if( enableFl)
648
+    for(i=0; i<p->ssCnt; ++i)
649
+    {
650
+      _cmRtCfg_t* cp = p->ssArray + i;
651
+      if( cmRtNetIsValid(cp->netH) )
652
+        if( cmRtNetBeginSyncMode(cp->netH) != kOkNetRC )
653
+          rc = cmErrMsg(&p->err,kNetErrRtRC,"Network Mgr. failed on entering sync mode.");
654
+    }
655
+  
611 656
   return rc;
612 657
 }
613 658
 
@@ -616,12 +661,12 @@ cmRtRC_t _cmRtSysFinalize( cmRt_t* p )
616 661
   cmRtRC_t rc = kOkRtRC;
617 662
   unsigned i;
618 663
   
619
-  // mark  the audio system as NOT initialized
664
+  // mark  the real-time system as NOT initialized
620 665
   p->initFl = false;
621 666
 
622 667
   // be sure all audio callbacks are disabled before continuing.
623 668
   if((rc = _cmRtSysEnable(p,false)) != kOkRtRC )
624
-    return _cmRtError(p,rc,"Audio system finalize failed because device halting failed.");
669
+    return _cmRtError(p,rc,"real-time system finalize failed because device halting failed.");
625 670
 
626 671
   // stop the audio devices 
627 672
   for(i=0; i<p->ssCnt; ++i)
@@ -672,6 +717,9 @@ cmRtRC_t _cmRtSysFinalize( cmRt_t* p )
672 717
       if((rc = cmThreadMutexDestroy( &cp->engMutexH )) != kOkThRC )
673 718
         _cmRtError(p,kMutexErrRtRC,"Mutex destroy failed.");
674 719
 
720
+    // release the network mgr
721
+    if( cmRtNetFree(&cp->netH) != kOkNetRC )
722
+      _cmRtError(p,kNetErrRtRC,"Network Mrr. release failed.");
675 723
 
676 724
     // remove the MIDI callback
677 725
     if( cmMpIsInitialized() && cmMpUsesCallback(-1,-1, _cmRtSysMidiCallback, cp) )
@@ -708,10 +756,11 @@ cmRtRC_t _cmRtSysFinalize( cmRt_t* p )
708 756
   return rc;
709 757
 }
710 758
 
711
-// A given device may be used as an input device exactly once and an output device exactly once.
712
-// When the input to a given device is used by one sub-system and the output is used by another
713
-// then both sub-systems must use the same srate,devFramesPerCycle, audioBufCnt and dspFramesPerCycle.
714
-cmRtRC_t _cmRtSysValidate( cmErr_t* err, const cmRtSysCfg_t* cfg )
759
+// A given device may be used as an input device exactly once and an 
760
+// output device exactly once. When the input to a given device is used 
761
+// by one sub-system and the output is used by another then both sub-systems 
762
+// must use the same srate,devFramesPerCycle, audioBufCnt and dspFramesPerCycle.
763
+cmRtRC_t _cmRtSysValidate( cmRt_t* p )
715 764
 {
716 765
   unsigned i,j,k;
717 766
   for(i=0; i<2; ++i)
@@ -720,26 +769,26 @@ cmRtRC_t _cmRtSysValidate( cmErr_t* err, const cmRtSysCfg_t* cfg )
720 769
     bool inputFl  = i==0;
721 770
     bool outputFl = !inputFl;
722 771
 
723
-    for(j=0; j<cfg->ssCnt; ++j)
772
+    for(j=0; j<p->ssCnt; ++j)
724 773
     {
725
-      cmRtSysArgs_t* s0     = &cfg->ssArray[j].args;
726
-      unsigned          devIdx = inputFl ? s0->inDevIdx : s0->outDevIdx;
774
+      cmRtSysArgs_t* s0     = &p->ssArray[j].ss.args;
775
+      unsigned       devIdx = inputFl ? s0->inDevIdx : s0->outDevIdx;
727 776
 
728
-      for(k=0; k<cfg->ssCnt && devIdx != cmInvalidIdx; ++k)
777
+      for(k=0; k<p->ssCnt && devIdx != cmInvalidIdx; ++k)
729 778
         if( k != j )
730 779
         {
731
-          cmRtSysArgs_t* s1 = &cfg->ssArray[k].args;
780
+          cmRtSysArgs_t* s1 = &p->ssArray[k].ss.args;
732 781
 
733 782
           // if the device was used as input or output multple times then signal an error
734 783
           if( (inputFl && (s1->inDevIdx == devIdx) && s1->inDevIdx != cmInvalidIdx) || (outputFl && (s1->outDevIdx == devIdx) && s1->outDevIdx != cmInvalidIdx) )
735
-            return cmErrMsg(err,kInvalidArgRtRC,"The device %i was used as an %s by multiple sub-systems.", devIdx, inputFl ? "input" : "output");
784
+            return cmErrMsg(&p->err,kInvalidArgRtRC,"The device %i was used as an %s by multiple sub-systems.", devIdx, inputFl ? "input" : "output");
736 785
 
737 786
           // if this device is being used by another subsystem ...
738 787
           if( (inputFl && (s1->outDevIdx == devIdx) && s1->inDevIdx != cmInvalidIdx) || (outputFl && (s1->outDevIdx == devIdx) && s1->outDevIdx != cmInvalidIdx ) )
739 788
           {
740 789
             // ... then some of its buffer spec's must match 
741 790
             if( s0->srate != s1->srate || s0->audioBufCnt != s1->audioBufCnt || s0->dspFramesPerCycle != s1->dspFramesPerCycle || s0->devFramesPerCycle != s1->devFramesPerCycle )
742
-              return cmErrMsg(err,kInvalidArgRtRC,"The device %i is used by different sub-system with different audio buffer parameters.",devIdx);
791
+              return cmErrMsg(&p->err,kInvalidArgRtRC,"The device %i is used by different sub-system with different audio buffer parameters.",devIdx);
743 792
           }
744 793
         }
745 794
     }
@@ -748,174 +797,219 @@ cmRtRC_t _cmRtSysValidate( cmErr_t* err, const cmRtSysCfg_t* cfg )
748 797
   return kOkRtRC;
749 798
 }
750 799
 
751
-cmRtRC_t cmRtSysInitialize( cmRtSysH_t h, const cmRtSysCfg_t* cfg )
800
+cmRtRC_t  cmRtSysBeginCfg( cmRtSysH_t h, cmTsQueueCb_t clientCbFunc, void* clientCbArg, unsigned meterMs, unsigned ssCnt )
752 801
 {
753
-  cmRtRC_t rc;
754
-  unsigned i;
755 802
   cmRt_t* p = _cmRtHandleToPtr(h);
756
-
757
-  // validate the device setup
758
-  if((rc =_cmRtSysValidate(&p->err, cfg )) != kOkRtRC )
759
-    return rc;
803
+  cmRtRC_t rc;
760 804
 
761 805
   // always finalize before iniitalize
762 806
   if((rc = cmRtSysFinalize(h)) != kOkRtRC )
763 807
     return rc;
764 808
 
809
+  p->ssArray      = cmMemAllocZ( _cmRtCfg_t, ssCnt );
810
+  p->ssCnt        = ssCnt;
811
+  p->clientCbFunc = clientCbFunc;
812
+  p->clientCbArg  = clientCbArg;
765 813
 
766
-  p->ssArray = cmMemAllocZ( _cmRtCfg_t, cfg->ssCnt );
767
-  p->ssCnt   = cfg->ssCnt;
768
-  
769
-  for(i=0; i<p->ssCnt; ++i)
814
+  return rc;
815
+}
816
+
817
+cmRtRC_t cmRtSysCfg( cmRtSysH_t h, const cmRtSysSubSys_t* ss, unsigned rtSubIdx )
818
+{
819
+  cmRtRC_t rc;
820
+  unsigned j;
821
+  cmRt_t* p = _cmRtHandleToPtr(h);
822
+
823
+  assert( rtSubIdx < p->ssCnt);
824
+
825
+  _cmRtCfg_t*            cp = p->ssArray + rtSubIdx;;
826
+
827
+  cp->p                 = p;
828
+  cp->ss                = *ss;  // copy the cfg into the internal real-time system state
829
+  cp->runFl             = false;
830
+  cp->statusFl          = false;
831
+  cp->ctx.reserved      = p;
832
+  cp->ctx.rtSubIdx      = rtSubIdx;
833
+  cp->ctx.ss            = &cp->ss;
834
+  cp->ctx.begSmpIdx     = 0;
835
+  cp->ctx.dspToHostFunc = _cmRtDspToHostMsgCallback;
836
+
837
+  // validate the input device index
838
+  if( ss->args.inDevIdx != cmInvalidIdx && ss->args.inDevIdx >= cmApDeviceCount() )
770 839
   {
771
-    _cmRtCfg_t*               cp = p->ssArray + i;
772
-    const cmRtSysSubSys_t* ss = cfg->ssArray + i;
773
-
774
-    cp->p                 = p;
775
-    cp->ss                = *ss;  // copy the cfg into the internal audio system state
776
-    cp->runFl             = false;
777
-    cp->statusFl          = false;
778
-    cp->ctx.reserved      = p;
779
-    cp->ctx.rtSubIdx      = i;
780
-    cp->ctx.ss            = &cp->ss;
781
-    cp->ctx.begSmpIdx     = 0;
782
-    cp->ctx.dspToHostFunc = _cmRtDspToHostMsgCallback;
783
-
784
-    // validate the input device index
785
-    if( ss->args.inDevIdx != cmInvalidIdx && ss->args.inDevIdx >= cmApDeviceCount() )
840
+    rc = _cmRtError(p,kAudioDevSetupErrRtRC,"The audio input device index %i is invalid.",ss->args.inDevIdx);
841
+    goto errLabel;
842
+  }
843
+
844
+  // validate the output device index
845
+  if( ss->args.outDevIdx != cmInvalidIdx && ss->args.outDevIdx >= cmApDeviceCount() )
846
+  {
847
+    rc =  _cmRtError(p,kAudioDevSetupErrRtRC,"The audio output device index %i is invalid.",ss->args.outDevIdx);
848
+    goto errLabel;
849
+  }
850
+
851
+  // setup the input device
852
+  if( ss->args.inDevIdx != cmInvalidIdx )
853
+    if((rc = cmApDeviceSetup( ss->args.inDevIdx, ss->args.srate, ss->args.devFramesPerCycle, _cmRtSysAudioUpdate, cp )) != kOkRtRC )
786 854
     {
787
-      rc = _cmRtError(p,kAudioDevSetupErrRtRC,"The audio input device index %i is invalid.",ss->args.inDevIdx);
855
+      rc = _cmRtError(p,kAudioDevSetupErrRtRC,"Audio input device setup failed.");
788 856
       goto errLabel;
789 857
     }
790 858
 
791
-    // validate the output device index
792
-    if( ss->args.outDevIdx != cmInvalidIdx && ss->args.outDevIdx >= cmApDeviceCount() )
859
+  // setup the output device
860
+  if( ss->args.outDevIdx != ss->args.inDevIdx && ss->args.outDevIdx != cmInvalidIdx )
861
+    if((rc = cmApDeviceSetup( ss->args.outDevIdx, ss->args.srate, ss->args.devFramesPerCycle, _cmRtSysAudioUpdate, cp )) != kOkRtRC )
793 862
     {
794
-      rc =  _cmRtError(p,kAudioDevSetupErrRtRC,"The audio output device index %i is invalid.",ss->args.outDevIdx);
863
+      rc =  _cmRtError(p,kAudioDevSetupErrRtRC,"Audio output device setup failed.");
795 864
       goto errLabel;
796 865
     }
797 866
 
798
-    // setup the input device
799
-    if( ss->args.inDevIdx != cmInvalidIdx )
800
-      if((rc = cmApDeviceSetup( ss->args.inDevIdx, ss->args.srate, ss->args.devFramesPerCycle, _cmRtSysAudioUpdate, cp )) != kOkRtRC )
801
-      {
802
-        rc = _cmRtError(p,kAudioDevSetupErrRtRC,"Audio input device setup failed.");
803
-        goto errLabel;
804
-      }
867
+  // setup the input device buffer
868
+  if( ss->args.inDevIdx != cmInvalidIdx )
869
+    if((rc = cmApBufSetup( ss->args.inDevIdx, ss->args.srate, ss->args.dspFramesPerCycle, ss->args.audioBufCnt, cmApDeviceChannelCount(ss->args.inDevIdx, true),  ss->args.devFramesPerCycle, cmApDeviceChannelCount(ss->args.inDevIdx, false), ss->args.devFramesPerCycle )) != kOkRtRC )
870
+    {
871
+      rc = _cmRtError(p,kAudioBufSetupErrRtRC,"Audio buffer input  setup failed.");
872
+      goto errLabel;
873
+    }
805 874
 
806
-    // setup the output device
807
-    if( ss->args.outDevIdx != ss->args.inDevIdx && ss->args.outDevIdx != cmInvalidIdx )
808
-      if((rc = cmApDeviceSetup( ss->args.outDevIdx, ss->args.srate, ss->args.devFramesPerCycle, _cmRtSysAudioUpdate, cp )) != kOkRtRC )
809
-      {
810
-        rc =  _cmRtError(p,kAudioDevSetupErrRtRC,"Audio output device setup failed.");
811
-        goto errLabel;
812
-      }
875
+  cmApBufEnableMeter(ss->args.inDevIdx, -1, kInApFl  | kEnableApFl );
876
+  cmApBufEnableMeter(ss->args.outDevIdx,-1, kOutApFl | kEnableApFl );
813 877
 
814
-    // setup the input device buffer
815
-    if( ss->args.inDevIdx != cmInvalidIdx )
816
-      if((rc = cmApBufSetup( ss->args.inDevIdx, ss->args.srate, ss->args.dspFramesPerCycle, ss->args.audioBufCnt, cmApDeviceChannelCount(ss->args.inDevIdx, true),  ss->args.devFramesPerCycle, cmApDeviceChannelCount(ss->args.inDevIdx, false), ss->args.devFramesPerCycle )) != kOkRtRC )
817
-      {
818
-        rc = _cmRtError(p,kAudioBufSetupErrRtRC,"Audio buffer input  setup failed.");
819
-        goto errLabel;
820
-      }
878
+  // setup the input audio buffer ptr array - used to send input audio to the DSP system in _cmRtDspExecCallback()
879
+  if((cp->ctx.iChCnt   = cmApDeviceChannelCount(ss->args.inDevIdx, true)) != 0 )
880
+    cp->ctx.iChArray = cmMemAllocZ( cmSample_t*, cp->ctx.iChCnt );
821 881
 
822
-    cmApBufEnableMeter(ss->args.inDevIdx, -1, kInApFl  | kEnableApFl );
823
-    cmApBufEnableMeter(ss->args.outDevIdx,-1, kOutApFl | kEnableApFl );
882
+  // setup the output device buffer
883
+  if( ss->args.outDevIdx != ss->args.inDevIdx )
884
+    if((rc = cmApBufSetup( ss->args.outDevIdx, ss->args.srate, ss->args.dspFramesPerCycle, ss->args.audioBufCnt, cmApDeviceChannelCount(ss->args.outDevIdx, true), ss->args.devFramesPerCycle, cmApDeviceChannelCount(ss->args.outDevIdx, false), ss->args.devFramesPerCycle )) != kOkRtRC )
885
+      return _cmRtError(p,kAudioBufSetupErrRtRC,"Audio buffer ouput device setup failed.");
824 886
 
825
-    // setup the input audio buffer ptr array - used to send input audio to the DSP system in _cmRtDspExecCallback()
826
-    if((cp->ctx.iChCnt   = cmApDeviceChannelCount(ss->args.inDevIdx, true)) != 0 )
827
-      cp->ctx.iChArray = cmMemAllocZ( cmSample_t*, cp->ctx.iChCnt );
887
+  // setup the output audio buffer ptr array - used to recv output audio from the DSP system in _cmRtDspExecCallback()
888
+  if((cp->ctx.oChCnt   = cmApDeviceChannelCount(ss->args.outDevIdx, false)) != 0 )
889
+    cp->ctx.oChArray = cmMemAllocZ( cmSample_t*, cp->ctx.oChCnt );
828 890
 
829
-    // setup the output device buffer
830
-    if( ss->args.outDevIdx != ss->args.inDevIdx )
831
-      if((rc = cmApBufSetup( ss->args.outDevIdx, ss->args.srate, ss->args.dspFramesPerCycle, ss->args.audioBufCnt, cmApDeviceChannelCount(ss->args.outDevIdx, true), ss->args.devFramesPerCycle, cmApDeviceChannelCount(ss->args.outDevIdx, false), ss->args.devFramesPerCycle )) != kOkRtRC )
832
-        return _cmRtError(p,kAudioBufSetupErrRtRC,"Audio buffer ouput device setup failed.");
891
+  // determine the sync source
892
+  cp->syncInputFl = ss->args.syncInputFl;
833 893
 
834
-    // setup the output audio buffer ptr array - used to recv output audio from the DSP system in _cmRtDspExecCallback()
835
-    if((cp->ctx.oChCnt   = cmApDeviceChannelCount(ss->args.outDevIdx, false)) != 0 )
836
-      cp->ctx.oChArray = cmMemAllocZ( cmSample_t*, cp->ctx.oChCnt );
894
+  // if sync'ing to an unavailable device then sync to the available device
895
+  if( ss->args.syncInputFl && cp->ctx.iChCnt == 0 )
896
+    cp->syncInputFl = false;
837 897
 
838
-    // determine the sync source
839
-    cp->syncInputFl = ss->args.syncInputFl;
898
+  if( ss->args.syncInputFl==false && cp->ctx.oChCnt == 0 )
899
+    cp->syncInputFl = true;
900
+    
901
+  // setup the status record
902
+  cp->status.hdr.rtSubIdx  = cp->ctx.rtSubIdx;
903
+  cp->status.iDevIdx   = ss->args.inDevIdx;
904
+  cp->status.oDevIdx   = ss->args.outDevIdx;
905
+  cp->status.iMeterCnt = cp->ctx.iChCnt;
906
+  cp->status.oMeterCnt = cp->ctx.oChCnt;
907
+  cp->iMeterArray      = cmMemAllocZ( double, cp->status.iMeterCnt );
908
+  cp->oMeterArray      = cmMemAllocZ( double, cp->status.oMeterCnt );
909
+  //cp->udpH             = cfg->udpH;
910
+
911
+  // create the real-time system thread
912
+  if((rc = cmThreadCreate( &cp->threadH, _cmRtThreadCallback, cp, ss->args.rpt )) != kOkThRC )
913
+  {
914
+    rc = _cmRtError(p,kThreadErrRtRC,"Thread create failed.");
915
+    goto errLabel;
916
+  }
917
+
918
+  // create the real-time system mutex
919
+  if((rc = cmThreadMutexCreate( &cp->engMutexH, ss->args.rpt )) != kOkThRC )
920
+  {
921
+    rc = _cmRtError(p,kMutexErrRtRC,"Thread mutex create failed.");
922
+    goto errLabel;
923
+  }
840 924
 
841
-    // if sync'ing to an unavailable device then sync to the available device
842
-    if( ss->args.syncInputFl && cp->ctx.iChCnt == 0 )
843
-      cp->syncInputFl = false;
925
+  // create the host-to-dsp thread safe msg queue 
926
+  if((rc = cmTsMp1cCreate( &cp->htdQueueH, ss->args.msgQueueByteCnt, ss->cbFunc, &cp->ctx, ss->args.rpt )) != kOkThRC )
927
+  {
928
+    rc = _cmRtError(p,kTsQueueErrRtRC,"Host-to-DSP msg queue create failed.");
929
+    goto errLabel;
930
+  }
844 931
 
845
-    if( ss->args.syncInputFl==false && cp->ctx.oChCnt == 0 )
846
-      cp->syncInputFl = true;
847
-    
848
-    // setup the status record
849
-    cp->status.hdr.rtSubIdx  = cp->ctx.rtSubIdx;
850
-    cp->status.iDevIdx   = ss->args.inDevIdx;
851
-    cp->status.oDevIdx   = ss->args.outDevIdx;
852
-    cp->status.iMeterCnt = cp->ctx.iChCnt;
853
-    cp->status.oMeterCnt = cp->ctx.oChCnt;
854
-    cp->iMeterArray      = cmMemAllocZ( double, cp->status.iMeterCnt );
855
-    cp->oMeterArray      = cmMemAllocZ( double, cp->status.oMeterCnt );
856
-    cp->udpH             = cfg->udpH;
857
-
858
-    // create the audio System thread
859
-    if((rc = cmThreadCreate( &cp->threadH, _cmRtThreadCallback, cp, ss->args.rpt )) != kOkThRC )
932
+  // create the dsp-to-host thread safe msg queue 
933
+  if( cmTsMp1cIsValid( p->dthQueH ) == false )
934
+  {
935
+    if((rc = cmTsMp1cCreate( &p->dthQueH, ss->args.msgQueueByteCnt, p->clientCbFunc, p->clientCbArg, ss->args.rpt )) != kOkThRC )
860 936
     {
861
-      rc = _cmRtError(p,kThreadErrRtRC,"Thread create failed.");
937
+      rc = _cmRtError(p,kTsQueueErrRtRC,"DSP-to-Host msg queue create failed.");
862 938
       goto errLabel;
863 939
     }
864
-
865
-    // create the audio System mutex
866
-    if((rc = cmThreadMutexCreate( &cp->engMutexH, ss->args.rpt )) != kOkThRC )
940
+  }
941
+    
942
+  // install an external MIDI port callback handler for incoming MIDI messages
943
+  if( cmMpIsInitialized() )
944
+    if( cmMpInstallCallback( -1, -1, _cmRtSysMidiCallback, cp ) != kOkMpRC )
867 945
     {
868
-      rc = _cmRtError(p,kMutexErrRtRC,"Thread mutex create failed.");
946
+      rc = _cmRtError(p,kMidiSysFailRtRC,"MIDI system callback installation failed.");
869 947
       goto errLabel;
870 948
     }
871 949
 
872
-    // create the host-to-dsp thread safe msg queue 
873
-    if((rc = cmTsMp1cCreate( &cp->htdQueueH, ss->args.msgQueueByteCnt, ss->cbFunc, &cp->ctx, ss->args.rpt )) != kOkThRC )
950
+  // setup the sub-system status notification 
951
+  cp->statusUpdateSmpCnt = floor(cmApBufMeterMs() * cp->ss.args.srate / 1000.0 );
952
+  cp->statusUpdateSmpIdx = 0;
953
+
954
+
955
+  // allocate the network mgr
956
+  if( cmRtNetAlloc(p->ctx,&cp->netH, _cmRtNetRecv, cp ) != kOkNetRC )
957
+  {
958
+    rc = _cmRtError(p,kNetErrRtRC,"Network allocation failed.");
959
+    goto errLabel;
960
+  }
961
+    
962
+  // register the local and remote notes
963
+  for(j=0; j<ss->netNodeCnt; ++j)
964
+  {
965
+    cmRtSysNetNode_t* nn = ss->netNodeArray + j;
966
+    if( cmRtNetCreateNode( cp->netH, nn->label, nn->ipAddr, nn->ipPort) != kOkNetRC )
874 967
     {
875
-      rc = _cmRtError(p,kTsQueueErrRtRC,"Host-to-DSP msg queue create failed.");
968
+      rc = _cmRtError(p,kNetErrRtRC,"Network node allocation failed on label:%s addr:%s port:%i.",cmStringNullGuard(nn->label),cmStringNullGuard(nn->ipAddr),nn->ipPort);
876 969
       goto errLabel;
877 970
     }
971
+  }
878 972
 
879
-    // create the dsp-to-host thread safe msg queue 
880
-    if( cmTsMp1cIsValid( p->dthQueH ) == false )
973
+  // register the local endpoints
974
+  for(j=0; j<ss->endptCnt; ++j)
975
+  {
976
+    cmRtSysNetEndpt_t* ep = ss->endptArray + j;
977
+    if( cmRtNetRegisterEndPoint( cp->netH, ep->label, ep->id ) != kOkNetRC )
881 978
     {
882
-      if((rc = cmTsMp1cCreate( &p->dthQueH, ss->args.msgQueueByteCnt, cfg->clientCbFunc, cfg->clientCbData, ss->args.rpt )) != kOkThRC )
883
-      {
884
-        rc = _cmRtError(p,kTsQueueErrRtRC,"DSP-to-Host msg queue create failed.");
885
-        goto errLabel;
886
-      }
979
+      rc = _cmRtError(p,kNetErrRtRC,"Network end point allocation failed on label:%s id:%i.",cmStringNullGuard(ep->label),ep->id);
980
+      goto errLabel;
887 981
     }
888
-    
889
-    //cp->dthQueueH = p->dthQueH;
982
+  }
890 983
 
891
-    // install an external MIDI port callback handler for incoming MIDI messages
892
-    if( cmMpIsInitialized() )
893
-      if( cmMpInstallCallback( -1, -1, _cmRtSysMidiCallback, cp ) != kOkMpRC )
894
-      {
895
-        rc = _cmRtError(p,kMidiSysFailRtRC,"MIDI system callback installation failed.");
896
-        goto errLabel;
897
-      }
984
+ errLabel:
985
+  if( rc != kOkRtRC )
986
+    _cmRtSysFinalize(p);
987
+
988
+return rc;
989
+}
898 990
 
899
-    // setup the sub-system status notification 
900
-    cp->statusUpdateSmpCnt = floor(cmApBufMeterMs() * cp->ss.args.srate / 1000.0 );
901
-    cp->statusUpdateSmpIdx = 0;
991
+cmRtRC_t cmRtSysEndCfg( cmRtSysH_t h )
992
+{
993
+  cmRtRC_t rc;
994
+  cmRt_t* p = _cmRtHandleToPtr(h);
995
+  unsigned i;
996
+
997
+  if((rc = _cmRtSysValidate(p)) != kOkRtRC )
998
+    goto errLabel;
999
+
1000
+
1001
+  for(i=0; i<p->ssCnt; ++i)
1002
+  {
1003
+    _cmRtCfg_t* cp = p->ssArray + i;
902 1004
 
903 1005
     cp->runFl = true;
904 1006
 
905
-    // start the audio System thread
1007
+    // start the real-time system thread
906 1008
     if( cmThreadPause( cp->threadH, 0 ) != kOkThRC )
907 1009
     {
908 1010
       rc = _cmRtError(p,kThreadErrRtRC,"Thread start failed.");
909 1011
       goto errLabel;
910 1012
     }
911
-  }
912
-
913
-
914
-  //_cmRtHostInitNotify(p);
915
-
916
-  for(i=0; i<p->ssCnt; ++i)
917
-  {
918
-    _cmRtCfg_t* cp = p->ssArray + i;
919 1013
 
920 1014
     // start the input device
921 1015
     if((rc = cmApDeviceStart( cp->ss.args.inDevIdx )) != kOkRtRC )
@@ -968,7 +1062,7 @@ cmRtRC_t _cmRtSysVerifyInit( cmRt_t* p, bool errFl )
968 1062
     // generate another message - just return the error
969 1063
     if( errFl )
970 1064
       if( cmErrLastRC(&p->err) != kNotInitRtRC )
971
-        cmErrMsg(&p->err,kNotInitRtRC,"The audio system is not initialized.");
1065
+        cmErrMsg(&p->err,kNotInitRtRC,"The real-time system is not initialized.");
972 1066
 
973 1067
     return kNotInitRtRC;
974 1068
   }
@@ -1024,6 +1118,7 @@ cmRtRC_t  cmRtSysDeliverSegMsg(  cmRtSysH_t h, const void* msgDataPtrArray[], un
1024 1118
   if( selId == kUiMstrSelRtId )
1025 1119
     return _cmRtHandleNonSubSysMsg( p, msgDataPtrArray, msgByteCntArray, msgSegCnt );
1026 1120
 
1121
+  /*
1027 1122
   if( selId == kNetSyncSelRtId )
1028 1123
   {
1029 1124
     assert( msgSegCnt==1); 
@@ -1032,6 +1127,7 @@ cmRtRC_t  cmRtSysDeliverSegMsg(  cmRtSysH_t h, const void* msgDataPtrArray[], un
1032 1127
     p->ssArray[rtSubIdx].ss.cbFunc(&p->ssArray[rtSubIdx].ctx,msgByteCntArray[0],msgDataPtrArray[0]);
1033 1128
     return kOkRtRC;
1034 1129
   }
1130
+  */
1035 1131
 
1036 1132
   return _cmRtEnqueueMsg(p,p->ssArray[rtSubIdx].htdQueueH,msgDataPtrArray,msgByteCntArray,msgSegCnt,"Host-to-DSP");  
1037 1133
 }
@@ -1314,19 +1410,17 @@ int _cmRtGetIntOpt( int argc, const char* argv[], const char* label, int default
1314 1410
 { return _cmRtGetOpt(argc,argv,label,defaultVal,false); }
1315 1411
 
1316 1412
 
1317
-void cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] )
1413
+void cmRtSysTest( cmCtx_t* ctx, int argc, const char* argv[] )
1318 1414
 {
1319
-  cmRtSysCfg_t    cfg;
1320 1415
   cmRtSysSubSys_t ss;
1321 1416
   cmRtSysH_t      h      = cmRtSysNullHandle;
1322 1417
   cmRtSysStatus_t status;
1323 1418
   _cmRtTestCbRecd    cbRecd = {1000.0,0,48000.0,0};
1324
-
1325
-  cfg.ssArray = &ss;
1326
-  cfg.ssCnt   = 1;
1327
-  //cfg.afpArray= NULL;
1328
-  //cfg.afpCnt  = 0;
1329
-  cfg.meterMs = 50;
1419
+  cmRpt_t* rpt = &ctx->rpt;
1420
+  
1421
+  unsigned meterMs = 50;
1422
+  unsigned ssCnt = 1;
1423
+  unsigned rtSubIdx = 0;
1330 1424
 
1331 1425
   if(_cmRtGetBoolOpt(argc,argv,"-h",false))
1332 1426
     _cmRtPrintUsage(rpt);
@@ -1343,8 +1437,8 @@ void cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] )
1343 1437
   ss.args.dspFramesPerCycle = _cmRtGetIntOpt( argc,argv,"-d",64);;
1344 1438
   ss.args.audioBufCnt       = _cmRtGetIntOpt( argc,argv,"-b",3);       
1345 1439
   ss.args.srate             = cbRecd.srate;
1346
-  ss.cbFunc                 = _cmRtTestCb;                            // set the DSP entry function
1347
-  ss.cbDataPtr              = &cbRecd;                                // set the DSP function argument record
1440
+  ss.cbFunc                 = _cmRtTestCb;  // set the DSP entry function
1441
+  ss.cbDataPtr              = &cbRecd;      // set the DSP function argument record
1348 1442
 
1349 1443
   cmRptPrintf(rpt,"in:%i out:%i syncFl:%i que:%i fpc:%i dsp:%i bufs:%i sr:%f\n",ss.args.inDevIdx,ss.args.outDevIdx,ss.args.syncInputFl,
1350 1444
     ss.args.msgQueueByteCnt,ss.args.devFramesPerCycle,ss.args.dspFramesPerCycle,ss.args.audioBufCnt,ss.args.srate);
@@ -1362,14 +1456,23 @@ void cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] )
1362 1456
   cmApReport(rpt);
1363 1457
 
1364 1458
   // initialize the audio buffer
1365
-  if( cmApBufInitialize( cmApDeviceCount(), cfg.meterMs ) != kOkApRC )
1459
+  if( cmApBufInitialize( cmApDeviceCount(), meterMs ) != kOkApRC )
1366 1460
     goto errLabel;
1367 1461
 
1368
-  // initialize the audio system
1369
-  if( cmRtSysAllocate(&h,rpt,&cfg) != kOkRtRC )
1462
+  // initialize the real-time system
1463
+  if( cmRtSysAllocate(&h,ctx) != kOkRtRC )
1370 1464
     goto errLabel;
1371
-  
1372
-  // start the audio system
1465
+
1466
+  if( cmRtSysBeginCfg(h,NULL,NULL,meterMs,ssCnt) != kOkRtRC )
1467
+    goto errLabel;
1468
+
1469
+  if( cmRtSysCfg(h,&ss,rtSubIdx) != kOkRtRC )
1470
+    goto errLabel;
1471
+    
1472
+  if( cmRtSysEndCfg(h) != kOkRtRC )
1473
+    goto errLabel;
1474
+
1475
+  // start the real-time system
1373 1476
   cmRtSysEnable(h,true);
1374 1477
 
1375 1478
   char c = 0;
@@ -1401,7 +1504,7 @@ void cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] )
1401 1504
       case 'n': ++_cmRtTestChIdx; printf("ch:%i\n",_cmRtTestChIdx); break;
1402 1505
 
1403 1506
       case 's':  
1404
-        // report the audio system status
1507
+        // report the real-time system status
1405 1508
         cmRtSysStatus(h,0,&status);
1406 1509
         printf("phs:%li cb count:%i (upd:%i wake:%i acb:%i msgs:%i)\n",cbRecd.phs, cbRecd.cbCnt, status.updateCnt, status.wakeupCnt, status.audioCbCnt, status.msgCbCnt);
1407 1510
         //printf("%f \n",status.oMeterArray[0]);
@@ -1444,14 +1547,14 @@ void cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] )
1444 1547
     //cmApBufReport(ss.args.rpt);
1445 1548
   }
1446 1549
 
1447
-  // stop the audio system
1550
+  // stop the real-time system
1448 1551
   cmRtSysEnable(h,false);
1449 1552
 
1450 1553
  
1451 1554
   goto exitLabel;
1452 1555
 
1453 1556
  errLabel:
1454
-  printf("AUDIO SYSTEM TEST ERROR\n");
1557
+  printf("REAL-TIME SYSTEM TEST ERROR\n");
1455 1558
 
1456 1559
  exitLabel:
1457 1560
 

+ 41
- 29
cmRtSys.h View File

@@ -79,7 +79,8 @@ extern "C" {
79 79
     kStateBufFailRtRC,
80 80
     kInvalidArgRtRC,
81 81
     kNotInitRtRC,
82
-    kTimeOutErrRtRC
82
+    kTimeOutErrRtRC,
83
+    kNetErrRtRC
83 84
   };
84 85
 
85 86
   enum
@@ -128,19 +129,33 @@ extern "C" {
128 129
   // The return value is currently not used.
129 130
   typedef cmRC_t (*cmRtCallback_t)(void* ctxPtr, unsigned msgByteCnt, const void* msgDataPtr );
130 131
 
132
+  // Network nodes
133
+  typedef struct 
134
+  {
135
+    const cmChar_t* label;    // Remote node label or NULL if this is the local node.
136
+    const cmChar_t* ipAddr;   // IP address in xxx.xxx.xxx.xxx form or NULL for 'localhost'.
137
+    cmUdpPort_t     ipPort;   // IP port 
138
+  } cmRtSysNetNode_t;
139
+
140
+  // Local endpoints.
141
+  typedef struct
142
+  {
143
+    const cmChar_t* label;   // Local endpoint label
144
+    unsigned        id;      // Local endpoint id
145
+  } cmRtSysNetEndpt_t;
131 146
   
132 147
   // Audio device sub-sytem configuration record 
133 148
   typedef struct cmRtSysArgs_str
134 149
   {
135
-    cmRpt_t*       rpt;               // system console object
136
-    unsigned       inDevIdx;          // input audio device
137
-    unsigned       outDevIdx;         // output audio device
138
-    bool           syncInputFl;       // true/false sync the DSP update callbacks with audio input/output
139
-    unsigned       msgQueueByteCnt;   // Size of the internal msg queue used to buffer msgs arriving via cmRtSysDeliverMsg().
140
-    unsigned       devFramesPerCycle; // (512) Audio device samples per channel per device update buffer.
141
-    unsigned       dspFramesPerCycle; // (64)  Audio samples per channel per DSP cycle.
142
-    unsigned       audioBufCnt;       // (3)   Audio device buffers.
143
-    double         srate;             // Audio sample rate.
150
+    cmRpt_t*        rpt;               // system console object
151
+    unsigned        inDevIdx;          // input audio device
152
+    unsigned        outDevIdx;         // output audio device
153
+    bool            syncInputFl;       // true/false sync the DSP update callbacks with audio input/output
154
+    unsigned        msgQueueByteCnt;   // Size of the internal msg queue used to buffer msgs arriving via cmRtSysDeliverMsg().
155
+    unsigned        devFramesPerCycle; // (512) Audio device samples per channel per device update buffer.
156
+    unsigned        dspFramesPerCycle; // (64)  Audio samples per channel per DSP cycle.
157
+    unsigned        audioBufCnt;       // (3)   Audio device buffers.
158
+    double          srate;             // Audio sample rate.
144 159
   } cmRtSysArgs_t;
145 160
 
146 161
   // Audio sub-system configuration record.
@@ -148,9 +163,13 @@ extern "C" {
148 163
   // via cmRtSystemAllocate() or cmRtSystemInitialize().
149 164
   typedef struct cmRtSysSubSys_str
150 165
   {
151
-    cmRtSysArgs_t    args;              // Audio device configuration
152
-    cmRtCallback_t   cbFunc;            // DSP system entry point function.
153
-    void*            cbDataPtr;         // Host provided data for the DSP system callback.   
166
+    cmRtSysArgs_t      args;              // Audio device configuration
167
+    cmRtCallback_t     cbFunc;            // DSP system entry point function.
168
+    void*              cbDataPtr;         // Host provided data for the DSP system callback.   
169
+    cmRtSysNetNode_t*  netNodeArray;      // One node must be the local node.
170
+    unsigned           netNodeCnt;        // Count of network nodes or 0 to not use network
171
+    cmRtSysNetEndpt_t* endptArray;        // Local end points
172
+    unsigned           endptCnt;          // Count of local endpoints.
154 173
   } cmRtSysSubSys_t;
155 174
 
156 175
 
@@ -187,19 +206,6 @@ extern "C" {
187 206
     
188 207
   } cmRtSysCtx_t;
189 208
 
190
-
191
-  // Audio system configuration record used by cmRtSysAllocate().
192
-  typedef struct cmRtSysCfg_str
193
-  {
194
-    cmRtSysSubSys_t*      ssArray;      // sub-system cfg record array
195
-    unsigned              ssCnt;        // count of sub-systems   
196
-    unsigned              meterMs;      // Meter sample period in milliseconds
197
-    void*                 clientCbData; // User arg. for clientCbFunc().
198
-    cmTsQueueCb_t         clientCbFunc; // Called by  cmRtSysReceiveMsg() to deliver internally generated msg's to the host. 
199
-                                        //  Set to NULL if msg's will be directly returned by buffers passed to cmRtSysReceiveMsg().
200
-    cmUdpH_t           udpH;
201
-  } cmRtSysCfg_t;
202
-
203 209
   extern cmRtSysH_t cmRtSysNullHandle;
204 210
 
205 211
   // Allocate and initialize an audio system as a collection of 'cfgCnt' sub-systems.
@@ -208,7 +214,7 @@ extern "C" {
208 214
   // (via cmMpInitialize()).  Note also that cmApFinalize() and cmMpFinalize() 
209 215
   // cannot be called prior to cmRtSysFree().
210 216
   // See cmRtSystemTest() for a complete example.
211
-  cmRtRC_t  cmRtSysAllocate( cmRtSysH_t* hp, cmRpt_t* rpt, const cmRtSysCfg_t* cfg  );
217
+  cmRtRC_t  cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx  );
212 218
 
213 219
   // Finalize and release any resources held by the audio system.
214 220
   cmRtRC_t  cmRtSysFree( cmRtSysH_t* hp );
@@ -217,10 +223,16 @@ extern "C" {
217 223
   // cmRtSysAllocate().
218 224
   bool      cmRtSysHandleIsValid( cmRtSysH_t h );
219 225
 
226
+  // clientCbFunc is Called by  cmRtSysReceiveMsg() to deliver internally generated msg's to the host. 
227
+  // Set to NULL if msg's will be directly returned by buffers passed to cmRtSysReceiveMsg().
228
+  cmRtRC_t  cmRtSysBeginCfg( cmRtSysH_t h, cmTsQueueCb_t clientCbFunc, void* clientCbArg, unsigned meterMs, unsigned ssCnt );
229
+
220 230
   // Reinitialize a previously allocated audio system.  This function
221 231
   // begins with a call to cmRtSysFinalize().   
222 232
   // Use cmRtSysEnable(h,true) to begin processing audio following this call.
223
-  cmRtRC_t  cmRtSysInitialize( cmRtSysH_t h, const cmRtSysCfg_t* cfg );
233
+  cmRtRC_t  cmRtSysCfg( cmRtSysH_t h, const cmRtSysSubSys_t* ss, unsigned rtSubIdx );
234
+
235
+  cmRtRC_t  cmRtSysEndCfg( cmRtSysH_t h );
224 236
 
225 237
   // Complements cmRtSysInitialize(). In general there is no need to call this function
226 238
   // since calls to cmRtSysInitialize() and cmRtSysFree() automaticatically call it.
@@ -303,7 +315,7 @@ extern "C" {
303 315
   unsigned cmRtSysSubSystemCount( cmRtSysH_t h );
304 316
 
305 317
   // Audio system test and example function.
306
-  void      cmRtSysTest( cmRpt_t* rpt, int argc, const char* argv[] );
318
+  void      cmRtSysTest( cmCtx_t* ctx, int argc, const char* argv[] );
307 319
 
308 320
 
309 321
 

Loading…
Cancel
Save