|
@@ -2707,6 +2707,8 @@ _cmScModTypeMap_t _cmScModTypeArray[] =
|
2707
|
2707
|
{ kSetLineModTId, 3, "sline" },
|
2708
|
2708
|
{ kPostModTId, 4, "post" },
|
2709
|
2709
|
{ kExecModTId, 5, "exec" },
|
|
2710
|
+ { kInputModTId, 6, "input" },
|
|
2711
|
+ { kCrossModTId, 7, "cross" },
|
2710
|
2712
|
{ kInvalidModTId, 0, "<invalid>"}
|
2711
|
2713
|
};
|
2712
|
2714
|
|
|
@@ -2748,7 +2750,7 @@ cmScModVar_t* _cmScModulatorInsertVar( cmScModulator* p, unsigned varSymId, unsi
|
2748
|
2750
|
{
|
2749
|
2751
|
vp = cmMemAllocZ(cmScModVar_t,1);
|
2750
|
2752
|
vp->varSymId = varSymId;
|
2751
|
|
- vp->outVarId = cmInvalidId;
|
|
2753
|
+ vp->varId = cmInvalidId;
|
2752
|
2754
|
vp->vlink = p->vlist;
|
2753
|
2755
|
p->vlist = vp;
|
2754
|
2756
|
}
|
|
@@ -2771,15 +2773,10 @@ cmScModEntry_t* _cmScModulatorInsertEntry(cmScModulator* p, cmScModEntryGroup_t*
|
2771
|
2773
|
|
2772
|
2774
|
g->earray[idx].scLocIdx = scLocIdx;
|
2773
|
2775
|
g->earray[idx].typeId = typeId;
|
2774
|
|
- g->earray[idx].varPtr = _cmScModulatorInsertVar(p,varSymId,0);
|
2775
|
|
-
|
2776
|
|
- if( g->earray[idx].varPtr->outVarId == cmInvalidIdx )
|
2777
|
|
- g->earray[idx].varPtr->outVarId = p->outVarCnt++;
|
2778
|
2776
|
|
2779
|
2777
|
return g->earray + idx;
|
2780
|
2778
|
}
|
2781
|
2779
|
|
2782
|
|
-
|
2783
|
2780
|
/*
|
2784
|
2781
|
{
|
2785
|
2782
|
[
|
|
@@ -2833,6 +2830,114 @@ cmRC_t _cmScModulatorParseParam( cmScModulator* p, cmSymTblH_t stH, cmJsonNode_t
|
2833
|
2830
|
}
|
2834
|
2831
|
|
2835
|
2832
|
|
|
2833
|
+
|
|
2834
|
+// If the requested parameter has a value then return it in *valPtr.
|
|
2835
|
+// If it does not then do nothing. This function applies scaling to RHS values.
|
|
2836
|
+cmRC_t _cmScModGetParam( cmScModulator* p, const cmScModParam_t* pp, double* valPtr )
|
|
2837
|
+{
|
|
2838
|
+ cmRC_t rc = cmOkRC;
|
|
2839
|
+
|
|
2840
|
+ switch( pp->pid )
|
|
2841
|
+ {
|
|
2842
|
+ case kInvalidModPId:
|
|
2843
|
+ rc = cmCtxRtCondition( &p->obj, cmInvalidArgRC, "An invalid parameter was encountered.");
|
|
2844
|
+ goto errLabel;
|
|
2845
|
+ break;
|
|
2846
|
+
|
|
2847
|
+ case kLiteralModPId:
|
|
2848
|
+ *valPtr = pp->val;
|
|
2849
|
+ break;
|
|
2850
|
+
|
|
2851
|
+ case kSymbolModPId:
|
|
2852
|
+ {
|
|
2853
|
+ cmScModVar_t* vp;
|
|
2854
|
+
|
|
2855
|
+ // get a pointer to the parameter variable
|
|
2856
|
+ if((vp = _cmScModSymToVar(p, pp->symId )) == NULL )
|
|
2857
|
+ {
|
|
2858
|
+ rc = cmCtxRtCondition( &p->obj, cmInvalidArgRC, "Variable '%s' not found.",cmSymTblLabel(p->stH,pp->symId));
|
|
2859
|
+ goto errLabel;
|
|
2860
|
+ }
|
|
2861
|
+
|
|
2862
|
+ // if this is not a 'calculated' paramter then scale it here.
|
|
2863
|
+ if( cmIsFlag(vp->flags,kCalcModFl ) && vp->min!=DBL_MAX && vp->max!=DBL_MAX )
|
|
2864
|
+ *valPtr = (vp->value - vp->min)/(vp->max-vp->min);
|
|
2865
|
+ else
|
|
2866
|
+ *valPtr = vp->value;
|
|
2867
|
+ }
|
|
2868
|
+ break;
|
|
2869
|
+
|
|
2870
|
+ default:
|
|
2871
|
+ { assert(0); }
|
|
2872
|
+ }
|
|
2873
|
+
|
|
2874
|
+ errLabel:
|
|
2875
|
+ return rc;
|
|
2876
|
+}
|
|
2877
|
+
|
|
2878
|
+void _cmScModDumpParam( cmScModulator* p, const cmChar_t* label, const cmScModParam_t* pp )
|
|
2879
|
+{
|
|
2880
|
+ printf("%s: ",label);
|
|
2881
|
+
|
|
2882
|
+ switch( pp->pid )
|
|
2883
|
+ {
|
|
2884
|
+ case kInvalidModPId:
|
|
2885
|
+ printf("<invalid>");
|
|
2886
|
+ break;
|
|
2887
|
+
|
|
2888
|
+ case kLiteralModPId:
|
|
2889
|
+ if( pp->val == DBL_MAX )
|
|
2890
|
+ printf("<max> ");
|
|
2891
|
+ else
|
|
2892
|
+ printf("%f ",pp->val);
|
|
2893
|
+ break;
|
|
2894
|
+
|
|
2895
|
+ case kSymbolModPId:
|
|
2896
|
+ printf("%s ",cmSymTblLabel(p->stH,pp->symId));
|
|
2897
|
+ break;
|
|
2898
|
+
|
|
2899
|
+ default:
|
|
2900
|
+ { assert(0); }
|
|
2901
|
+ }
|
|
2902
|
+}
|
|
2903
|
+
|
|
2904
|
+void _cmScModDumpVal( cmChar_t* label, double val )
|
|
2905
|
+{
|
|
2906
|
+ printf("%s:",label);
|
|
2907
|
+
|
|
2908
|
+ if( val == DBL_MAX )
|
|
2909
|
+ printf("<max> " );
|
|
2910
|
+ else
|
|
2911
|
+ printf("%f ",val);
|
|
2912
|
+}
|
|
2913
|
+
|
|
2914
|
+
|
|
2915
|
+void _cmScModDumpVar( cmScModulator* p, const cmScModVar_t* vp )
|
|
2916
|
+{
|
|
2917
|
+ printf("%7s %3i fl:0x%x entry:%p alink:%p %s",cmSymTblLabel(p->stH,vp->varSymId),vp->varId,vp->flags,vp->entry,vp->alink, cmIsFlag(vp->flags,kInputModFl)?"input":"");
|
|
2918
|
+ _cmScModDumpVal("val",vp->value);
|
|
2919
|
+ _cmScModDumpVal("min",vp->min);
|
|
2920
|
+ _cmScModDumpVal("max",vp->max);
|
|
2921
|
+ _cmScModDumpVal("rate",vp->rate);
|
|
2922
|
+ _cmScModDumpVal("v0",vp->v0);
|
|
2923
|
+}
|
|
2924
|
+
|
|
2925
|
+void _cmScModDumpEntry( cmScModulator* p, const cmScModEntry_t* ep)
|
|
2926
|
+{
|
|
2927
|
+ const _cmScModTypeMap_t* tm = _cmScModTypeIdToMap( ep->typeId );
|
|
2928
|
+
|
|
2929
|
+ printf("%10i ",ep->scLocIdx);
|
|
2930
|
+
|
|
2931
|
+ printf("%5s %7s", tm==NULL ? "invld" : tm->label, cmSymTblLabel(p->stH,ep->varPtr->varSymId));
|
|
2932
|
+ _cmScModDumpParam(p," beg", &ep->beg);
|
|
2933
|
+ _cmScModDumpParam(p," end", &ep->end);
|
|
2934
|
+ _cmScModDumpParam(p," min", &ep->min);
|
|
2935
|
+ _cmScModDumpParam(p," max", &ep->max);
|
|
2936
|
+ _cmScModDumpParam(p," rate",&ep->rate);
|
|
2937
|
+ printf("\n");
|
|
2938
|
+
|
|
2939
|
+}
|
|
2940
|
+
|
2836
|
2941
|
cmRC_t _cmScModParseEntryGroup( cmScModulator* p, cmCtx_t* ctx, cmJsonH_t jsH, cmSymTblH_t stH, cmJsonNode_t* jnp, cmScModEntryGroup_t* g, const cmChar_t* fn )
|
2837
|
2942
|
{
|
2838
|
2943
|
cmRC_t rc = cmOkRC;
|
|
@@ -2914,9 +3019,11 @@ cmRC_t _cmScModParseEntryGroup( cmScModulator* p, cmCtx_t* ctx, cmJsonH_t jsH, c
|
2914
|
3019
|
// get the count of the elmenets in the data array
|
2915
|
3020
|
unsigned paramCnt = cmJsonChildCount(onp);
|
2916
|
3021
|
|
|
3022
|
+
|
2917
|
3023
|
// fill the entry record and find or create the target var
|
2918
|
3024
|
cmScModEntry_t* ep = _cmScModulatorInsertEntry(p,g,i,scLocIdx,varSymId,map->typeId,paramCnt);
|
2919
|
3025
|
|
|
3026
|
+
|
2920
|
3027
|
typedef struct
|
2921
|
3028
|
{
|
2922
|
3029
|
const cmChar_t* label;
|
|
@@ -2932,6 +3039,7 @@ cmRC_t _cmScModParseEntryGroup( cmScModulator* p, cmCtx_t* ctx, cmJsonH_t jsH, c
|
2932
|
3039
|
{ "val", &ep->beg },
|
2933
|
3040
|
{ "end", &ep->end },
|
2934
|
3041
|
{ "dur", &ep->dur },
|
|
3042
|
+ { "arg", &ep->arg },
|
2935
|
3043
|
{ NULL, NULL }
|
2936
|
3044
|
};
|
2937
|
3045
|
|
|
@@ -2939,7 +3047,21 @@ cmRC_t _cmScModParseEntryGroup( cmScModulator* p, cmCtx_t* ctx, cmJsonH_t jsH, c
|
2939
|
3047
|
for(j=0; mapArray[j].param!=NULL; ++j)
|
2940
|
3048
|
if((dnp = cmJsonFindValue(jsH,mapArray[j].label, onp, kInvalidTId )) != NULL )
|
2941
|
3049
|
if((rc = _cmScModulatorParseParam(p,stH,dnp,mapArray[j].param)) != cmOkRC )
|
2942
|
|
- goto errLabel;
|
|
3050
|
+ goto errLabel;
|
|
3051
|
+
|
|
3052
|
+ // create the variable associated with this entry
|
|
3053
|
+ ep->varPtr = _cmScModulatorInsertVar(p,varSymId, ep->typeId==kInputModTId ? kInputModFl : 0);
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+ // set the variable id value
|
|
3057
|
+ if( ep->varPtr->varId == cmInvalidIdx )
|
|
3058
|
+ {
|
|
3059
|
+ if( ep->typeId != kInputModTId )
|
|
3060
|
+ ep->varPtr->varId = p->outVarCnt++;
|
|
3061
|
+ else
|
|
3062
|
+ ep->varPtr->varId = p->inVarCnt++;
|
|
3063
|
+ }
|
|
3064
|
+
|
2943
|
3065
|
}
|
2944
|
3066
|
|
2945
|
3067
|
errLabel:
|
|
@@ -3022,6 +3144,8 @@ cmRC_t _cmScModulatorReset( cmScModulator* p, cmCtx_t* ctx, unsigned scLocIdx,
|
3022
|
3144
|
p->elist = NULL;
|
3023
|
3145
|
p->nei = 0;
|
3024
|
3146
|
p->outVarCnt = 0;
|
|
3147
|
+ p->inVarCnt = 0;
|
|
3148
|
+
|
3025
|
3149
|
|
3026
|
3150
|
// reload the file
|
3027
|
3151
|
if((rc = _cmScModulatorParse(p,ctx,p->stH,p->fn)) != cmOkRC )
|
|
@@ -3120,13 +3244,29 @@ cmScModVar_t* cmScModulatorOutVar( cmScModulator* p, unsigned idx )
|
3120
|
3244
|
cmScModEntryGroup_t* g = p->glist;
|
3121
|
3245
|
for(; g!=NULL; g=g->link)
|
3122
|
3246
|
for(i=0; i<g->en; ++i)
|
3123
|
|
- if( g->earray[i].varPtr->outVarId == idx )
|
|
3247
|
+ if( cmIsNotFlag(g->earray[i].varPtr->flags,kInputModFl) && g->earray[i].varPtr->varId == idx )
|
|
3248
|
+ return g->earray[i].varPtr;
|
|
3249
|
+
|
|
3250
|
+ return NULL;
|
|
3251
|
+}
|
|
3252
|
+
|
|
3253
|
+unsigned cmScModulatorInVarCount( cmScModulator* p )
|
|
3254
|
+{ return p->inVarCnt; }
|
|
3255
|
+
|
|
3256
|
+cmScModVar_t* cmScModulatorInVar( cmScModulator* p, unsigned idx )
|
|
3257
|
+{
|
|
3258
|
+ unsigned i;
|
|
3259
|
+ cmScModEntryGroup_t* g = p->glist;
|
|
3260
|
+ for(; g!=NULL; g=g->link)
|
|
3261
|
+ for(i=0; i<g->en; ++i)
|
|
3262
|
+ if( cmIsFlag(g->earray[i].varPtr->flags,kInputModFl) && g->earray[i].varPtr->varId == idx )
|
3124
|
3263
|
return g->earray[i].varPtr;
|
3125
|
3264
|
|
3126
|
3265
|
return NULL;
|
3127
|
3266
|
}
|
3128
|
3267
|
|
3129
|
|
-cmRC_t cmScModulatorSetValue( cmScModulator* p, unsigned varSymId, double value, double min, double max )
|
|
3268
|
+
|
|
3269
|
+cmScModVar_t* _cmScModSetValuePrefix( cmScModulator* p, unsigned varSymId )
|
3130
|
3270
|
{
|
3131
|
3271
|
cmScModVar_t* vp;
|
3132
|
3272
|
// if the var does not exist ....
|
|
@@ -3137,6 +3277,14 @@ cmRC_t cmScModulatorSetValue( cmScModulator* p, unsigned varSymId, doubl
|
3137
|
3277
|
assert(vp!=NULL);
|
3138
|
3278
|
}
|
3139
|
3279
|
|
|
3280
|
+ return vp;
|
|
3281
|
+}
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+cmRC_t cmScModulatorSetValueMinMax( cmScModulator* p, unsigned varSymId, double value, double min, double max )
|
|
3285
|
+{
|
|
3286
|
+ cmScModVar_t* vp = _cmScModSetValuePrefix(p, varSymId );
|
|
3287
|
+
|
3140
|
3288
|
assert( min <= max);
|
3141
|
3289
|
|
3142
|
3290
|
vp->min = min;
|
|
@@ -3146,6 +3294,15 @@ cmRC_t cmScModulatorSetValue( cmScModulator* p, unsigned varSymId, doubl
|
3146
|
3294
|
return cmOkRC;
|
3147
|
3295
|
}
|
3148
|
3296
|
|
|
3297
|
+cmRC_t cmScModulatorSetValue( cmScModulator* p, unsigned varSymId, double value )
|
|
3298
|
+{
|
|
3299
|
+ cmScModVar_t* vp = _cmScModSetValuePrefix(p, varSymId );
|
|
3300
|
+
|
|
3301
|
+ vp->value = value;
|
|
3302
|
+
|
|
3303
|
+ return cmOkRC;
|
|
3304
|
+}
|
|
3305
|
+
|
3149
|
3306
|
|
3150
|
3307
|
cmRC_t cmScModulatorReset( cmScModulator* p, cmCtx_t* ctx, unsigned scLocIdx, unsigned entryGroupSymId )
|
3151
|
3308
|
{
|
|
@@ -3171,50 +3328,6 @@ void _cmScModUnlinkActive( cmScModulator* p, cmScModVar_t* vp, cmScModVar_t* pp
|
3171
|
3328
|
vp->entry = NULL;
|
3172
|
3329
|
}
|
3173
|
3330
|
|
3174
|
|
-// If the requested parameter has a value then return it in *valPtr.
|
3175
|
|
-// If it does not then do nothing. This function applies scaling to RHS values.
|
3176
|
|
-cmRC_t _cmScModGetParam( cmScModulator* p, const cmScModParam_t* pp, double* valPtr )
|
3177
|
|
-{
|
3178
|
|
- cmRC_t rc = cmOkRC;
|
3179
|
|
-
|
3180
|
|
- switch( pp->pid )
|
3181
|
|
- {
|
3182
|
|
- case kInvalidModPId:
|
3183
|
|
- rc = cmCtxRtCondition( &p->obj, cmInvalidArgRC, "An invalid parameter was encountered.");
|
3184
|
|
- goto errLabel;
|
3185
|
|
- break;
|
3186
|
|
-
|
3187
|
|
- case kLiteralModPId:
|
3188
|
|
- *valPtr = pp->val;
|
3189
|
|
- break;
|
3190
|
|
-
|
3191
|
|
- case kSymbolModPId:
|
3192
|
|
- {
|
3193
|
|
- cmScModVar_t* vp;
|
3194
|
|
-
|
3195
|
|
- // get a pointer to the parameter variable
|
3196
|
|
- if((vp = _cmScModSymToVar(p, pp->symId )) == NULL )
|
3197
|
|
- {
|
3198
|
|
- rc = cmCtxRtCondition( &p->obj, cmInvalidArgRC, "Variable '%s' not found.",cmSymTblLabel(p->stH,pp->symId));
|
3199
|
|
- goto errLabel;
|
3200
|
|
- }
|
3201
|
|
-
|
3202
|
|
- // if this is not a 'calculated' paramter then scale it here.
|
3203
|
|
- if( cmIsFlag(vp->flags,kCalcModFl ) && vp->min!=DBL_MAX && vp->max!=DBL_MAX )
|
3204
|
|
- *valPtr = (vp->value - vp->min)/(vp->max-vp->min);
|
3205
|
|
- else
|
3206
|
|
- *valPtr = vp->value;
|
3207
|
|
- }
|
3208
|
|
- break;
|
3209
|
|
-
|
3210
|
|
- default:
|
3211
|
|
- { assert(0); }
|
3212
|
|
- }
|
3213
|
|
-
|
3214
|
|
- errLabel:
|
3215
|
|
- return rc;
|
3216
|
|
-}
|
3217
|
|
-
|
3218
|
3331
|
cmRC_t _cmScModActivateEntries( cmScModulator* p, cmScModEntry_t* earray, unsigned* idxRef, unsigned cnt, unsigned scLocIdx );
|
3219
|
3332
|
|
3220
|
3333
|
cmRC_t _cmScModActivateGroup( cmScModulator* p, cmScModEntry_t* ep )
|
|
@@ -3231,6 +3344,49 @@ cmRC_t _cmScModActivateGroup( cmScModulator* p, cmScModEntry_t* ep )
|
3231
|
3344
|
return cmCtxRtCondition( &p->obj, cmInvalidArgRC, "Entry group '%s' not found.",cmSymTblLabel(p->stH,ep->beg.symId));
|
3232
|
3345
|
}
|
3233
|
3346
|
|
|
3347
|
+
|
|
3348
|
+cmRC_t _cmScModGetCrossParam( cmScModulator* p, cmScModEntry_t* ep, cmScModParam_t* pp, const cmChar_t* label, double* valRef )
|
|
3349
|
+{
|
|
3350
|
+ cmRC_t rc;
|
|
3351
|
+
|
|
3352
|
+ if((rc = _cmScModGetParam(p, pp, valRef )) != cmOkRC )
|
|
3353
|
+ rc = cmCtxRtCondition( &p->obj, cmInvalidArgRC, "Invalid %s parameter for cross variable:%s",label,cmSymTblLabel(p->stH,ep->varPtr->varSymId) );
|
|
3354
|
+
|
|
3355
|
+ return rc;
|
|
3356
|
+
|
|
3357
|
+}
|
|
3358
|
+
|
|
3359
|
+cmRC_t _cmScModExecCross( cmScModulator* p, cmScModEntry_t* ep )
|
|
3360
|
+{
|
|
3361
|
+ cmRC_t rc = cmOkRC;
|
|
3362
|
+ double x = 0.0;
|
|
3363
|
+ //double x0 = 0.0, x1 = 0.0;
|
|
3364
|
+ double y0 = 0.0, y1 = 0.0;
|
|
3365
|
+
|
|
3366
|
+ if((rc = _cmScModGetCrossParam(p, ep, &ep->arg, "src var", &x )) != cmOkRC )
|
|
3367
|
+ return rc;
|
|
3368
|
+
|
|
3369
|
+ //if((rc = _cmScModGetCrossParam(p, ep, &ep->beg, "src min", &x0 )) != cmOkRC )
|
|
3370
|
+ // return rc;
|
|
3371
|
+
|
|
3372
|
+ //if((rc = _cmScModGetCrossParam(p, ep, &ep->end, "src max", &x1 )) != cmOkRC )
|
|
3373
|
+ // return rc;
|
|
3374
|
+
|
|
3375
|
+ if((rc = _cmScModGetCrossParam(p, ep, &ep->min, "dst min", &y0 )) != cmOkRC )
|
|
3376
|
+ return rc;
|
|
3377
|
+
|
|
3378
|
+ if((rc = _cmScModGetCrossParam(p, ep, &ep->max, "dst max", &y1 )) != cmOkRC )
|
|
3379
|
+ return rc;
|
|
3380
|
+
|
|
3381
|
+ //double xx = x0 + (x-x0) / (x1-x0);
|
|
3382
|
+
|
|
3383
|
+ printf("%s x:%f y0:%f y1:%f\n",__FUNCTION__,x,y0,y1);
|
|
3384
|
+
|
|
3385
|
+ ep->varPtr->value = y0 + x * (y1-y0);
|
|
3386
|
+
|
|
3387
|
+ return rc;
|
|
3388
|
+}
|
|
3389
|
+
|
3234
|
3390
|
// Type specific variable activation -
|
3235
|
3391
|
cmRC_t _cmScModActivate(cmScModulator* p, cmScModEntry_t* ep )
|
3236
|
3392
|
{
|
|
@@ -3277,6 +3433,12 @@ cmRC_t _cmScModActivate(cmScModulator* p, cmScModEntry_t* ep )
|
3277
|
3433
|
rc = _cmScModActivateGroup(p,ep);
|
3278
|
3434
|
break;
|
3279
|
3435
|
|
|
3436
|
+ case kInputModTId:
|
|
3437
|
+ break;
|
|
3438
|
+
|
|
3439
|
+ case kCrossModTId:
|
|
3440
|
+ break;
|
|
3441
|
+
|
3280
|
3442
|
default:
|
3281
|
3443
|
{ assert(0); }
|
3282
|
3444
|
}
|
|
@@ -3306,6 +3468,7 @@ cmRC_t _cmScModExecSendValue( cmScModulator* p, cmScModVar_t* vp )
|
3306
|
3468
|
return rc;
|
3307
|
3469
|
}
|
3308
|
3470
|
|
|
3471
|
+// Execute a variable.
|
3309
|
3472
|
// Return true if vp should be deactivated otherwise return false.
|
3310
|
3473
|
bool _cmScModExec( cmScModulator* p, cmScModVar_t* vp )
|
3311
|
3474
|
{
|
|
@@ -3322,6 +3485,7 @@ bool _cmScModExec( cmScModulator* p, cmScModVar_t* vp )
|
3322
|
3485
|
|
3323
|
3486
|
case kSetModTId:
|
3324
|
3487
|
{
|
|
3488
|
+ // Get a new value for the variable *vp.
|
3325
|
3489
|
if((rc = _cmScModGetParam(p,&vp->entry->beg,&vp->value)) != cmOkRC )
|
3326
|
3490
|
goto errLabel;
|
3327
|
3491
|
|
|
@@ -3343,6 +3507,7 @@ bool _cmScModExec( cmScModulator* p, cmScModVar_t* vp )
|
3343
|
3507
|
if((rc = _cmScModGetParam(p,&vp->entry->dur,&td)) != cmOkRC)
|
3344
|
3508
|
goto errLabel;
|
3345
|
3509
|
|
|
3510
|
+ // update the value of the var *vp
|
3346
|
3511
|
double v = vp->v0 + (v1-vp->v0) * (vp->phase * p->samplesPerCycle) / (p->srate * td);
|
3347
|
3512
|
|
3348
|
3513
|
if((fl = (vp->value <= v1 && v >= v1) || (vp->value >= v1 && v <= v1 )) == true )
|
|
@@ -3360,6 +3525,16 @@ bool _cmScModExec( cmScModulator* p, cmScModVar_t* vp )
|
3360
|
3525
|
sendFl = false;
|
3361
|
3526
|
break;
|
3362
|
3527
|
|
|
3528
|
+ case kInputModTId:
|
|
3529
|
+ sendFl = false;
|
|
3530
|
+ break;
|
|
3531
|
+
|
|
3532
|
+ case kCrossModTId:
|
|
3533
|
+ _cmScModExecCross(p,vp->entry);
|
|
3534
|
+ vp->phase = 0; // force the value to be sent
|
|
3535
|
+ fl = true;
|
|
3536
|
+ break;
|
|
3537
|
+
|
3363
|
3538
|
default:
|
3364
|
3539
|
{ assert(0); }
|
3365
|
3540
|
}
|
|
@@ -3451,58 +3626,13 @@ cmRC_t cmScModulatorExec( cmScModulator* p, unsigned scLocIdx )
|
3451
|
3626
|
}
|
3452
|
3627
|
|
3453
|
3628
|
|
3454
|
|
-void _cmScModDumpParam( cmScModulator* p, const cmChar_t* label, cmScModParam_t* pp )
|
3455
|
|
-{
|
3456
|
|
- printf("%s: ",label);
|
3457
|
|
-
|
3458
|
|
- switch( pp->pid )
|
3459
|
|
- {
|
3460
|
|
- case kInvalidModPId:
|
3461
|
|
- printf("<invalid>");
|
3462
|
|
- break;
|
3463
|
|
-
|
3464
|
|
- case kLiteralModPId:
|
3465
|
|
- if( pp->val == DBL_MAX )
|
3466
|
|
- printf("<max> ");
|
3467
|
|
- else
|
3468
|
|
- printf("%f ",pp->val);
|
3469
|
|
- break;
|
3470
|
|
-
|
3471
|
|
- case kSymbolModPId:
|
3472
|
|
- printf("%s ",cmSymTblLabel(p->stH,pp->symId));
|
3473
|
|
- break;
|
3474
|
|
-
|
3475
|
|
- default:
|
3476
|
|
- { assert(0); }
|
3477
|
|
- }
|
3478
|
|
-}
|
3479
|
|
-
|
3480
|
|
-void _cmScModDumpVal( cmChar_t* label, double val )
|
3481
|
|
-{
|
3482
|
|
- printf("%s:",label);
|
3483
|
|
-
|
3484
|
|
- if( val == DBL_MAX )
|
3485
|
|
- printf("<max> " );
|
3486
|
|
- else
|
3487
|
|
- printf("%f ",val);
|
3488
|
|
-}
|
3489
|
|
-
|
3490
|
|
-void _cmScModDumpVar( cmScModulator* p, const cmScModVar_t* vp )
|
3491
|
|
-{
|
3492
|
|
- printf("%7s %3i fl:0x%x entry:%p alink:%p ",cmSymTblLabel(p->stH,vp->varSymId),vp->outVarId,vp->flags,vp->entry,vp->alink);
|
3493
|
|
- _cmScModDumpVal("val",vp->value);
|
3494
|
|
- _cmScModDumpVal("min",vp->min);
|
3495
|
|
- _cmScModDumpVal("max",vp->max);
|
3496
|
|
- _cmScModDumpVal("rate",vp->rate);
|
3497
|
|
- _cmScModDumpVal("v0",vp->v0);
|
3498
|
|
-}
|
3499
|
3629
|
|
3500
|
3630
|
cmRC_t cmScModulatorDump( cmScModulator* p )
|
3501
|
3631
|
{
|
3502
|
3632
|
cmRC_t rc = cmOkRC;
|
3503
|
3633
|
|
3504
|
3634
|
printf("MOD:\n");
|
3505
|
|
- printf("nei:%i alist:%p outVarCnt:%i\n",p->nei,p->alist,p->outVarCnt);
|
|
3635
|
+ printf("nei:%i alist:%p outVarCnt:%i inVarCnt:%i\n",p->nei,p->alist,p->outVarCnt,p->inVarCnt);
|
3506
|
3636
|
|
3507
|
3637
|
printf("ENTRIES:\n");
|
3508
|
3638
|
cmScModEntryGroup_t* g = p->glist;
|
|
@@ -3513,19 +3643,9 @@ cmRC_t cmScModulatorDump( cmScModulator* p )
|
3513
|
3643
|
for(i=0; i<g->en; ++i)
|
3514
|
3644
|
{
|
3515
|
3645
|
cmScModEntry_t* ep = g->earray + i;
|
3516
|
|
- const _cmScModTypeMap_t* tm = _cmScModTypeIdToMap( ep->typeId );
|
3517
|
|
-
|
3518
|
3646
|
printf("%3i ",i);
|
3519
|
|
-
|
3520
|
|
- printf("%10i ",ep->scLocIdx);
|
3521
|
|
-
|
3522
|
|
- printf("%5s %7s", tm==NULL ? "invld" : tm->label, cmSymTblLabel(p->stH,ep->varPtr->varSymId));
|
3523
|
|
- _cmScModDumpParam(p," beg", &ep->beg);
|
3524
|
|
- _cmScModDumpParam(p," end", &ep->end);
|
3525
|
|
- _cmScModDumpParam(p," min", &ep->min);
|
3526
|
|
- _cmScModDumpParam(p," max", &ep->max);
|
3527
|
|
- _cmScModDumpParam(p," rate",&ep->rate);
|
3528
|
|
- printf("\n");
|
|
3647
|
+
|
|
3648
|
+ _cmScModDumpEntry(p,ep);
|
3529
|
3649
|
}
|
3530
|
3650
|
}
|
3531
|
3651
|
|