diff --git a/dsp/cmDspClass.c b/dsp/cmDspClass.c index 2941f9b..e7bb63e 100644 --- a/dsp/cmDspClass.c +++ b/dsp/cmDspClass.c @@ -728,6 +728,24 @@ double cmDspDouble( cmDspInst_t* inst, unsigned varId ) return cmDsvGetDouble(vp); } +cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId ) +{ + cmDspValue_t* vp; + if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC ) + return 0; + + return cmDsvGetSample(vp); +} + +cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId ) +{ + cmDspValue_t* vp; + if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC ) + return 0; + + return cmDsvGetReal(vp); +} + const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId ) { cmDspValue_t* vp; @@ -792,6 +810,24 @@ double cmDspDefaultDouble( cmDspInst_t* inst, unsigned varId ) return cmDsvGetDouble(vp); } +cmSample_t cmDspDefaultSample( cmDspInst_t* inst, unsigned varId ) +{ + cmDspValue_t* vp; + if(_cmDspVarDefaultPtr(inst,varId,&vp) != kOkDspRC ) + return 0; + + return cmDsvGetSample(vp); +} + +cmReal_t cmDspDefaultReal( cmDspInst_t* inst, unsigned varId ) +{ + cmDspValue_t* vp; + if(_cmDspVarDefaultPtr(inst,varId,&vp) != kOkDspRC ) + return 0; + + return cmDsvGetReal(vp); +} + const cmChar_t* cmDspDefaultStrcz( cmDspInst_t* inst, unsigned varId ) { cmDspValue_t* vp; @@ -1029,6 +1065,22 @@ cmDspRC_t cmDspSetDefaultDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal); } +cmDspRC_t cmDspSetDefaultSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t nonInitVal, cmSample_t val ) +{ + cmDspValue_t v; + cmSample_t dv = cmDspDefaultSample(inst,varId); + cmDsvSetSample(&v,val); + return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal); +} + +cmDspRC_t cmDspSetDefaultReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t nonInitVal, cmReal_t val ) +{ + cmDspValue_t v; + cmReal_t dv = cmDspDefaultReal(inst,varId); + cmDsvSetReal(&v,val); + return _cmDspDefaultSet(ctx,inst,varId,&v,dv==nonInitVal); +} + cmDspRC_t cmDspSetDefaultSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val ) { cmDspValue_t v; @@ -1092,6 +1144,20 @@ cmDspRC_t cmDspSetDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId return cmDspValueSet(ctx, inst, varId, &v, 0); } +cmDspRC_t cmDspSetSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t val ) +{ + cmDspValue_t v; + cmDsvSetSample(&v,val); + return cmDspValueSet(ctx, inst, varId, &v, 0); +} + +cmDspRC_t cmDspSetReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t val ) +{ + cmDspValue_t v; + cmDsvSetReal(&v,val); + return cmDspValueSet(ctx, inst, varId, &v, 0); +} + cmDspRC_t cmDspSetStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val ) { cmDspValue_t v; diff --git a/dsp/cmDspClass.h b/dsp/cmDspClass.h index f04a2b6..636700c 100644 --- a/dsp/cmDspClass.h +++ b/dsp/cmDspClass.h @@ -267,6 +267,8 @@ extern "C" { int cmDspInt( cmDspInst_t* inst, unsigned varId ); unsigned cmDspUInt( cmDspInst_t* inst, unsigned varId ); double cmDspDouble( cmDspInst_t* inst, unsigned varId ); + cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId ); + cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId ); const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId ); unsigned cmDspSymbol( cmDspInst_t* inst, unsigned varId ); cmJsonNode_t* cmDspJson( cmDspInst_t* inst, unsigned varId ); @@ -276,6 +278,8 @@ extern "C" { int cmDspDefaultInt( cmDspInst_t* inst, unsigned varId ); unsigned cmDspDefaultUInt( cmDspInst_t* inst, unsigned varId ); double cmDspDefaultDouble( cmDspInst_t* inst, unsigned varId ); + cmSample_t cmDspDefaultSample( cmDspInst_t* inst, unsigned varId ); + cmReal_t cmDspDefaultReal( cmDspInst_t* inst, unsigned varId ); const cmChar_t* cmDspDefaultStrcz( cmDspInst_t* inst, unsigned varId ); unsigned cmDspDefaultSymbol( cmDspInst_t* inst, unsigned varId ); cmJsonNode_t* cmDspDefaultJson( cmDspInst_t* inst, unsigned varId ); @@ -323,6 +327,8 @@ extern "C" { cmDspRC_t cmDspSetDefaultInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int nonInitVal, int val ); cmDspRC_t cmDspSetDefaultUInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned nonInitVal, unsigned val ); cmDspRC_t cmDspSetDefaultDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double nonInitVal, double val ); + cmDspRC_t cmDspSetDefaultSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t nonInitVal, cmSample_t val ); + cmDspRC_t cmDspSetDefaultReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t nonInitVal, cmReal_t val ); cmDspRC_t cmDspSetDefaultStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* nonInitVal, const cmChar_t* val ); cmDspRC_t cmDspSetDefaultSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, /*unsigned cmInvalidId*/ unsigned val ); cmDspRC_t cmDspSetDefaultJson( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t* nonInitVal, cmJsonNode_t* val ); @@ -336,6 +342,8 @@ extern "C" { cmDspRC_t cmDspSetInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int val ); cmDspRC_t cmDspSetUInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val ); cmDspRC_t cmDspSetDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double val ); + cmDspRC_t cmDspSetSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t val ); + cmDspRC_t cmDspSetReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t val ); cmDspRC_t cmDspSetStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val ); cmDspRC_t cmDspSetSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val ); cmDspRC_t cmDspSetJson( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t* val );