|
|
|
|
879
|
kSmpIdxSfId,
|
879
|
kSmpIdxSfId,
|
880
|
kCmdSfId,
|
880
|
kCmdSfId,
|
881
|
kOutSfId,
|
881
|
kOutSfId,
|
|
|
882
|
+ kRecentSfId,
|
882
|
kDynSfId,
|
883
|
kDynSfId,
|
883
|
kEvenSfId,
|
884
|
kEvenSfId,
|
884
|
kTempoSfId,
|
885
|
kTempoSfId,
|
|
|
|
|
904
|
cmDspScFolCbArg_t arg;
|
905
|
cmDspScFolCbArg_t arg;
|
905
|
unsigned printSymId;
|
906
|
unsigned printSymId;
|
906
|
unsigned quietSymId;
|
907
|
unsigned quietSymId;
|
|
|
908
|
+ unsigned maxScLocIdx;
|
907
|
} cmDspScFol_t;
|
909
|
} cmDspScFol_t;
|
908
|
|
910
|
|
909
|
cmDspInst_t* _cmDspScFolAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
911
|
cmDspInst_t* _cmDspScFolAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
|
|
|
|
921
|
{ "d1", kD1SfId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI data byte 1"},
|
923
|
{ "d1", kD1SfId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI data byte 1"},
|
922
|
{ "smpidx",kSmpIdxSfId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI time tag as a sample index"},
|
924
|
{ "smpidx",kSmpIdxSfId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI time tag as a sample index"},
|
923
|
{ "cmd", kCmdSfId, 0, 0, kInDsvFl | kSymDsvFl, "Command input: print | quiet"},
|
925
|
{ "cmd", kCmdSfId, 0, 0, kInDsvFl | kSymDsvFl, "Command input: print | quiet"},
|
924
|
- { "out", kOutSfId, 0, 0, kOutDsvFl| kUIntDsvFl, "Current score location index."},
|
|
|
|
|
926
|
+ { "out", kOutSfId, 0, 0, kOutDsvFl| kUIntDsvFl, "Maximum score location index."},
|
|
|
927
|
+ { "recent",kRecentSfId, 0, 0, kOutDsvFl| kUIntDsvFl, "Most recent score location index."},
|
925
|
{ "dyn", kDynSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Dynamic value."},
|
928
|
{ "dyn", kDynSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Dynamic value."},
|
926
|
{ "even", kEvenSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Evenness value."},
|
929
|
{ "even", kEvenSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Evenness value."},
|
927
|
{ "tempo", kTempoSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Tempo value."},
|
930
|
{ "tempo", kTempoSfId, 0, 0, kOutDsvFl| kDoubleDsvFl, "Tempo value."},
|
|
|
|
|
939
|
p->smp = cmScMeasAlloc( ctx->cmProcCtx, NULL, cmScNullHandle, 0, NULL, 0 );
|
942
|
p->smp = cmScMeasAlloc( ctx->cmProcCtx, NULL, cmScNullHandle, 0, NULL, 0 );
|
940
|
p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"print");
|
943
|
p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"print");
|
941
|
p->quietSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"quiet");
|
944
|
p->quietSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"quiet");
|
|
|
945
|
+ p->maxScLocIdx= cmInvalidIdx;
|
942
|
|
946
|
|
943
|
cmDspSetDefaultUInt( ctx, &p->inst, kBufCntSfId, 0, 7);
|
947
|
cmDspSetDefaultUInt( ctx, &p->inst, kBufCntSfId, 0, 7);
|
944
|
cmDspSetDefaultUInt( ctx, &p->inst, kMaxWndCntSfId, 0, 10);
|
948
|
cmDspSetDefaultUInt( ctx, &p->inst, kMaxWndCntSfId, 0, 10);
|
|
|
|
|
946
|
cmDspSetDefaultUInt( ctx, &p->inst, kMinVelSfId, 0, 5);
|
950
|
cmDspSetDefaultUInt( ctx, &p->inst, kMinVelSfId, 0, 5);
|
947
|
cmDspSetDefaultUInt( ctx, &p->inst, kIndexSfId, 0, 0);
|
951
|
cmDspSetDefaultUInt( ctx, &p->inst, kIndexSfId, 0, 0);
|
948
|
cmDspSetDefaultUInt( ctx, &p->inst, kOutSfId, 0, 0);
|
952
|
cmDspSetDefaultUInt( ctx, &p->inst, kOutSfId, 0, 0);
|
|
|
953
|
+ cmDspSetDefaultUInt( ctx, &p->inst, kRecentSfId, 0, 0);
|
949
|
cmDspSetDefaultDouble( ctx, &p->inst, kDynSfId, 0, 0);
|
954
|
cmDspSetDefaultDouble( ctx, &p->inst, kDynSfId, 0, 0);
|
950
|
cmDspSetDefaultDouble( ctx, &p->inst, kEvenSfId, 0, 0);
|
955
|
cmDspSetDefaultDouble( ctx, &p->inst, kEvenSfId, 0, 0);
|
951
|
cmDspSetDefaultDouble( ctx, &p->inst, kTempoSfId, 0, 0);
|
956
|
cmDspSetDefaultDouble( ctx, &p->inst, kTempoSfId, 0, 0);
|
|
|
|
|
1094
|
case kIndexSfId:
|
1099
|
case kIndexSfId:
|
1095
|
if( cmScoreIsValid(p->scH) )
|
1100
|
if( cmScoreIsValid(p->scH) )
|
1096
|
{
|
1101
|
{
|
|
|
1102
|
+ p->maxScLocIdx = cmInvalidIdx;
|
|
|
1103
|
+
|
1097
|
if( cmScMeasReset( p->smp ) != cmOkRC )
|
1104
|
if( cmScMeasReset( p->smp ) != cmOkRC )
|
1098
|
cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Score measure unit reset to score index '%i' failed.");
|
1105
|
cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Score measure unit reset to score index '%i' failed.");
|
1099
|
|
1106
|
|
|
|
|
|
1115
|
// this call may result in a callback to _cmScFolMatcherCb()
|
1122
|
// this call may result in a callback to _cmScFolMatcherCb()
|
1116
|
if( cmScMatcherExec(p->sfp, cmDspUInt(inst,kSmpIdxSfId), cmDspUInt(inst,kStatusSfId), cmDspUInt(inst,kD0SfId), cmDspUInt(inst,kD1SfId), &scLocIdx) == cmOkRC )
|
1123
|
if( cmScMatcherExec(p->sfp, cmDspUInt(inst,kSmpIdxSfId), cmDspUInt(inst,kStatusSfId), cmDspUInt(inst,kD0SfId), cmDspUInt(inst,kD1SfId), &scLocIdx) == cmOkRC )
|
1117
|
if( scLocIdx != cmInvalidIdx )
|
1124
|
if( scLocIdx != cmInvalidIdx )
|
1118
|
- cmDspSetUInt(ctx,inst,kOutSfId,scLocIdx);
|
|
|
|
|
1125
|
+ {
|
|
|
1126
|
+ // It is possible that the internal score follower may go backwards.
|
|
|
1127
|
+ // In this case it will report a given score location multiple times or out of time order.
|
|
|
1128
|
+ // The 'out' port will only be updated under the circumstances that no later
|
|
|
1129
|
+ // score location has been seen - so the last output from 'out' always reports
|
|
|
1130
|
+ // the furthest possible progress in the score. THe 'recent' output simply reports
|
|
|
1131
|
+ // the most recent output from the internal score follower which may include
|
|
|
1132
|
+ // previously reported or out of order score locations.
|
|
|
1133
|
+ cmDspSetUInt(ctx,inst,kRecentSfId,scLocIdx);
|
|
|
1134
|
+
|
|
|
1135
|
+ if( p->maxScLocIdx==cmInvalidIdx || p->maxScLocIdx < scLocIdx )
|
|
|
1136
|
+ {
|
|
|
1137
|
+ p->maxScLocIdx = scLocIdx;
|
|
|
1138
|
+ cmDspSetUInt(ctx,inst,kOutSfId,scLocIdx);
|
|
|
1139
|
+ }
|
|
|
1140
|
+ }
|
1119
|
}
|
1141
|
}
|
1120
|
break;
|
1142
|
break;
|
1121
|
|
1143
|
|