cmDspKr.c : cmDspRecdPlay now takes an initial score search location index.

This commit is contained in:
kevin 2014-01-16 20:18:48 -08:00
parent fd61da603f
commit e07e632de6

View File

@ -27,7 +27,6 @@
#include "cmDspSys.h" #include "cmDspSys.h"
#include "cmMath.h" #include "cmMath.h"
#include "cmAudioFile.h" #include "cmAudioFile.h"
#include "cmFileSys.h" #include "cmFileSys.h"
#include "cmProcObj.h" #include "cmProcObj.h"
@ -2487,6 +2486,7 @@ enum
kFadeRatePrId, kFadeRatePrId,
kSegFnPrId, kSegFnPrId,
kSegLblPrId, kSegLblPrId,
kScInitLocIdxPrId,
kScLocIdxPrId, kScLocIdxPrId,
kCmdPrId, kCmdPrId,
kInAudioBasePrId kInAudioBasePrId
@ -2548,6 +2548,8 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn); cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn);
} }
p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
} }
return rc; return rc;
@ -2578,6 +2580,7 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
1, "frate", kFadeRatePrId, 0,0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Fade rate in dB per second.", 1, "frate", kFadeRatePrId, 0,0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Fade rate in dB per second.",
1, "segFn", kSegFnPrId, 0,0, kInDsvFl | kStrzDsvFl | kOptArgDsvFl, "Preload an audio segment.", 1, "segFn", kSegFnPrId, 0,0, kInDsvFl | kStrzDsvFl | kOptArgDsvFl, "Preload an audio segment.",
1, "segLbl", kSegLblPrId, 0,0, kInDsvFl | kStrzDsvFl | kOptArgDsvFl, "Score symbol of preloaded audio segment.", 1, "segLbl", kSegLblPrId, 0,0, kInDsvFl | kStrzDsvFl | kOptArgDsvFl, "Score symbol of preloaded audio segment.",
1, "initIdx",kScInitLocIdxPrId,0,0,kInDsvFl | kUIntDsvFl, "Score search start location.",
1, "index", kScLocIdxPrId, 0,0, kInDsvFl | kUIntDsvFl, "Score follower location index.", 1, "index", kScLocIdxPrId, 0,0, kInDsvFl | kUIntDsvFl, "Score follower location index.",
1, "cmd", kCmdPrId, 0,0, kInDsvFl | kSymDsvFl, "on=reset off=stop.", 1, "cmd", kCmdPrId, 0,0, kInDsvFl | kSymDsvFl, "on=reset off=stop.",
chCnt, "in", kInAudioBasePrId,0,1, kInDsvFl | kAudioBufDsvFl, "Audio input", chCnt, "in", kInAudioBasePrId,0,1, kInDsvFl | kAudioBufDsvFl, "Audio input",
@ -2598,6 +2601,7 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
cmDspSetDefaultDouble(ctx,&p->inst, kMaxLaSecsPrId,0.0, 2.0); cmDspSetDefaultDouble(ctx,&p->inst, kMaxLaSecsPrId,0.0, 2.0);
cmDspSetDefaultDouble(ctx,&p->inst, kCurLaSecsPrId,0.0, 0.1); cmDspSetDefaultDouble(ctx,&p->inst, kCurLaSecsPrId,0.0, 0.1);
cmDspSetDefaultDouble(ctx,&p->inst, kFadeRatePrId, 0.0, 1.0); cmDspSetDefaultDouble(ctx,&p->inst, kFadeRatePrId, 0.0, 1.0);
cmDspSetDefaultUInt( ctx,&p->inst, kScInitLocIdxPrId,0,0);
printf("1 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId)); printf("1 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId));
@ -2685,7 +2689,7 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
{ {
printf("rewind\n"); printf("rewind\n");
cmRecdPlayRewind(p->rcdply); cmRecdPlayRewind(p->rcdply);
p->scLocIdx = 0; p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
} }
else else
if( cmDspSymbol(inst,kCmdPrId) == p->offSymId ) if( cmDspSymbol(inst,kCmdPrId) == p->offSymId )
@ -2698,9 +2702,16 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
cmRecdPlaySetLaSecs(p->rcdply, cmDspDouble(inst,kCurLaSecsPrId)); cmRecdPlaySetLaSecs(p->rcdply, cmDspDouble(inst,kCurLaSecsPrId));
break; break;
case kScInitLocIdxPrId:
printf("init-idx:%i\n",cmDspUInt(inst,kScInitLocIdxPrId));
break;
case kScLocIdxPrId: case kScLocIdxPrId:
{ {
unsigned endScLocIdx = cmDspUInt(inst,kScLocIdxPrId) ; unsigned endScLocIdx = cmDspUInt(inst,kScLocIdxPrId);
if( endScLocIdx < cmDspUInt(inst,kScInitLocIdxPrId) )
break;
for(; p->scLocIdx<=endScLocIdx; p->scLocIdx+=1) for(; p->scLocIdx<=endScLocIdx; p->scLocIdx+=1)
{ {
@ -2711,12 +2722,12 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
switch( mp->markTypeId ) switch( mp->markTypeId )
{ {
case kRecdBegScMId: case kRecdBegScMId:
printf("recd-beg\n"); printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId ); cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId );
break; break;
case kRecdEndScMId: case kRecdEndScMId:
printf("recd-end\n"); printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
cmRecdPlayEndRecord(p->rcdply, mp->labelSymId ); cmRecdPlayEndRecord(p->rcdply, mp->labelSymId );
break; break;