Selaa lähdekoodia

cmDspClass.h/c, cmDspUI.c : Added 'ptr' type variables.

Added TakeSeqBldr/Rndr UI allocator functions.
master
Kevin Larke 9 vuotta sitten
vanhempi
commit
59cec07cce
3 muutettua tiedostoa jossa 51 lisäystä ja 4 poistoa
  1. 20
    0
      dsp/cmDspClass.c
  2. 4
    1
      dsp/cmDspClass.h
  3. 27
    3
      dsp/cmDspUi.c

+ 20
- 0
dsp/cmDspClass.c Näytä tiedosto

@@ -764,6 +764,15 @@ cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId )
764 764
   return cmDsvGetReal(vp); 
765 765
 }
766 766
 
767
+void* cmDspPtr( cmDspInst_t* inst, unsigned varId )
768
+{
769
+  cmDspValue_t* vp;
770
+  if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC )
771
+    return NULL;
772
+
773
+  return cmDsvPtr(vp);
774
+}
775
+
767 776
 const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId )
768 777
 {
769 778
   cmDspValue_t* vp;
@@ -924,6 +933,10 @@ cmDspRC_t   cmDspValueSet( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, c
924 933
       cmDsvSetReal(dvp, cmDsvGetReal(svp));
925 934
       break;
926 935
 
936
+    case kPtrDsvFl:
937
+      cmDsvSetPtr(dvp, cmDsvGetPtr(svp));
938
+      break;
939
+
927 940
     case kSymDsvFl:
928 941
       cmDsvSetSymbol(dvp, cmDsvGetSymbol(svp));
929 942
       break;
@@ -1184,6 +1197,13 @@ cmDspRC_t  cmDspSetReal(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId,
1184 1197
   return cmDspValueSet(ctx, inst, varId, &v, 0);
1185 1198
 }
1186 1199
 
1200
+cmDspRC_t  cmDspSetPtr(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, void* val )
1201
+{ 
1202
+  cmDspValue_t v;
1203
+  cmDsvSetPtr(&v,val);
1204
+  return cmDspValueSet(ctx, inst, varId, &v, 0);
1205
+}
1206
+
1187 1207
 cmDspRC_t  cmDspSetStrcz(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val )
1188 1208
 { 
1189 1209
   cmDspValue_t v;

+ 4
- 1
dsp/cmDspClass.h Näytä tiedosto

@@ -271,6 +271,7 @@ extern "C" {
271 271
   double          cmDspDouble( cmDspInst_t* inst, unsigned varId );
272 272
   cmSample_t      cmDspSample( cmDspInst_t* inst, unsigned varId );
273 273
   cmReal_t        cmDspReal(   cmDspInst_t* inst, unsigned varId );
274
+  void*           cmDspPtr(    cmDspInst_t* inst, unsigned varId );
274 275
   const cmChar_t* cmDspStrcz(   cmDspInst_t* inst, unsigned varId );
275 276
   unsigned        cmDspSymbol( cmDspInst_t* inst, unsigned varId );
276 277
   cmJsonNode_t*   cmDspJson(   cmDspInst_t* inst, unsigned varId );
@@ -346,6 +347,7 @@ extern "C" {
346 347
   cmDspRC_t   cmDspSetDouble(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double          val );
347 348
   cmDspRC_t   cmDspSetSample(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t      val );
348 349
   cmDspRC_t   cmDspSetReal(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t        val );
350
+  cmDspRC_t   cmDspSetPtr(           cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, void*           val );
349 351
   cmDspRC_t   cmDspSetStrcz(         cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val );
350 352
   cmDspRC_t   cmDspSetSymbol(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned        val );
351 353
   cmDspRC_t   cmDspSetJson(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t*   val );
@@ -401,7 +403,8 @@ extern "C" {
401 403
   cmDspRC_t  cmDspUiLabelCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId,  unsigned alignVarId );
402 404
   cmDspRC_t  cmDspUiTimeLineCreate(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId,  unsigned audPathVarId, unsigned selVarId, unsigned cursVarId );
403 405
   cmDspRC_t  cmDspUiScoreCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx );
404
-  cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId );
406
+  cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId );
407
+  cmDspRC_t  cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId,      unsigned refreshVarId, unsigned selVarId  );
405 408
 
406 409
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
407 410
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

+ 27
- 3
dsp/cmDspUi.c Näytä tiedosto

@@ -415,20 +415,44 @@ cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFi
415 415
   return rc;
416 416
 }
417 417
 
418
-cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId )
418
+cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId )
419 419
 {
420 420
   cmDspRC_t    rc;
421
-  unsigned     arr[] = { fileNameVarId  };
421
+  unsigned     arr[] = { fileNameVarId, ptrVarId, selVarId, refreshVarId  };
422 422
   cmDspValue_t v;
423 423
   unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
424 424
   cmDsvSetUIntMtx(&v,arr,vn,1);
425 425
 
426
-  // tell the UI to create a time-line control
426
+  // tell the UI to create a sequence builder  control
427 427
   if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTakeSeqBldrDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC )
428 428
     return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Take Sequence Builder UI element create failed.");
429 429
 
430 430
   // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change.
431 431
   cmDspInstVarSetFlags( ctx, inst, fileNameVarId,  kUiDsvFl );
432
+  cmDspInstVarSetFlags( ctx, inst, ptrVarId,       kUiDsvFl );
433
+  cmDspInstVarSetFlags( ctx, inst, selVarId,       kUiDsvFl );
434
+  cmDspInstVarSetFlags( ctx, inst, refreshVarId,   kUiDsvFl );
435
+
436
+  return rc;
437
+}
438
+
439
+
440
+cmDspRC_t  cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId, unsigned refreshVarId, unsigned selVarId )
441
+{
442
+  cmDspRC_t    rc;
443
+  unsigned     arr[] = { ptrVarId, refreshVarId, selVarId  };
444
+  cmDspValue_t v;
445
+  unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
446
+  cmDsvSetUIntMtx(&v,arr,vn,1);
447
+
448
+  // tell the UI to create a sequence render  control
449
+  if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTakeSeqRendDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC )
450
+    return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Take Sequence Render UI element create failed.");
451
+
452
+  // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change.
453
+  cmDspInstVarSetFlags( ctx, inst, ptrVarId,       kUiDsvFl );
454
+  cmDspInstVarSetFlags( ctx, inst, refreshVarId,   kUiDsvFl );
455
+  cmDspInstVarSetFlags( ctx, inst, selVarId,       kUiDsvFl );
432 456
 
433 457
   return rc;
434 458
 }

Loading…
Peruuta
Tallenna