Просмотр исходного кода

cmDspPgm.c:Added _cmDspSysPgm_RsrcWr() and update _cmDspSysPreset() to use Menu Buttons and Message Lists.

master
kevin 11 лет назад
Родитель
Сommit
826eec51b4
1 измененных файлов: 33 добавлений и 2 удалений
  1. 33
    2
      dsp/cmDspPgm.c

+ 33
- 2
dsp/cmDspPgm.c Просмотреть файл

@@ -2182,7 +2182,8 @@ cmDspRC_t _cmDspSysPgm_Preset( cmDspSysH_t h, void** userPtrPtr )
2182 2182
   cmDspInst_t* sg  = cmDspSysAllocInst(   h, "SigGen",    NULL, 3, sgHz, sgShapeId, sgGain );
2183 2183
   cmDspInst_t* ao  =  cmDspSysAllocAudioOut( h, 0, 1.0 );
2184 2184
   
2185
-  cmDspInst_t* shape  = cmDspSysAllocScalarP( h, grpSymId, prefixLabel, "Shape",     0.0, 3.0,     1.0,  sgShapeId);
2185
+  cmDspInst_t* shapes = cmDspSysAllocMsgListP(h, grpSymId, prefixLabel, "Shape", NULL, "shapeList", 0 );
2186
+  cmDspInst_t* gains  = cmDspSysAllocMsgListP(h, grpSymId, prefixLabel, "Gains", NULL, "gainMenu", 0 );
2186 2187
   cmDspInst_t* hz     = cmDspSysAllocScalarP( h, grpSymId, prefixLabel, "Hz",        0.0, 10000.0, 0.01, sgHz);
2187 2188
   cmDspInst_t* gain   = cmDspSysAllocScalarP( h, grpSymId, prefixLabel, "Gain",      0.0, 1.0,     0.01, sgGain);
2188 2189
   
@@ -2196,9 +2197,10 @@ cmDspRC_t _cmDspSysPgm_Preset( cmDspSysH_t h, void** userPtrPtr )
2196 2197
     goto errLabel;
2197 2198
 
2198 2199
   cmDspSysConnectAudio(h, sg,    "out", ao, "in" );
2199
-  cmDspSysInstallCb(   h, shape, "val", sg, "shape", NULL );
2200
+  cmDspSysInstallCb(   h, shapes,"out", sg, "shape", NULL );
2200 2201
   cmDspSysInstallCb(   h, hz,    "val", sg, "hz",    NULL );
2201 2202
   cmDspSysInstallCb(   h, gain,  "val", sg, "gain",  NULL );
2203
+  cmDspSysInstallCb(   h, gains, "out", gain, "val",  NULL );
2202 2204
   
2203 2205
   cmDspSysInstallCb(   h, presetLbl, "val", preset, "label",NULL);
2204 2206
   cmDspSysInstallCb(   h, storeBtn,  "sym", preset, "cmd", NULL );
@@ -2207,6 +2209,34 @@ cmDspRC_t _cmDspSysPgm_Preset( cmDspSysH_t h, void** userPtrPtr )
2207 2209
   return rc;
2208 2210
 }
2209 2211
 
2212
+cmDspRC_t _cmDspSysPgm_RsrcWr( cmDspSysH_t h, void** userPtrPtr )
2213
+{
2214
+  cmDspRC_t    rc      = kOkDspRC;
2215
+
2216
+  const cmChar_t* lbl1 = "rsrc1";
2217
+  const cmChar_t* lbl2 = "rsrc2";
2218
+  const cmChar_t* str1 = NULL;
2219
+  const cmChar_t* str2 = NULL;
2220
+
2221
+  if( cmDspRsrcString(h,&str1, lbl1, NULL ) != kOkDspRC )
2222
+    str1 = "1";
2223
+
2224
+  if( cmDspRsrcString(h,&str2, lbl2, NULL ) != kOkDspRC )
2225
+    str2 = "2";
2226
+
2227
+  cmDspInst_t* rsrcWr  = cmDspSysAllocInst( h, "RsrcWr", NULL,    2, lbl1, lbl2 );
2228
+  cmDspInst_t* textUi0 = cmDspSysAllocInst( h, "Text",   "Value1",      1, str1 );
2229
+  cmDspInst_t* textUi1 = cmDspSysAllocInst( h, "Text",   "Value2",      1, str2 );
2230
+
2231
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
2232
+    goto errLabel;
2233
+
2234
+  cmDspSysInstallCb( h, textUi0, "val", rsrcWr, "rsrc1", NULL );
2235
+  cmDspSysInstallCb( h, textUi1, "val", rsrcWr, "rsrc2", NULL );
2236
+
2237
+ errLabel:
2238
+  return rc;
2239
+}
2210 2240
 
2211 2241
 cmDspRC_t _cmDspSysPgm_1Up( cmDspSysH_t h, void** userPtrPtr )
2212 2242
 {
@@ -2407,6 +2437,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] =
2407 2437
   { "1Up",           _cmDspSysPgm_1Up,          NULL, NULL },
2408 2438
   { "PortToSym",     _cmDspSysPgm_PortToSym,    NULL, NULL },
2409 2439
   { "preset",        _cmDspSysPgm_Preset,       NULL, NULL },
2440
+  { "rsrcWr",        _cmDspSysPgm_RsrcWr,       NULL, NULL },
2410 2441
   { "router",        _cmDspSysPgm_Router,       NULL, NULL },
2411 2442
   { "1ofN",          _cmDspSysPgm_1ofN,         NULL, NULL },
2412 2443
   { "NofM",          _cmDspSysPgm_NofM,         NULL, NULL },

Загрузка…
Отмена
Сохранить