瀏覽代碼

cmDspPgmKr.c Load time-line program static information from the pgm resource file.

master
kevin 12 年之前
父節點
當前提交
a0dcef606d
共有 1 個文件被更改,包括 35 次插入6 次删除
  1. 35
    6
      dsp/cmDspPgmKr.c

+ 35
- 6
dsp/cmDspPgmKr.c 查看文件

@@ -33,24 +33,53 @@
33 33
 #include "cmVectOpsTemplateMain.h"
34 34
 #include "cmVectOps.h"
35 35
 
36
+typedef struct
37
+{
38
+  const cmChar_t* tlFn;
39
+  const cmChar_t* audPath;
40
+  const cmChar_t* scFn;
41
+  
42
+} krRsrc_t;
43
+
44
+cmDspRC_t krLoadRsrc(cmDspSysH_t h, cmErr_t* err, krRsrc_t* r)
45
+{
46
+  cmDspRC_t rc;
47
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
48
+    return rc;
49
+
50
+  cmDspRsrcString(h,&r->tlFn,   "timeLineFn",      NULL);
51
+  cmDspRsrcString(h,&r->audPath,"tlAudioFilePath", NULL);
52
+  cmDspRsrcString(h,&r->scFn,   "scoreFn",         NULL);
53
+
54
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
55
+    cmErrMsg(err,rc,"A KR DSP resource load failed.");
56
+    
57
+  return rc;
58
+}
36 59
 
37 60
 cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
38 61
 {
39 62
   cmDspRC_t       rc         = kOkDspRC;
40
-  const cmChar_t* tlFn       = "/home/kevin/src/cmgv/src/gv/data/tl7.js";
41
-  const cmChar_t* audPath    = "/home/kevin/media/audio/20110723-Kriesberg/Audio Files";
42
-  const cmChar_t* scFn       = "/home/kevin/src/cmgv/src/gv/data/mod2b.txt";
63
+  cmCtx_t*        cmCtx      = cmDspSysPgmCtx(h);
64
+  cmErr_t         err;
65
+  krRsrc_t        r;
43 66
   unsigned        wtLoopCnt  = 1;                            // play once (do not loop)
44 67
   unsigned        wtInitMode = 0;                            // initial wt mode is 'silence'
45 68
   unsigned        wtSmpCnt   = floor(cmDspSysSampleRate(h)); // wt length == srate
46 69
 
47
-  cmDspInst_t* tlp  = cmDspSysAllocInst(h,"TimeLine",    "tl",  2, tlFn, audPath );
48
-  cmDspInst_t* scp  = cmDspSysAllocInst(h,"Score",       "sc",  1, scFn );
70
+  memset(&r,0,sizeof(r));
71
+  cmErrSetup(&err,&cmCtx->rpt,"Kr Timeline");
72
+
73
+  if( krLoadRsrc(h,&err,&r) != kOkDspRC )
74
+    return rc;
75
+
76
+  cmDspInst_t* tlp  = cmDspSysAllocInst(h,"TimeLine",    "tl",  2, r.tlFn, r.audPath );
77
+  cmDspInst_t* scp  = cmDspSysAllocInst(h,"Score",       "sc",  1, r.scFn );
49 78
   cmDspInst_t* php  = cmDspSysAllocInst(h,"Phasor",      NULL,  0 );
50 79
   cmDspInst_t* wtp  = cmDspSysAllocInst(h,"WaveTable",   NULL,  4, wtSmpCnt, wtInitMode, NULL, wtLoopCnt );
51 80
   cmDspInst_t* pts  = cmDspSysAllocInst(h,"PortToSym",   NULL,  2, "on", "off" );
52 81
   cmDspInst_t* mfp  = cmDspSysAllocInst(h,"MidiFilePlay",NULL,  0 );
53
-  cmDspInst_t* sfp  = cmDspSysAllocInst(h,"ScFol",       NULL,  1, scFn );
82
+  cmDspInst_t* sfp  = cmDspSysAllocInst(h,"ScFol",       NULL,  1, r.scFn );
54 83
   cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",    NULL,  1, 0 );
55 84
   cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",    NULL,  1, 1 );
56 85
 

Loading…
取消
儲存