From 59cec07ccefa3a0942cb01a97756aae2e00df764 Mon Sep 17 00:00:00 2001 From: Kevin Larke Date: Mon, 30 Mar 2015 14:34:30 -0700 Subject: [PATCH] cmDspClass.h/c, cmDspUI.c : Added 'ptr' type variables. Added TakeSeqBldr/Rndr UI allocator functions. --- dsp/cmDspClass.c | 20 ++++++++++++++++++++ dsp/cmDspClass.h | 5 ++++- dsp/cmDspUi.c | 30 +++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/dsp/cmDspClass.c b/dsp/cmDspClass.c index 1fffb6f..bb2c32e 100644 --- a/dsp/cmDspClass.c +++ b/dsp/cmDspClass.c @@ -764,6 +764,15 @@ cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId ) return cmDsvGetReal(vp); } +void* cmDspPtr( cmDspInst_t* inst, unsigned varId ) +{ + cmDspValue_t* vp; + if(_cmDspVarValuePtr(inst,varId,&vp) != kOkDspRC ) + return NULL; + + return cmDsvPtr(vp); +} + const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId ) { cmDspValue_t* vp; @@ -924,6 +933,10 @@ cmDspRC_t cmDspValueSet( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, c cmDsvSetReal(dvp, cmDsvGetReal(svp)); break; + case kPtrDsvFl: + cmDsvSetPtr(dvp, cmDsvGetPtr(svp)); + break; + case kSymDsvFl: cmDsvSetSymbol(dvp, cmDsvGetSymbol(svp)); break; @@ -1184,6 +1197,13 @@ cmDspRC_t cmDspSetReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, return cmDspValueSet(ctx, inst, varId, &v, 0); } +cmDspRC_t cmDspSetPtr( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, void* val ) +{ + cmDspValue_t v; + cmDsvSetPtr(&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 27cfb55..820aa32 100644 --- a/dsp/cmDspClass.h +++ b/dsp/cmDspClass.h @@ -271,6 +271,7 @@ extern "C" { double cmDspDouble( cmDspInst_t* inst, unsigned varId ); cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId ); cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId ); + void* cmDspPtr( 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 ); @@ -346,6 +347,7 @@ extern "C" { 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 cmDspSetPtr( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, void* 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 ); @@ -401,7 +403,8 @@ extern "C" { cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId, unsigned alignVarId ); cmDspRC_t cmDspUiTimeLineCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId, unsigned audPathVarId, unsigned selVarId, unsigned cursVarId ); 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 ); - cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId ); + cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId ); + cmDspRC_t cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId, unsigned refreshVarId, unsigned selVarId ); cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW ); cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx ); diff --git a/dsp/cmDspUi.c b/dsp/cmDspUi.c index 4c94044..8eb388e 100644 --- a/dsp/cmDspUi.c +++ b/dsp/cmDspUi.c @@ -415,20 +415,44 @@ cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFi return rc; } -cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId ) +cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId ) { cmDspRC_t rc; - unsigned arr[] = { fileNameVarId }; + unsigned arr[] = { fileNameVarId, ptrVarId, selVarId, refreshVarId }; cmDspValue_t v; unsigned vn = sizeof(arr)/sizeof(arr[0]); cmDsvSetUIntMtx(&v,arr,vn,1); - // tell the UI to create a time-line control + // tell the UI to create a sequence builder control if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTakeSeqBldrDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC ) return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Take Sequence Builder UI element create failed."); // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change. cmDspInstVarSetFlags( ctx, inst, fileNameVarId, kUiDsvFl ); + cmDspInstVarSetFlags( ctx, inst, ptrVarId, kUiDsvFl ); + cmDspInstVarSetFlags( ctx, inst, selVarId, kUiDsvFl ); + cmDspInstVarSetFlags( ctx, inst, refreshVarId, kUiDsvFl ); + + return rc; +} + + +cmDspRC_t cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId, unsigned refreshVarId, unsigned selVarId ) +{ + cmDspRC_t rc; + unsigned arr[] = { ptrVarId, refreshVarId, selVarId }; + cmDspValue_t v; + unsigned vn = sizeof(arr)/sizeof(arr[0]); + cmDsvSetUIntMtx(&v,arr,vn,1); + + // tell the UI to create a sequence render control + if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTakeSeqRendDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC ) + return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Take Sequence Render UI element create failed."); + + // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change. + cmDspInstVarSetFlags( ctx, inst, ptrVarId, kUiDsvFl ); + cmDspInstVarSetFlags( ctx, inst, refreshVarId, kUiDsvFl ); + cmDspInstVarSetFlags( ctx, inst, selVarId, kUiDsvFl ); return rc; }