Browse Source

cmDspClass.h/c Added DSP object variables set/get for types cmReal_t and cmSample_t.

master
kevin 12 years ago
parent
commit
2b6c5327c6
2 changed files with 74 additions and 0 deletions
  1. 66
    0
      dsp/cmDspClass.c
  2. 8
    0
      dsp/cmDspClass.h

+ 66
- 0
dsp/cmDspClass.c View File

@@ -728,6 +728,24 @@ double cmDspDouble( cmDspInst_t* inst, unsigned varId )
728 728
   return cmDsvGetDouble(vp); 
729 729
 }
730 730
 
731
+cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId )
732
+{ 
733
+  cmDspValue_t* vp;
734
+  if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC )
735
+    return 0;
736
+
737
+  return cmDsvGetSample(vp); 
738
+}
739
+
740
+cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId )
741
+{ 
742
+  cmDspValue_t* vp;
743
+  if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC )
744
+    return 0;
745
+
746
+  return cmDsvGetReal(vp); 
747
+}
748
+
731 749
 const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId )
732 750
 {
733 751
   cmDspValue_t* vp;
@@ -792,6 +810,24 @@ double cmDspDefaultDouble( cmDspInst_t* inst, unsigned varId )
792 810
   return cmDsvGetDouble(vp); 
793 811
 }
794 812
 
813
+cmSample_t cmDspDefaultSample( cmDspInst_t* inst, unsigned varId )
814
+{ 
815
+  cmDspValue_t* vp;
816
+  if(_cmDspVarDefaultPtr(inst,varId,&vp) != kOkDspRC )
817
+    return 0;
818
+
819
+  return cmDsvGetSample(vp); 
820
+}
821
+
822
+cmReal_t cmDspDefaultReal( cmDspInst_t* inst, unsigned varId )
823
+{ 
824
+  cmDspValue_t* vp;
825
+  if(_cmDspVarDefaultPtr(inst,varId,&vp) != kOkDspRC )
826
+    return 0;
827
+
828
+  return cmDsvGetReal(vp); 
829
+}
830
+
795 831
 const cmChar_t* cmDspDefaultStrcz( cmDspInst_t* inst, unsigned varId )
796 832
 {
797 833
   cmDspValue_t* vp;
@@ -1029,6 +1065,22 @@ cmDspRC_t   cmDspSetDefaultDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned
1029 1065
   return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal);
1030 1066
 }
1031 1067
 
1068
+cmDspRC_t   cmDspSetDefaultSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t nonInitVal, cmSample_t val )
1069
+{
1070
+  cmDspValue_t v;
1071
+  cmSample_t dv = cmDspDefaultSample(inst,varId);
1072
+  cmDsvSetSample(&v,val);
1073
+  return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal);
1074
+}
1075
+
1076
+cmDspRC_t   cmDspSetDefaultReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t nonInitVal, cmReal_t val )
1077
+{
1078
+  cmDspValue_t v;
1079
+  cmReal_t dv = cmDspDefaultReal(inst,varId);
1080
+  cmDsvSetReal(&v,val);
1081
+  return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal);
1082
+}
1083
+
1032 1084
 cmDspRC_t   cmDspSetDefaultSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val )
1033 1085
 {
1034 1086
   cmDspValue_t v;
@@ -1092,6 +1144,20 @@ cmDspRC_t  cmDspSetDouble(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId
1092 1144
   return cmDspValueSet(ctx, inst, varId, &v, 0);
1093 1145
 }
1094 1146
 
1147
+cmDspRC_t  cmDspSetSample(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t val )
1148
+{ 
1149
+  cmDspValue_t v;
1150
+  cmDsvSetSample(&v,val);
1151
+  return cmDspValueSet(ctx, inst, varId, &v, 0);
1152
+}
1153
+
1154
+cmDspRC_t  cmDspSetReal(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t val )
1155
+{ 
1156
+  cmDspValue_t v;
1157
+  cmDsvSetReal(&v,val);
1158
+  return cmDspValueSet(ctx, inst, varId, &v, 0);
1159
+}
1160
+
1095 1161
 cmDspRC_t  cmDspSetStrcz(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val )
1096 1162
 { 
1097 1163
   cmDspValue_t v;

+ 8
- 0
dsp/cmDspClass.h View File

@@ -267,6 +267,8 @@ extern "C" {
267 267
   int             cmDspInt(    cmDspInst_t* inst, unsigned varId );
268 268
   unsigned        cmDspUInt(   cmDspInst_t* inst, unsigned varId );
269 269
   double          cmDspDouble( cmDspInst_t* inst, unsigned varId );
270
+  cmSample_t      cmDspSample( cmDspInst_t* inst, unsigned varId );
271
+  cmReal_t        cmDspReal(   cmDspInst_t* inst, unsigned varId );
270 272
   const cmChar_t* cmDspStrcz(   cmDspInst_t* inst, unsigned varId );
271 273
   unsigned        cmDspSymbol( cmDspInst_t* inst, unsigned varId );
272 274
   cmJsonNode_t*   cmDspJson(   cmDspInst_t* inst, unsigned varId );
@@ -276,6 +278,8 @@ extern "C" {
276 278
   int             cmDspDefaultInt(    cmDspInst_t* inst, unsigned varId );
277 279
   unsigned        cmDspDefaultUInt(   cmDspInst_t* inst, unsigned varId );
278 280
   double          cmDspDefaultDouble( cmDspInst_t* inst, unsigned varId );
281
+  cmSample_t      cmDspDefaultSample( cmDspInst_t* inst, unsigned varId );
282
+  cmReal_t        cmDspDefaultReal(   cmDspInst_t* inst, unsigned varId );
279 283
   const cmChar_t* cmDspDefaultStrcz(   cmDspInst_t* inst, unsigned varId );
280 284
   unsigned        cmDspDefaultSymbol( cmDspInst_t* inst, unsigned varId );
281 285
   cmJsonNode_t*   cmDspDefaultJson(   cmDspInst_t* inst, unsigned varId );
@@ -323,6 +327,8 @@ extern "C" {
323 327
   cmDspRC_t   cmDspSetDefaultInt(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int             nonInitVal, int             val );
324 328
   cmDspRC_t   cmDspSetDefaultUInt(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned        nonInitVal, unsigned        val );
325 329
   cmDspRC_t   cmDspSetDefaultDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double          nonInitVal, double          val );
330
+  cmDspRC_t   cmDspSetDefaultSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t      nonInitVal, cmSample_t      val );
331
+  cmDspRC_t   cmDspSetDefaultReal(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t        nonInitVal, cmReal_t        val );
326 332
   cmDspRC_t   cmDspSetDefaultStrcz(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* nonInitVal, const cmChar_t* val );
327 333
   cmDspRC_t   cmDspSetDefaultSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, /*unsigned cmInvalidId*/    unsigned        val );
328 334
   cmDspRC_t   cmDspSetDefaultJson(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t*   nonInitVal, cmJsonNode_t*   val );
@@ -336,6 +342,8 @@ extern "C" {
336 342
   cmDspRC_t   cmDspSetInt(           cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int             val );
337 343
   cmDspRC_t   cmDspSetUInt(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned        val );
338 344
   cmDspRC_t   cmDspSetDouble(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double          val );
345
+  cmDspRC_t   cmDspSetSample(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t      val );
346
+  cmDspRC_t   cmDspSetReal(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t        val );
339 347
   cmDspRC_t   cmDspSetStrcz(         cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val );
340 348
   cmDspRC_t   cmDspSetSymbol(        cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned        val );
341 349
   cmDspRC_t   cmDspSetJson(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t*   val );

Loading…
Cancel
Save