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

Added TakeSeqBldr/Rndr UI allocator functions.
This commit is contained in:
Kevin Larke 2015-03-30 14:34:30 -07:00
parent 3a94b42b32
commit 59cec07cce
3 changed files with 51 additions and 4 deletions

View File

@ -764,6 +764,15 @@ cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId )
return cmDsvGetReal(vp); 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 ) const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId )
{ {
cmDspValue_t* vp; cmDspValue_t* vp;
@ -924,6 +933,10 @@ cmDspRC_t cmDspValueSet( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, c
cmDsvSetReal(dvp, cmDsvGetReal(svp)); cmDsvSetReal(dvp, cmDsvGetReal(svp));
break; break;
case kPtrDsvFl:
cmDsvSetPtr(dvp, cmDsvGetPtr(svp));
break;
case kSymDsvFl: case kSymDsvFl:
cmDsvSetSymbol(dvp, cmDsvGetSymbol(svp)); cmDsvSetSymbol(dvp, cmDsvGetSymbol(svp));
break; break;
@ -1184,6 +1197,13 @@ cmDspRC_t cmDspSetReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId,
return cmDspValueSet(ctx, inst, varId, &v, 0); 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 ) cmDspRC_t cmDspSetStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val )
{ {
cmDspValue_t v; cmDspValue_t v;

View File

@ -271,6 +271,7 @@ extern "C" {
double cmDspDouble( cmDspInst_t* inst, unsigned varId ); double cmDspDouble( cmDspInst_t* inst, unsigned varId );
cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId ); cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId );
cmReal_t cmDspReal( 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 ); const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId );
unsigned cmDspSymbol( cmDspInst_t* inst, unsigned varId ); unsigned cmDspSymbol( cmDspInst_t* inst, unsigned varId );
cmJsonNode_t* cmDspJson( 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 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 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 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 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 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 ); 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 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 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 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 cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW );
cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx ); cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

View File

@ -415,20 +415,44 @@ cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFi
return rc; 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; cmDspRC_t rc;
unsigned arr[] = { fileNameVarId }; unsigned arr[] = { fileNameVarId, ptrVarId, selVarId, refreshVarId };
cmDspValue_t v; cmDspValue_t v;
unsigned vn = sizeof(arr)/sizeof(arr[0]); unsigned vn = sizeof(arr)/sizeof(arr[0]);
cmDsvSetUIntMtx(&v,arr,vn,1); 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 ) if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTakeSeqBldrDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC )
return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Take Sequence Builder UI element create failed."); 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. // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change.
cmDspInstVarSetFlags( ctx, inst, fileNameVarId, kUiDsvFl ); 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; return rc;
} }