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:
parent
7584fdd936
commit
8e0fb864e4
@ -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 )
|
||||||
{
|
{
|
||||||
@ -2438,7 +2441,7 @@ cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
|
|||||||
|
|
||||||
case kStatusNmId:
|
case kStatusNmId:
|
||||||
{
|
{
|
||||||
unsigned status = cmDsvGetUInt(evt->valuePtr);
|
unsigned status = cmDsvGetUInt(evt->valuePtr);
|
||||||
if( (status & 0xf0) == kNoteOnMdId )
|
if( (status & 0xf0) == kNoteOnMdId )
|
||||||
{
|
{
|
||||||
unsigned d0 = cmDspUInt(inst,kD0NmId);
|
unsigned d0 = cmDspUInt(inst,kD0NmId);
|
||||||
@ -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,45 +2781,46 @@ 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;
|
|
||||||
|
|
||||||
for(; mp!=NULL; mp=mp->link)
|
cmScoreMarker_t* mp = loc->markList;
|
||||||
switch( mp->markTypeId )
|
|
||||||
{
|
for(; mp!=NULL; mp=mp->link)
|
||||||
case kRecdBegScMId:
|
switch( mp->markTypeId )
|
||||||
printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
|
{
|
||||||
cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId );
|
case kRecdBegScMId:
|
||||||
break;
|
printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
|
||||||
|
cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId );
|
||||||
|
break;
|
||||||
|
|
||||||
case kRecdEndScMId:
|
case kRecdEndScMId:
|
||||||
printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
|
printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
|
||||||
cmRecdPlayEndRecord(p->rcdply, mp->labelSymId );
|
cmRecdPlayEndRecord(p->rcdply, mp->labelSymId );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPlayBegScMId:
|
case kPlayBegScMId:
|
||||||
printf("play-beg\n");
|
printf("play-beg\n");
|
||||||
cmRecdPlayBeginPlay(p->rcdply, mp->labelSymId );
|
cmRecdPlayBeginPlay(p->rcdply, mp->labelSymId );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPlayEndScMId:
|
case kPlayEndScMId:
|
||||||
printf("play-end\n");
|
printf("play-end\n");
|
||||||
cmRecdPlayEndPlay(p->rcdply, mp->labelSymId );
|
cmRecdPlayEndPlay(p->rcdply, mp->labelSymId );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFadeScMId:
|
case kFadeScMId:
|
||||||
printf("fade-beg\n");
|
printf("fade-beg\n");
|
||||||
cmRecdPlayBeginFade(p->rcdply, mp->labelSymId, cmDspDouble(inst,kFadeRatePrId) );
|
cmRecdPlayBeginFade(p->rcdply, mp->labelSymId, cmDspDouble(inst,kFadeRatePrId) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
p->scLocIdx = endScLocIdx+1;
|
//p->scLocIdx = endScLocIdx+1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user