Browse Source

cmAudioAggDev.c : Added AudioFileDevice and NRT device initialization to cmApAggTest()

(Could not get Soundflower and Traveller aggregate device to work.)
master
kevin 8 years ago
parent
commit
b04159ec47
1 changed files with 39 additions and 5 deletions
  1. 39
    5
      cmAudioAggDev.c

+ 39
- 5
cmAudioAggDev.c View File

@@ -6,6 +6,8 @@
6 6
 #include "cmMallocDebug.h"
7 7
 #include "cmTime.h"
8 8
 #include "cmAudioPort.h"
9
+#include "cmAudioPortFile.h"
10
+#include "cmAudioNrtDev.h"
9 11
 #include "cmAudioAggDev.h"
10 12
 #include "cmThread.h" // cmThUIntIncr()
11 13
 
@@ -710,6 +712,18 @@ unsigned _cmAggGlobalOutDevIdx = 0;
710 712
 void _cmApAggPortCb2( cmApAudioPacket_t* inPktArray, unsigned inPktCnt, cmApAudioPacket_t* outPktArray, unsigned outPktCnt )
711 713
 {
712 714
 
715
+  if( inPktCnt )
716
+  {
717
+    cmApAggPortTestRecd* r = (cmApAggPortTestRecd*)inPktArray[0].userCbPtr;
718
+    r->cbCnt += 1;
719
+  }
720
+
721
+  if( outPktCnt )
722
+  {
723
+    cmApAggPortTestRecd* r = (cmApAggPortTestRecd*)outPktArray[0].userCbPtr; 
724
+    r->cbCnt += 1;
725
+  }
726
+  
713 727
   cmApBufInputToOutput( _cmAggGlobalInDevIdx, _cmAggGlobalOutDevIdx );
714 728
 
715 729
   cmApBufUpdate( inPktArray, inPktCnt, outPktArray, outPktCnt );
@@ -748,7 +762,7 @@ int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] )
748 762
   r.outDevIdx  =  _cmAggGlobalOutDevIdx = _cmApAggGetOpt(argc,argv,"-o",2,false); 
749 763
   r.phase      = 0;
750 764
   r.frqHz      = 2000;
751
-  r.srate      = 44100;
765
+  r.srate      = 96000;
752 766
   r.bufInIdx   = 0;
753 767
   r.bufOutIdx  = 0;
754 768
   r.bufFullCnt = 0;
@@ -779,8 +793,22 @@ int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] )
779 793
     return 1;
780 794
   }
781 795
 
796
+  // allocate the audio file device system
797
+  if( cmApFileAllocate( rpt ) != kOkApRC )
798
+  {
799
+    cmRptPrintf(rpt,"The audio file device system allocation failed.\n");
800
+    goto doneLabel;
801
+  }
802
+
803
+  // allocate the NRT device system
804
+  if( cmApNrtAllocate(rpt) != kOkApRC )
805
+  {
806
+    cmRptPrintf(rpt,"The NRT audio device system allocation failed.\n");
807
+    goto doneLabel;
808
+  }
809
+
782 810
 
783
-  unsigned physDevIdxArray[] = { 0, 1 };
811
+  unsigned physDevIdxArray[] = { 2, 4 };
784 812
   unsigned physDevCnt = sizeof(physDevIdxArray)/sizeof(physDevIdxArray[0]);
785 813
   if( cmApAggCreateDevice("aggdev",physDevCnt,physDevIdxArray,kInAggFl | kOutAggFl) != kOkAgRC )
786 814
   {
@@ -851,9 +879,9 @@ int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] )
851 879
       }
852 880
     }
853 881
 
854
-    cmApBufEnableChannel(r.inDevIdx, -1, kInApFl | kEnableApFl );
882
+    cmApBufEnableChannel(r.inDevIdx,  -1, kInApFl  | kEnableApFl );
855 883
     cmApBufEnableChannel(r.outDevIdx, -1, kOutApFl | kEnableApFl );
856
-    cmApBufEnableMeter(r.inDevIdx, -1, kInApFl | kEnableApFl );
884
+    cmApBufEnableMeter(  r.inDevIdx,  -1, kInApFl  | kEnableApFl );
857 885
 
858 886
     cmRptPrintf(rpt,"q=quit O/o output tone, I/i input tone P/p pass\n");
859 887
     char c;
@@ -870,7 +898,7 @@ int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] )
870 898
 
871 899
         case 'o':
872 900
         case 'O':
873
-          cmApBufEnableTone(r.outDevIdx,-1,kOutApFl | (c=='O'?kEnableApFl:0));
901
+          cmApBufEnableTone(r.outDevIdx,2,kOutApFl | (c=='O'?kEnableApFl:0));
874 902
           break;
875 903
 
876 904
         case 'p':
@@ -926,6 +954,12 @@ int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] )
926 954
   if( cmApFinalize() != kOkApRC )
927 955
     cmRptPrintf(rpt,"Finalize failed.\n");
928 956
 
957
+  if( cmApNrtFree() != kOkApRC )
958
+    cmRptPrintf(rpt,"Audio NRT device system free failed.");
959
+  
960
+  if( cmApFileFree() != kOkApRC )
961
+    cmRptPrintf(rpt,"Audio file device system free failed.");
962
+  
929 963
   if( cmApAggFree() != kOkAgRC )
930 964
     cmRptPrintf(rpt,"Agg device system free failed.");
931 965
 

Loading…
Cancel
Save