소스 검색

cmDspPgmKr.c : Added audio output file record and MIDI output port.

master
kevin 11 년 전
부모
커밋
0f75ad445c
1개의 변경된 파일38개의 추가작업 그리고 3개의 파일을 삭제
  1. 38
    3
      dsp/cmDspPgmKr.c

+ 38
- 3
dsp/cmDspPgmKr.c 파일 보기

@@ -40,6 +40,7 @@ typedef struct
40 40
   const cmChar_t* scFn;
41 41
   const cmChar_t* modFn;
42 42
   const cmChar_t* measFn;
43
+  const cmChar_t* recordDir;
43 44
 } krRsrc_t;
44 45
 
45 46
 cmDspRC_t krLoadRsrc(cmDspSysH_t h, cmErr_t* err, krRsrc_t* r)
@@ -53,6 +54,7 @@ cmDspRC_t krLoadRsrc(cmDspSysH_t h, cmErr_t* err, krRsrc_t* r)
53 54
   cmDspRsrcString(h,&r->scFn,   "scoreFn",         NULL);
54 55
   cmDspRsrcString(h,&r->modFn,  "modFn",           NULL);
55 56
   cmDspRsrcString(h,&r->measFn, "measFn",          NULL);
57
+  cmDspRsrcString(h,&r->recordDir,"recordDir",     NULL);
56 58
 
57 59
   if((rc = cmDspSysLastRC(h)) != kOkDspRC )
58 60
     cmErrMsg(err,rc,"A KR DSP resource load failed.");
@@ -1439,6 +1441,19 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1439 1441
   cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod",       NULL,  2, r.modFn, "m1" );
1440 1442
   cmDspInst_t* asp  = cmDspSysAllocInst(h,"AmSync",      NULL,  0 );
1441 1443
 
1444
+
1445
+  /*
1446
+  const cmChar_t* deviceName = "Fastlane";
1447
+  const cmChar_t* portName   = "Fastlane MIDI A";
1448
+
1449
+#ifdef OS_OSX
1450
+  deviceName = "RME - Fireface UFX (23148636)";
1451
+  portName   = "Port 2";
1452
+#endif
1453
+
1454
+  cmDspInst_t* mop  = cmDspSysAllocInst( h,"MidiOut", NULL,     2, deviceName, portName);
1455
+  */
1456
+
1442 1457
   cmDspInst_t* achan0      = cmDspSysAllocInst(h, "AvailCh",     NULL, 1, xfadeChCnt );
1443 1458
   cmDspInst_t* achan1      = cmDspSysAllocInst(h, "AvailCh",     NULL, 1, xfadeChCnt );
1444 1459
 
@@ -1496,7 +1511,6 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1496 1511
   cmDspInst_t* cmp1 =  cmDspSysAllocInst(h,"Compressor", NULL,   8, cmpBypassFl, cmpThreshDb, cmpRatio_num, cmpAtkMs, cmpRlsMs, cmpMakeup, cmpWndMs, cmpWndMaxMs ); 
1497 1512
   cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",    NULL,   1, 1 );
1498 1513
 
1499
-  //cmDspInst_t* af0p = cmDspSysAllocInst(h,"AudioFileOut",NULL,  2, "/home/kevin/temp/debug0.wav",1);
1500 1514
 
1501 1515
   cmDspSysNewPage(h,"Controls");
1502 1516
   cmDspInst_t* onb  = cmDspSysAllocInst(h,"Button", "start",  2, kButtonDuiId, 1.0 );
@@ -1579,7 +1593,18 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1579 1593
   cmDspInst_t* ogain1 = cmDspSysAllocInst(h,"Scalar", "Out Gain-1",   5, kNumberDuiId, 0.0,   10.0,0.01,   3.0 );  
1580 1594
   cmDspInst_t* xfadMs = cmDspSysAllocInst(h,"Scalar", "Xfade Ms",     5, kNumberDuiId, 0.0,   1000.0,0.01, 50.0 );  
1581 1595
 
1582
-  //cmDspInst_t* reload = cmDspSysAllocInst(h,"Button", "Reload",     2, kButtonDuiId, 0.0 );
1596
+  // Audio file recording
1597
+  cmDspInst_t* recdGain= cmDspSysAllocInst(h,"Scalar", "Recd Gain", 5, kNumberDuiId, 0.0,   100.0,0.01, 1.5 );  
1598
+  cmDspInst_t* recdChk = cmDspSysAllocInst(h,"Button", "Record",     2, kCheckDuiId, 0.0 );
1599
+  cmDspInst_t* recdPtS = cmDspSysAllocInst(h,"GateToSym", NULL,      2, cmSymTblRegisterStaticSymbol(cmDspSysSymbolTable(h),"open"),cmSymTblRegisterStaticSymbol(cmDspSysSymbolTable(h),"close"));
1600
+  cmDspInst_t* afop    = cmDspSysAllocInst(h,"AudioFileOut",NULL,    2, r.recordDir,2);
1601
+  
1602
+  cmDspSysInstallCb(h, recdGain,"val", afop, "gain0", NULL );
1603
+  cmDspSysInstallCb(h, recdGain,"val", afop, "gain1", NULL );
1604
+  cmDspSysInstallCb(h, recdChk, "out", recdPtS, "on", NULL );
1605
+  cmDspSysInstallCb(h, recdChk, "out", recdPtS, "off", NULL );
1606
+  cmDspSysInstallCb(h, recdPtS, "out", afop,    "sel", NULL );
1607
+
1583 1608
 
1584 1609
   cmDspSysNewPage(h,"Sc/Rgn");
1585 1610
 
@@ -1668,6 +1693,9 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1668 1693
   cmDspSysConnectAudio(h, mix1, "out",   cmp1, "in");
1669 1694
   cmDspSysConnectAudio(h, cmp1, "out",   ao1p, "in" );   // comp -> aout
1670 1695
 
1696
+  cmDspSysConnectAudio(h, cmp0, "out", afop, "in0" );  // comp -> audio_file_out
1697
+  cmDspSysConnectAudio(h, cmp1, "out", afop, "in1" );
1698
+
1671 1699
   // wave-table to time-line cursor
1672 1700
   cmDspSysInstallCb(   h, wtp, "fidx",tlp,  "curs", NULL); 
1673 1701
 
@@ -1714,6 +1742,12 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1714 1742
   cmDspSysInstallCb(h, mfp, "d0",     sfp, "d0",     NULL );
1715 1743
   cmDspSysInstallCb(h, mfp, "status", sfp, "status", NULL );
1716 1744
 
1745
+  /*
1746
+  cmDspSysInstallCb(h, mfp, "d1",     mop, "d1",     NULL );
1747
+  cmDspSysInstallCb(h, mfp, "d0",     mop, "d0",     NULL );
1748
+  cmDspSysInstallCb(h, mfp, "status", mop, "status", NULL );
1749
+  */
1750
+
1717 1751
   // score follower to modulator and printers
1718 1752
   cmDspSysInstallCb(h, sfp, "out",  modp,    "index", NULL );
1719 1753
   cmDspSysInstallCb(h, sfp, "out",  prp,     "in",  NULL );
@@ -1774,7 +1808,6 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1774 1808
   cmDspSysInstallCb(h, modp, "minl0", min_lwr_0, "val", NULL );
1775 1809
   cmDspSysInstallCb(h, modp, "maxl0", max_lwr_0, "val", NULL );
1776 1810
 
1777
-
1778 1811
   cmDspSysInstallCb(h, modp, "mod1",  md10p, "val", NULL );
1779 1812
   cmDspSysInstallCb(h, modp, "thr1",  th10p, "val", NULL );
1780 1813
   cmDspSysInstallCb(h, modp, "upr1",  us10p, "val", NULL );
@@ -1786,6 +1819,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
1786 1819
   cmDspSysInstallCb(h, modp, "minl1", min_lwr_1, "val", NULL );
1787 1820
   cmDspSysInstallCb(h, modp, "maxl1", max_lwr_1, "val", NULL );
1788 1821
 
1822
+  cmDspSysInstallCb(h, modp, "xfad",  xfadMs, "val", NULL );
1823
+
1789 1824
   // =========================================================================
1790 1825
   //  Cross fade connections for measurments
1791 1826
   //

Loading…
취소
저장