Преглед изворни кода

cmDspPgm.c : Added _cmDspSysPgm_SyncRecd to test the cmDspSyncRecd.

master
kevin пре 11 година
родитељ
комит
e2a2295be6
1 измењених фајлова са 46 додато и 1 уклоњено
  1. 46
    1
      dsp/cmDspPgm.c

+ 46
- 1
dsp/cmDspPgm.c Прегледај датотеку

@@ -16,6 +16,7 @@
16 16
 #include "cmThread.h"
17 17
 #include "cmUdpPort.h"
18 18
 #include "cmUdpNet.h"
19
+#include "cmTime.h"
19 20
 #include "cmAudioSys.h"
20 21
 #include "cmProcObj.h"
21 22
 #include "cmDspCtx.h"
@@ -25,6 +26,50 @@
25 26
 #include "cmDspPgmPP.h"
26 27
 #include "cmDspPgmKr.h"
27 28
 
29
+cmDspRC_t _cmDspSysPgm_SyncRecd(  cmDspSysH_t h, void** userPtrPtr )
30
+{
31
+  cmDspRC_t rc = kOkDspRC;
32
+  unsigned audioFileBits = 24;
33
+  
34
+  cmDspInst_t* ai0p   = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 0 );
35
+  cmDspInst_t* ai1p   = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 1 );
36
+  cmDspInst_t* mip    = cmDspSysAllocInst(h,"MidiIn",  NULL,   0 );
37
+  cmDspInst_t* srp    = cmDspSysAllocInst(h,"SyncRecd",NULL,   3, "/home/kevin/temp/kr/sr","sr","audio",audioFileBits);
38
+  cmDspInst_t* am0p   = cmDspSysAllocInst(h,"AMeter",  "Left", 0);
39
+  cmDspInst_t* am1p   = cmDspSysAllocInst(h,"AMeter",  "Right",0);
40
+  cmDspInst_t* ao0p   = cmDspSysAllocInst(h,"AudioOut", NULL,  1, 0 );
41
+  cmDspInst_t* ao1p   = cmDspSysAllocInst(h,"AudioOut", NULL,  1, 1 );
42
+
43
+  cmDspInst_t* chk    = cmDspSysAllocInst(h,"Checkbox","recd", 5, "Recd","open","close", 1.0, 0.0);
44
+  cmDspInst_t* gain0 = cmDspSysAllocInst(h,"Scalar", "In Gain-0",    5, kNumberDuiId, 0.0,   10.0,0.01,   1.0 );  
45
+  cmDspInst_t* gain1 = cmDspSysAllocInst(h,"Scalar", "In Gain-1",    5, kNumberDuiId, 0.0,   10.0,0.01,   1.0 );  
46
+
47
+  
48
+  // check for allocation errors
49
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
50
+    goto errLabel;
51
+
52
+  cmDspSysInstallCb(h, mip,   "status", srp, "status", NULL);
53
+  cmDspSysInstallCb(h, mip,   "d0",     srp, "d0",     NULL);
54
+  cmDspSysInstallCb(h, mip,   "d1",     srp, "d1",     NULL);
55
+  cmDspSysInstallCb(h, mip,   "sec",    srp, "sec",    NULL);
56
+  cmDspSysInstallCb(h, mip,   "nsec",   srp, "nsec",   NULL);
57
+  cmDspSysInstallCb(h, chk,   "sym",    srp, "cmd",    NULL);
58
+  cmDspSysInstallCb(h, gain0, "val",   ai0p, "gain",   NULL);
59
+  cmDspSysInstallCb(h, gain1, "val",   ai1p, "gain",   NULL);
60
+
61
+  cmDspSysConnectAudio(h, ai0p, "out", srp,  "ain-0");
62
+  cmDspSysConnectAudio(h, ai1p, "out", srp,  "ain-1");
63
+  cmDspSysConnectAudio(h, ai0p, "out", am0p, "in");
64
+  cmDspSysConnectAudio(h, ai1p, "out", am1p, "in");
65
+  cmDspSysConnectAudio(h, ai0p, "out", ao0p, "in");
66
+  cmDspSysConnectAudio(h, ai1p, "out", ao1p, "in");
67
+
68
+ errLabel:
69
+  return rc;
70
+
71
+}
72
+
28 73
 cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
29 74
 {
30 75
   cmDspRC_t rc = kOkDspRC;
@@ -203,7 +248,6 @@ cmDspRC_t _cmDspSysPgm_PlaySine( cmDspSysH_t h, void** userPtrPtr )
203 248
   cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",  NULL,   1, useBuiltInFl ? 1 : 3 );
204 249
   cmDspInst_t* om0p = cmDspSysAllocInst(h,"AMeter","Out", 0);
205 250
   
206
-  
207 251
 
208 252
   cmDspSysConnectAudio(h, php, "out", wtp,  "phs" );  // phasor -> wave table
209 253
   cmDspSysConnectAudio(h, wtp, "out", ao0p, "in" );   // wave table -> audio out
@@ -2543,6 +2587,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] =
2543 2587
   { "pickup tails", _cmDspSysPgm_NoiseTails,    NULL, NULL },
2544 2588
   { "tails_2",      _cmDspSysPgm_NoiseTails2,   NULL, NULL },
2545 2589
   { "pickups",     _cmDspSysPgm_Pickups0,       NULL, NULL },
2590
+  { "sync_recd",   _cmDspSysPgm_SyncRecd,       NULL, NULL },
2546 2591
   { "midi_test",   _cmDspSysPgm_Test_Midi,      NULL, NULL },
2547 2592
   { "2_thru",      _cmDspSysPgm_Stereo_Through, NULL, NULL },
2548 2593
   { "guitar",      _cmDspSysPgmGuitar,          NULL, NULL },

Loading…
Откажи
Сачувај