cmDspClass.h,cmDspUi.c,cmDspKr.c : Added 'meas' inputs to cmDspScore and cmDspTimeline to allow the current score and timeline location to be set programattically.

This commit is contained in:
kevin 2016-05-23 18:41:49 -04:00
parent 712b804662
commit 068cff567b
3 changed files with 24 additions and 11 deletions

View File

@ -403,8 +403,8 @@ extern "C" {
cmDspRC_t cmDspUiMeterCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId, unsigned maxVarId, unsigned valVarId, unsigned lblVarId ); cmDspRC_t cmDspUiMeterCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId, unsigned maxVarId, unsigned valVarId, unsigned lblVarId );
cmDspRC_t cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId ); cmDspRC_t cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
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 measVarId, 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, unsigned kMeasScId );
cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId ); 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 cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId, unsigned refreshVarId, unsigned selVarId );
cmDspRC_t cmDspUi2dCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId, unsigned yVarId, unsigned radiusVarId, unsigned angleVarId); cmDspRC_t cmDspUi2dCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId, unsigned yVarId, unsigned radiusVarId, unsigned angleVarId);

View File

@ -290,6 +290,7 @@ enum
kTlFileTlId, kTlFileTlId,
kPrefixPathTlId, kPrefixPathTlId,
kSelTlId, kSelTlId,
kMeasTlId,
kCursTlId, kCursTlId,
kResetTlId, kResetTlId,
kAudFnTlId, kAudFnTlId,
@ -299,7 +300,7 @@ enum
kBegAudSmpIdxTlId, kBegAudSmpIdxTlId,
kEndAudSmpIdxTlId, kEndAudSmpIdxTlId,
kBegMidiSmpIdxTlId, kBegMidiSmpIdxTlId,
kEndMidiSmpIdxTlId kEndMidiSmpIdxTlId,
}; };
cmDspClass_t _cmTimeLineDC; cmDspClass_t _cmTimeLineDC;
@ -318,6 +319,7 @@ cmDspInst_t* _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
{ "tlfile", kTlFileTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Time line file." }, { "tlfile", kTlFileTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Time line file." },
{ "path", kPrefixPathTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Time line data file prefix path" }, { "path", kPrefixPathTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Time line data file prefix path" },
{ "sel", kSelTlId, 0, 0, kInDsvFl | kOutDsvFl | kUIntDsvFl, "Selected marker id."}, { "sel", kSelTlId, 0, 0, kInDsvFl | kOutDsvFl | kUIntDsvFl, "Selected marker id."},
{ "meas", kMeasTlId, 0, 0, kInDsvFl | kUIntDsvFl, "Select a bar marker and generate a 'sel' output."},
{ "curs", kCursTlId, 0, 0, kInDsvFl | kUIntDsvFl, "Current audio file index."}, { "curs", kCursTlId, 0, 0, kInDsvFl | kUIntDsvFl, "Current audio file index."},
{ "reset", kResetTlId, 0, 0, kInDsvFl | kSymDsvFl, "Resend all outputs." }, { "reset", kResetTlId, 0, 0, kInDsvFl | kSymDsvFl, "Resend all outputs." },
{ "afn", kAudFnTlId, 0, 0, kOutDsvFl | kStrzDsvFl, "Selected Audio file." }, { "afn", kAudFnTlId, 0, 0, kOutDsvFl | kStrzDsvFl, "Selected Audio file." },
@ -345,7 +347,7 @@ cmDspInst_t* _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
cmDspSetDefaultInt( ctx, &p->inst, kEndMidiSmpIdxTlId, 0, cmInvalidIdx); cmDspSetDefaultInt( ctx, &p->inst, kEndMidiSmpIdxTlId, 0, cmInvalidIdx);
// create the UI control // create the UI control
cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kPrefixPathTlId,kSelTlId,kCursTlId); cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kPrefixPathTlId,kSelTlId,kMeasTlId,kCursTlId);
p->tlH = cmTimeLineNullHandle; p->tlH = cmTimeLineNullHandle;
@ -443,6 +445,10 @@ cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
break; break;
case kMeasTlId:
cmDspSetEvent(ctx,inst,evt);
break;
default: default:
{assert(0);} {assert(0);}
} }
@ -483,7 +489,8 @@ enum
kEvtIdxScId, kEvtIdxScId,
kDynScId, kDynScId,
kValTypeScId, kValTypeScId,
kValueScId kValueScId,
kMeasScId,
}; };
cmDspClass_t _cmScoreDC; cmDspClass_t _cmScoreDC;
@ -513,6 +520,7 @@ cmDspInst_t* _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
{ "dyn", kDynScId, 0, 0, kOutDsvFl | kUIntDsvFl, "Dynamic level of previous event index."}, { "dyn", kDynScId, 0, 0, kOutDsvFl | kUIntDsvFl, "Dynamic level of previous event index."},
{ "type", kValTypeScId,0, 0, kOutDsvFl | kUIntDsvFl, "Output variable type."}, { "type", kValTypeScId,0, 0, kOutDsvFl | kUIntDsvFl, "Output variable type."},
{ "value", kValueScId, 0, 0, kOutDsvFl | kDoubleDsvFl, "Output variable value."}, { "value", kValueScId, 0, 0, kOutDsvFl | kDoubleDsvFl, "Output variable value."},
{ "meas", kMeasScId, 0, 0, kInDsvFl | kUIntDsvFl, "Trigger this measures location to emit from 'sel'."},
{ NULL, 0, 0, 0, 0 } { NULL, 0, 0, 0, 0 }
}; };
@ -523,7 +531,7 @@ cmDspInst_t* _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"dump"); p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"dump");
// create the UI control // create the UI control
cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId,kSmpIdxScId,kD0ScId,kD1ScId,kLocIdxScId,kEvtIdxScId,kDynScId,kValTypeScId,kValueScId); cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId,kSmpIdxScId,kD0ScId,kD1ScId,kLocIdxScId,kEvtIdxScId,kDynScId,kValTypeScId,kValueScId,kMeasScId);
p->scH = cmScNullHandle; p->scH = cmScNullHandle;
@ -637,6 +645,9 @@ cmDspRC_t _cmDspScoreRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
cmScorePrintLoc(p->scH); cmScorePrintLoc(p->scH);
break; break;
case kMeasScId:
break;
} }
return kOkDspRC; return kOkDspRC;

View File

@ -362,10 +362,10 @@ cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lbl
return rc; return rc;
} }
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 measVarId, unsigned cursVarId )
{ {
cmDspRC_t rc; cmDspRC_t rc;
unsigned arr[] = { tlFileVarId, audPathVarId, selVarId, cursVarId }; unsigned arr[] = { tlFileVarId, audPathVarId, selVarId, measVarId, cursVarId };
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);
@ -383,14 +383,15 @@ cmDspRC_t cmDspUiTimeLineCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned
cmDspInstVarSetFlags( ctx, inst, tlFileVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, tlFileVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, audPathVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, audPathVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, selVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, selVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, measVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, cursVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, cursVarId, kUiDsvFl );
return rc; return rc;
} }
cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarId, unsigned evtIdxVarId, unsigned dynVarId, unsigned valTypeVarId, unsigned valueVarId ) cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarId, unsigned evtIdxVarId, unsigned dynVarId, unsigned valTypeVarId, unsigned valueVarId, unsigned measVarId )
{ {
cmDspRC_t rc; cmDspRC_t rc;
unsigned arr[] = { scFileVarId, selVarId, smpIdxVarId, pitchVarId, velVarId, locIdxVarId, evtIdxVarId, dynVarId, valTypeVarId, valueVarId }; unsigned arr[] = { scFileVarId, selVarId, smpIdxVarId, pitchVarId, velVarId, locIdxVarId, evtIdxVarId, dynVarId, valTypeVarId, valueVarId, measVarId };
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);
@ -411,6 +412,7 @@ cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFi
cmDspInstVarSetFlags( ctx, inst, dynVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, dynVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, valTypeVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, valTypeVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, valueVarId, kUiDsvFl ); cmDspInstVarSetFlags( ctx, inst, valueVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, measVarId, kUiDsvFl );
return rc; return rc;
} }