From e2a2295be6bcb5f842150d7d0b0a42d597e671ad Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Dec 2013 19:04:19 -0500 Subject: [PATCH] cmDspPgm.c : Added _cmDspSysPgm_SyncRecd to test the cmDspSyncRecd. --- dsp/cmDspPgm.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/dsp/cmDspPgm.c b/dsp/cmDspPgm.c index 8c27702..b235831 100644 --- a/dsp/cmDspPgm.c +++ b/dsp/cmDspPgm.c @@ -16,6 +16,7 @@ #include "cmThread.h" #include "cmUdpPort.h" #include "cmUdpNet.h" +#include "cmTime.h" #include "cmAudioSys.h" #include "cmProcObj.h" #include "cmDspCtx.h" @@ -25,6 +26,50 @@ #include "cmDspPgmPP.h" #include "cmDspPgmKr.h" +cmDspRC_t _cmDspSysPgm_SyncRecd( cmDspSysH_t h, void** userPtrPtr ) +{ + cmDspRC_t rc = kOkDspRC; + unsigned audioFileBits = 24; + + cmDspInst_t* ai0p = cmDspSysAllocInst(h,"AudioIn", NULL, 1, 0 ); + cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn", NULL, 1, 1 ); + cmDspInst_t* mip = cmDspSysAllocInst(h,"MidiIn", NULL, 0 ); + cmDspInst_t* srp = cmDspSysAllocInst(h,"SyncRecd",NULL, 3, "/home/kevin/temp/kr/sr","sr","audio",audioFileBits); + cmDspInst_t* am0p = cmDspSysAllocInst(h,"AMeter", "Left", 0); + cmDspInst_t* am1p = cmDspSysAllocInst(h,"AMeter", "Right",0); + cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut", NULL, 1, 0 ); + cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut", NULL, 1, 1 ); + + cmDspInst_t* chk = cmDspSysAllocInst(h,"Checkbox","recd", 5, "Recd","open","close", 1.0, 0.0); + cmDspInst_t* gain0 = cmDspSysAllocInst(h,"Scalar", "In Gain-0", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 ); + cmDspInst_t* gain1 = cmDspSysAllocInst(h,"Scalar", "In Gain-1", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 ); + + + // check for allocation errors + if((rc = cmDspSysLastRC(h)) != kOkDspRC ) + goto errLabel; + + cmDspSysInstallCb(h, mip, "status", srp, "status", NULL); + cmDspSysInstallCb(h, mip, "d0", srp, "d0", NULL); + cmDspSysInstallCb(h, mip, "d1", srp, "d1", NULL); + cmDspSysInstallCb(h, mip, "sec", srp, "sec", NULL); + cmDspSysInstallCb(h, mip, "nsec", srp, "nsec", NULL); + cmDspSysInstallCb(h, chk, "sym", srp, "cmd", NULL); + cmDspSysInstallCb(h, gain0, "val", ai0p, "gain", NULL); + cmDspSysInstallCb(h, gain1, "val", ai1p, "gain", NULL); + + cmDspSysConnectAudio(h, ai0p, "out", srp, "ain-0"); + cmDspSysConnectAudio(h, ai1p, "out", srp, "ain-1"); + cmDspSysConnectAudio(h, ai0p, "out", am0p, "in"); + cmDspSysConnectAudio(h, ai1p, "out", am1p, "in"); + cmDspSysConnectAudio(h, ai0p, "out", ao0p, "in"); + cmDspSysConnectAudio(h, ai1p, "out", ao1p, "in"); + + errLabel: + return rc; + +} + cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr ) { cmDspRC_t rc = kOkDspRC; @@ -203,7 +248,6 @@ cmDspRC_t _cmDspSysPgm_PlaySine( cmDspSysH_t h, void** userPtrPtr ) cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut", NULL, 1, useBuiltInFl ? 1 : 3 ); cmDspInst_t* om0p = cmDspSysAllocInst(h,"AMeter","Out", 0); - cmDspSysConnectAudio(h, php, "out", wtp, "phs" ); // phasor -> wave table cmDspSysConnectAudio(h, wtp, "out", ao0p, "in" ); // wave table -> audio out @@ -2543,6 +2587,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] = { "pickup tails", _cmDspSysPgm_NoiseTails, NULL, NULL }, { "tails_2", _cmDspSysPgm_NoiseTails2, NULL, NULL }, { "pickups", _cmDspSysPgm_Pickups0, NULL, NULL }, + { "sync_recd", _cmDspSysPgm_SyncRecd, NULL, NULL }, { "midi_test", _cmDspSysPgm_Test_Midi, NULL, NULL }, { "2_thru", _cmDspSysPgm_Stereo_Through, NULL, NULL }, { "guitar", _cmDspSysPgmGuitar, NULL, NULL },