cmDspKr.c : cmRecdPlay object only records/plays segments when it recieves

a perfect match to the start of the record/playback segment. Segments
which are specified between the last received score location and the
current location are skipped.
This commit is contained in:
kevin 2014-01-18 16:13:05 -08:00
parent 7584fdd936
commit 8e0fb864e4

View File

@ -2370,6 +2370,7 @@ cmDspClass_t _cmNanoMapDC;
typedef struct typedef struct
{ {
cmDspInst_t inst; cmDspInst_t inst;
} cmDspNanoMap_t; } cmDspNanoMap_t;
cmDspRC_t _cmDspNanoMapSend( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned st, unsigned d0, unsigned d1 ) cmDspRC_t _cmDspNanoMapSend( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned st, unsigned d0, unsigned d1 )
@ -2382,6 +2383,8 @@ cmDspRC_t _cmDspNanoMapSend( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned st, un
void _cmDspNanoMapPgm( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned pgm ) void _cmDspNanoMapPgm( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned pgm )
{ {
cmDspNanoMap_t* p = (cmDspNanoMap_t*)inst;
unsigned i; unsigned i;
for(i=0; i<kMidiChCnt; ++i) for(i=0; i<kMidiChCnt; ++i)
@ -2427,7 +2430,7 @@ cmDspRC_t _cmDspNanoMapReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt ) cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
{ {
//cmDspNanoMap_t* p = (cmDspNanoMap_t*)inst; cmDspNanoMap_t* p = (cmDspNanoMap_t*)inst;
switch( evt->dstVarId ) switch( evt->dstVarId )
{ {
@ -2446,6 +2449,7 @@ cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
status = (status & 0xf0) + ch; status = (status & 0xf0) + ch;
cmDspSetUInt(ctx,inst,kStatusNmId,status); cmDspSetUInt(ctx,inst,kStatusNmId,status);
} }
} }
break; break;
@ -2501,7 +2505,7 @@ typedef struct
unsigned offSymId; unsigned offSymId;
unsigned audioOutBaseId; unsigned audioOutBaseId;
unsigned chCnt; unsigned chCnt;
unsigned scLocIdx; //unsigned scLocIdx;
} cmDspRecdPlay_t; } cmDspRecdPlay_t;
cmDspRC_t _cmDspRecdPlayParseRsrc( cmDspCtx_t* ctx, cmDspInst_t* inst, cmRecdPlay* rcdply ) cmDspRC_t _cmDspRecdPlayParseRsrc( cmDspCtx_t* ctx, cmDspInst_t* inst, cmRecdPlay* rcdply )
@ -2519,7 +2523,7 @@ cmDspRC_t _cmDspRecdPlayParseRsrc( cmDspCtx_t* ctx, cmDspInst_t* inst, cmRecdPla
path = ""; path = "";
cmJsonH_t jsH = cmDspSysPgmRsrcHandle(ctx->dspH); cmJsonH_t jsH = cmDspSysPgmRsrcHandle(ctx->dspH);
cmJsonNode_t* jnp = cmJsonFindValue(jsH,"recdPlay",NULL, kStringTId); cmJsonNode_t* jnp = cmJsonFindValue(jsH,"recdPlay",NULL, kArrayTId);
if( jnp == NULL || cmJsonIsArray(jnp)==false ) if( jnp == NULL || cmJsonIsArray(jnp)==false )
{ {
@ -2585,7 +2589,7 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
cmDspRecdPlay_t* p = (cmDspRecdPlay_t*)inst; cmDspRecdPlay_t* p = (cmDspRecdPlay_t*)inst;
p->scLocIdx = 0; //p->scLocIdx = 0;
if((fn = cmDspStrcz(inst,kFnPrId)) == NULL || strlen(fn)==0 ) if((fn = cmDspStrcz(inst,kFnPrId)) == NULL || strlen(fn)==0 )
@ -2614,7 +2618,7 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
if((rc = _cmDspRecdPlayParseRsrc(ctx,inst,p->rcdply)) != kOkDspRC ) if((rc = _cmDspRecdPlayParseRsrc(ctx,inst,p->rcdply)) != kOkDspRC )
rc = cmDspInstErr(ctx,inst,kInstResetFailDspRC,"The 'recdplay' segment pre-load failed."); rc = cmDspInstErr(ctx,inst,kInstResetFailDspRC,"The 'recdplay' segment pre-load failed.");
p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); //p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
} }
@ -2657,7 +2661,7 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
p->offSymId = cmSymTblId(ctx->stH,"off"); p->offSymId = cmSymTblId(ctx->stH,"off");
p->audioOutBaseId = audioOutBase; p->audioOutBaseId = audioOutBase;
p->chCnt = chCnt; p->chCnt = chCnt;
p->scLocIdx = 0; //p->scLocIdx = 0;
printf("0 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId)); printf("0 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId));
@ -2753,7 +2757,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 = cmDspUInt(inst,kScInitLocIdxPrId); //p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
} }
else else
if( cmDspSymbol(inst,kCmdPrId) == p->offSymId ) if( cmDspSymbol(inst,kCmdPrId) == p->offSymId )
@ -2777,9 +2781,10 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
if( endScLocIdx < cmDspUInt(inst,kScInitLocIdxPrId) ) if( endScLocIdx < cmDspUInt(inst,kScInitLocIdxPrId) )
break; break;
for(; p->scLocIdx<=endScLocIdx; p->scLocIdx+=1) cmScoreLoc_t* loc = cmScoreLoc(p->scH, endScLocIdx );
{ if( loc == NULL )
cmScoreLoc_t* loc = cmScoreLoc(p->scH, p->scLocIdx ); break;
cmScoreMarker_t* mp = loc->markList; cmScoreMarker_t* mp = loc->markList;
for(; mp!=NULL; mp=mp->link) for(; mp!=NULL; mp=mp->link)
@ -2813,9 +2818,9 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
default: default:
break; break;
} }
}
p->scLocIdx = endScLocIdx+1;
//p->scLocIdx = endScLocIdx+1;
} }
break; break;
} }