From 744da472189b30423c11f35473d8cb0b1ba26f0f Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 16:05:11 -0500 Subject: [PATCH 01/14] cmProc4.h/c : Added cmRecdPlayInsertRecord() to the cmRecdPlay object. --- cmProc4.c | 40 ++++++++++++++++++++++++++++++++++++++++ cmProc4.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/cmProc4.c b/cmProc4.c index a7d0cba..475c79e 100644 --- a/cmProc4.c +++ b/cmProc4.c @@ -4352,6 +4352,46 @@ cmRC_t cmRecdPlayEndRecord( cmRecdPlay* p, unsigned labelSymId ) return cmCtxRtCondition( &p->obj, cmInvalidArgRC, "The fragment label symbol id '%i' not found for 'end record'.",labelSymId); } +cmRC_t cmRecdPlayInsertRecord(cmRecdPlay* p, unsigned labelSymId, const cmChar_t* wavFn ) +{ + cmRC_t rc = cmOkRC; + unsigned i; + + for(i=0; ifragCnt; ++i) + if( p->frags[i].labelSymId == labelSymId ) + { + cmAudioFileH_t afH = cmNullAudioFileH; + cmAudioFileInfo_t afInfo; + cmRC_t afRC = kOkAfRC; + + // open the audio file + if( cmAudioFileIsValid( afH = cmAudioFileNewOpen(wavFn, &afInfo, &afRC, p->obj.err.rpt )) == false ) + return cmCtxRtCondition( &p->obj, cmInvalidArgRC, "The audio file '%s' could not be opened'.",cmStringNullGuard(wavFn)); + + // ignore blank + if( afInfo.frameCnt == 0 ) + return cmOkRC; + + // allocate buffer space + unsigned j; + for(j=0; jchCnt; ++j) + p->frags[i].chArray[j] = cmMemResize(cmSample_t,p->frags[i].chArray[j],afInfo.frameCnt); + + p->frags[i].allocCnt = afInfo.frameCnt; + + // read samples into the buffer space + unsigned chIdx = 0; + unsigned chCnt = cmMin(p->chCnt,afInfo.chCnt); + unsigned actFrmCnt = 0; + if( cmAudioFileReadSample(afH,afInfo.frameCnt,chIdx,chCnt,&p->frags[i].chArray, &actFrmCnt) != kOkAfRC ) + return cmCtxRtCondition(&p->obj, cmSubSysFailRC, "Read failed on the audio file '%s'.",cmStringNullGuard(wavFn)); + + } + + return cmCtxRtCondition( &p->obj, cmInvalidArgRC, "The fragment label symbol id '%i' not found for 'begin record'.",labelSymId); +} + + cmRC_t cmRecdPlayBeginPlay( cmRecdPlay* p, unsigned labelSymId ) { unsigned i; diff --git a/cmProc4.h b/cmProc4.h index eaabff7..82cc243 100644 --- a/cmProc4.h +++ b/cmProc4.h @@ -688,6 +688,8 @@ extern "C" { cmRC_t cmRecdPlayBeginRecord( cmRecdPlay* p, unsigned labelSymId ); cmRC_t cmRecdPlayEndRecord( cmRecdPlay* p, unsigned labelSymId ); + cmRC_t cmRecdPlayInsertRecord(cmRecdPlay* p, unsigned labelSymId, const cmChar_t* wavFn ); + cmRC_t cmRecdPlayBeginPlay( cmRecdPlay* p, unsigned labelSymId ); cmRC_t cmRecdPlayEndPlay( cmRecdPlay* p, unsigned labelSymId ); From a19d93b2653a993f28aa2cb9253b2436c910e5a0 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 16:05:45 -0500 Subject: [PATCH 02/14] cmDspKr.c : Added ability to preload a cmRecdPlay segment from an audio file. --- dsp/cmDspKr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index 9a14f8f..1e6c7ef 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -2485,6 +2485,8 @@ enum kMaxLaSecsPrId, kCurLaSecsPrId, kFadeRatePrId, + kSegFnPrId, + kSegLblPrId, kScLocIdxPrId, kCmdPrId, kInAudioBasePrId @@ -2537,6 +2539,15 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) for(i=0; ircdply,i, cmScoreMarkerLabelSymbolId(p->scH,i )); + const cmChar_t* segFn = cmDspStrcz(inst,kSegFnPrId); + const cmChar_t* segLbl= cmDspStrcz(inst,kSegLblPrId); + + if( cmTextLength(segFn)>0 && cmTextLength(segLbl)>0 ) + { + unsigned segSymId = cmSymTblRegisterSymbol(ctx->stH,segLbl); + cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn); + } + } return rc; @@ -2565,6 +2576,8 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig 1, "maxla", kMaxLaSecsPrId, 0,0, kInDsvFl | kDoubleDsvFl | kReqArgDsvFl, "Maximum look-ahead buffer in seconds.", 1, "curla", kCurLaSecsPrId, 0,0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Current look-head buffer in seconds.", 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, "segLbl", kSegLblPrId, 0,0, kInDsvFl | kStrzDsvFl | kOptArgDsvFl, "Score symbol of preloaded audio segment.", 1, "index", kScLocIdxPrId, 0,0, kInDsvFl | kUIntDsvFl, "Score follower location index.", 1, "cmd", kCmdPrId, 0,0, kInDsvFl | kSymDsvFl, "on=reset off=stop.", chCnt, "in", kInAudioBasePrId,0,1, kInDsvFl | kAudioBufDsvFl, "Audio input", @@ -2589,6 +2602,8 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig printf("1 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId)); + + return &p->inst; } From f96e26138227c1f1890480dde8643cbc82d52a07 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 15:05:24 -0800 Subject: [PATCH 03/14] cmDspPgmKr.c : Added 'useWtFl' to cmDspSysPgm_Timeline. --- dsp/cmDspPgmKr.c | 66 ++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/dsp/cmDspPgmKr.c b/dsp/cmDspPgmKr.c index b8d3e14..1c32c63 100644 --- a/dsp/cmDspPgmKr.c +++ b/dsp/cmDspPgmKr.c @@ -61,8 +61,6 @@ cmDspRC_t krLoadRsrc(cmDspSysH_t h, cmErr_t* err, krRsrc_t* r) cmDspRsrcString(h,&r->midiDevice, "midiDevice", NULL); cmDspRsrcString(h,&r->midiOutPort, "midiOutPort", NULL); - - if((rc = cmDspSysLastRC(h)) != kOkDspRC ) cmErrMsg(err,rc,"A KR DSP resource load failed."); @@ -364,6 +362,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) cmErr_t err; krRsrc_t r; bool fragFl = false; + bool useWtFl = true; unsigned wtLoopCnt = 1; // 1=play once (-1=loop forever) unsigned wtInitMode = 0; // initial wt mode is 'silence' unsigned wtSmpCnt = floor(cmDspSysSampleRate(h)); // wt length == srate @@ -498,21 +497,22 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) // Audio connections cmDspSysConnectAudio(h, php, "out", wtp, "phs" ); // phs -> wt - cmDspSysConnectAudio(h, wtp, "out", au0Sw, "a-in-0" ); // wt -> sw - - /* - cmDspSysConnectAudio(h, ai0p, "out", au0Sw, "a-in-1" ); // ain -> sw - cmDspSysConnectAudio(h, ai0p, "out", mi0p, "in" ); - cmDspSysConnectAudio(h, au0Sw, "a-out", rpp, "in-0"); // sw -> rcdply - cmDspSysConnectAudio(h, au0Sw, "a-out", c0.kr0,"in" ); // sw -> kr - cmDspSysConnectAudio(h, au0Sw, "a-out", c0.kr1,"in" ); // sw -> kr - */ - - - cmDspSysConnectAudio(h, ai0p, "out", rpp, "in-0"); // sw -> rcdply - cmDspSysConnectAudio(h, ai0p, "out", c0.kr0, "in" ); // ain -> sw - cmDspSysConnectAudio(h, ai0p, "out", c0.kr1, "in" ); // ain -> sw - cmDspSysConnectAudio(h, ai0p, "out", mi0p, "in" ); + if( useWtFl ) + { + cmDspSysConnectAudio(h, wtp, "out", au0Sw, "a-in-0" ); // wt -> sw + cmDspSysConnectAudio(h, ai0p, "out", au0Sw, "a-in-1" ); // ain -> sw + cmDspSysConnectAudio(h, ai0p, "out", mi0p, "in" ); + cmDspSysConnectAudio(h, au0Sw, "a-out", rpp, "in-0"); // sw -> rcdply + cmDspSysConnectAudio(h, au0Sw, "a-out", c0.kr0,"in" ); // sw -> kr + cmDspSysConnectAudio(h, au0Sw, "a-out", c0.kr1,"in" ); // sw -> kr + } + else + { + cmDspSysConnectAudio(h, ai0p, "out", rpp, "in-0"); // sw -> rcdply + cmDspSysConnectAudio(h, ai0p, "out", c0.kr0, "in" ); // ain -> sw + cmDspSysConnectAudio(h, ai0p, "out", c0.kr1, "in" ); // ain -> sw + cmDspSysConnectAudio(h, ai0p, "out", mi0p, "in" ); + } if( fragFl ) { @@ -525,22 +525,26 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) else { cmDspSysConnectAudio(h, c0.cmp, "out", ao0p, "in" ); + //cmDspSysConnectAudio(h, wtp, "out", ao0p, "in" ); } - cmDspSysConnectAudio(h, wtp, "out", au1Sw, "a-in-0" ); // wt -> sw - /* - cmDspSysConnectAudio(h, ai1p, "out", au1Sw, "a-in-1" ); // ain -> sw - cmDspSysConnectAudio(h, ai1p, "out", mi1p, "in" ); - cmDspSysConnectAudio(h, au1Sw, "a-out", rpp, "in-1"); // sw -> rcdply - cmDspSysConnectAudio(h, au1Sw, "a-out", c1.kr0,"in" ); // sw -> kr - cmDspSysConnectAudio(h, au1Sw, "a-out", c1.kr1,"in" ); // sw -> kr - */ - - cmDspSysConnectAudio(h, ai1p, "out", rpp, "in-1"); // sw -> rcdply - cmDspSysConnectAudio(h, ai1p, "out", c1.kr0, "in" ); // ain -> sw - cmDspSysConnectAudio(h, ai1p, "out", c1.kr1, "in" ); // ain -> sw - cmDspSysConnectAudio(h, ai1p, "out", mi1p, "in" ); + if( useWtFl ) + { + cmDspSysConnectAudio(h, wtp, "out", au1Sw, "a-in-0" ); // wt -> sw + cmDspSysConnectAudio(h, ai1p, "out", au1Sw, "a-in-1" ); // ain -> sw + cmDspSysConnectAudio(h, ai1p, "out", mi1p, "in" ); + cmDspSysConnectAudio(h, au1Sw, "a-out", rpp, "in-1"); // sw -> rcdply + cmDspSysConnectAudio(h, au1Sw, "a-out", c1.kr0,"in" ); // sw -> kr + cmDspSysConnectAudio(h, au1Sw, "a-out", c1.kr1,"in" ); // sw -> kr + } + else + { + cmDspSysConnectAudio(h, ai1p, "out", rpp, "in-1"); // sw -> rcdply + cmDspSysConnectAudio(h, ai1p, "out", c1.kr0, "in" ); // ain -> sw + cmDspSysConnectAudio(h, ai1p, "out", c1.kr1, "in" ); // ain -> sw + cmDspSysConnectAudio(h, ai1p, "out", mi1p, "in" ); + } if( fragFl ) { @@ -553,6 +557,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) else { cmDspSysConnectAudio(h, c1.cmp, "out", ao1p, "in" ); // cmp -> mix 0 + //cmDspSysConnectAudio(h, wtp, "out", ao1p, "in" ); + } cmDspSysConnectAudio(h, c0.cmp, "out", afop, "in0" ); // comp -> audio_file_out From f2d06b68bd2e3128648f0027d055f707eafe652a Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 17:12:04 -0800 Subject: [PATCH 04/14] cmProc4.c : fixed call to cmAudioFileReadSample() in cmRecdPlayInsertRecord(). --- cmProc4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmProc4.c b/cmProc4.c index 475c79e..2a139de 100644 --- a/cmProc4.c +++ b/cmProc4.c @@ -4383,9 +4383,10 @@ cmRC_t cmRecdPlayInsertRecord(cmRecdPlay* p, unsigned labelSymId, const unsigned chIdx = 0; unsigned chCnt = cmMin(p->chCnt,afInfo.chCnt); unsigned actFrmCnt = 0; - if( cmAudioFileReadSample(afH,afInfo.frameCnt,chIdx,chCnt,&p->frags[i].chArray, &actFrmCnt) != kOkAfRC ) + if( cmAudioFileReadSample(afH,afInfo.frameCnt,chIdx,chCnt,p->frags[i].chArray, &actFrmCnt) != kOkAfRC ) return cmCtxRtCondition(&p->obj, cmSubSysFailRC, "Read failed on the audio file '%s'.",cmStringNullGuard(wavFn)); + return rc; } return cmCtxRtCondition( &p->obj, cmInvalidArgRC, "The fragment label symbol id '%i' not found for 'begin record'.",labelSymId); From fd61da603fd73767b2d2f43dc033dbeb20736faa Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 20:17:55 -0800 Subject: [PATCH 05/14] cmProc4.c : cmRecdPlayInsertRecord() now sets frag.recdIdx field to the actual number of sample frames read rather than the number allocated. --- cmProc4.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmProc4.c b/cmProc4.c index 2a139de..7c1365c 100644 --- a/cmProc4.c +++ b/cmProc4.c @@ -4386,6 +4386,8 @@ cmRC_t cmRecdPlayInsertRecord(cmRecdPlay* p, unsigned labelSymId, const if( cmAudioFileReadSample(afH,afInfo.frameCnt,chIdx,chCnt,p->frags[i].chArray, &actFrmCnt) != kOkAfRC ) return cmCtxRtCondition(&p->obj, cmSubSysFailRC, "Read failed on the audio file '%s'.",cmStringNullGuard(wavFn)); + p->frags[i].recdIdx = actFrmCnt; + return rc; } From e07e632de63dac3487b9a79c65706b3b7eddf876 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 20:18:48 -0800 Subject: [PATCH 06/14] cmDspKr.c : cmDspRecdPlay now takes an initial score search location index. --- dsp/cmDspKr.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index 1e6c7ef..8a607d2 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -27,7 +27,6 @@ #include "cmDspSys.h" #include "cmMath.h" - #include "cmAudioFile.h" #include "cmFileSys.h" #include "cmProcObj.h" @@ -2487,6 +2486,7 @@ enum kFadeRatePrId, kSegFnPrId, kSegLblPrId, + kScInitLocIdxPrId, kScLocIdxPrId, kCmdPrId, kInAudioBasePrId @@ -2548,6 +2548,8 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn); } + p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); + } 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, "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, "initIdx",kScInitLocIdxPrId,0,0,kInDsvFl | kUIntDsvFl, "Score search start location.", 1, "index", kScLocIdxPrId, 0,0, kInDsvFl | kUIntDsvFl, "Score follower location index.", 1, "cmd", kCmdPrId, 0,0, kInDsvFl | kSymDsvFl, "on=reset off=stop.", chCnt, "in", kInAudioBasePrId,0,1, kInDsvFl | kAudioBufDsvFl, "Audio input", @@ -2598,10 +2601,11 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig cmDspSetDefaultDouble(ctx,&p->inst, kMaxLaSecsPrId,0.0, 2.0); cmDspSetDefaultDouble(ctx,&p->inst, kCurLaSecsPrId,0.0, 0.1); 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)); - + return &p->inst; @@ -2685,7 +2689,7 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_ { printf("rewind\n"); cmRecdPlayRewind(p->rcdply); - p->scLocIdx = 0; + p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); } else 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)); break; + case kScInitLocIdxPrId: + printf("init-idx:%i\n",cmDspUInt(inst,kScInitLocIdxPrId)); + break; + 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) { @@ -2711,12 +2722,12 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_ switch( mp->markTypeId ) { case kRecdBegScMId: - printf("recd-beg\n"); + printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId ); break; case kRecdEndScMId: - printf("recd-end\n"); + printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); cmRecdPlayEndRecord(p->rcdply, mp->labelSymId ); break; From c0fb38d8b781a24d0c4cba72cfd049dbadbcefb3 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 20:20:01 -0800 Subject: [PATCH 07/14] cmDspPgmKr.c : RecdPlay object now takes an initial score search location from the score UI. --- dsp/cmDspPgmKr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dsp/cmDspPgmKr.c b/dsp/cmDspPgmKr.c index 1c32c63..a081cc3 100644 --- a/dsp/cmDspPgmKr.c +++ b/dsp/cmDspPgmKr.c @@ -361,8 +361,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) cmCtx_t* cmCtx = cmDspSysPgmCtx(h); cmErr_t err; krRsrc_t r; - bool fragFl = false; - bool useWtFl = true; + bool fragFl = true; + bool useWtFl = false; unsigned wtLoopCnt = 1; // 1=play once (-1=loop forever) unsigned wtInitMode = 0; // initial wt mode is 'silence' unsigned wtSmpCnt = floor(cmDspSysSampleRate(h)); // wt length == srate @@ -397,7 +397,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, r.midiDevice,r.midiOutPort); cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 1, r.scFn, sfBufCnt, sfMaxWndCnt, sfMinVel, sfEnaMeasFl ); cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 ); - cmDspInst_t* rpp = cmDspSysAllocInst(h,"RecdPlay", NULL, 6, 2, r.scFn, recdPlayInitAllocSecs, recdPlayMaxLaSecs, recdPlayCurLaSecs, recdPlayFadeRateDbPerSec ); + cmDspInst_t* rpp = cmDspSysAllocInst(h,"RecdPlay", NULL, 8, 2, r.scFn, recdPlayInitAllocSecs, recdPlayMaxLaSecs, recdPlayCurLaSecs, recdPlayFadeRateDbPerSec, "/Users/kevin/src/cmkc/src/kc/data/seg_118.wav", "118" ); cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" ); cmDspInst_t* modr = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" ); @@ -695,7 +695,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) cmDspSysInstallCb(h, scp, "sel", sfp, "index", NULL ); cmDspSysInstallCb(h, scp, "sel", modp,"reset", NULL ); cmDspSysInstallCb(h, scp, "sel", modr,"reset", NULL ); - + cmDspSysInstallCb(h, scp, "sel", rpp, "initIdx", NULL ); + cmDspSysInstallCb(h, scp, "sel", prp, "in", NULL ); //cmDspSysInstallCb(h, reload,"out", modp, "reload", NULL ); From 57faeb20e61dc12a1abb4e3d7601898436df817f Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 20:20:25 -0800 Subject: [PATCH 08/14] cmAudioPortOsx.c : Added #include "cmTime.h" --- osx/cmAudioPortOsx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/osx/cmAudioPortOsx.c b/osx/cmAudioPortOsx.c index 9d428c9..063dff5 100644 --- a/osx/cmAudioPortOsx.c +++ b/osx/cmAudioPortOsx.c @@ -6,6 +6,7 @@ #include "cmPrefix.h" #include "cmGlobal.h" #include "cmRpt.h" +#include "cmTime.h" #include "cmAudioPort.h" #include "cmMem.h" #include "cmMallocDebug.h" From 5851b40dc10e0237026f4bec2de0e513d5507452 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 Jan 2014 20:21:37 -0800 Subject: [PATCH 09/14] cmMidiOsx.c : Added use of delta time to time stamp in call to cmMpParseMidiData(). The time stamp value still needs to be verified. --- osx/cmMidiOsx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osx/cmMidiOsx.c b/osx/cmMidiOsx.c index 6d193a0..cced912 100644 --- a/osx/cmMidiOsx.c +++ b/osx/cmMidiOsx.c @@ -10,6 +10,7 @@ #include "cmCtx.h" #include "cmMem.h" #include "cmMallocDebug.h" +#include "cmTime.h" #include "cmMidi.h" #include "cmMidiPort.h" @@ -507,7 +508,7 @@ void _cmMpMIDISystemReadProc( const MIDIPacketList *pktListPtr, void* readProcRe double nano = 1e-9 * ( (double) _cmMpRoot.timeBaseInfo.numer) / ((double) _cmMpRoot.timeBaseInfo.denom); - // so here's the delta in nanoseconds: + // so here's the timestamp in nanoseconds: double nanoSeconds = ((double) packetPtr->timeStamp) * nano; // 1000 times that for microSeconds: @@ -516,13 +517,17 @@ void _cmMpMIDISystemReadProc( const MIDIPacketList *pktListPtr, void* readProcRe // BUG BUG BUG: How can multiplying the nanoseconds produce microseconds? // Shouldn't the nano to micro conversion be a divide? - double deltaMicroSecs = microSecs - pp->prevMicroSecs; + //double deltaMicroSecs = microSecs - pp->prevMicroSecs; pp->prevMicroSecs = microSecs; + cmTimeSpec_t ts; + ts.tv_sec = floor(microSecs / 1000000.0); + ts.tv_nsec = (microSecs - ts.tv_sec * 1000000.0) * 1000.0; + assert( pp->inputFl == true ); - cmMpParseMidiData( pp->parserH, (unsigned)deltaMicroSecs, packetPtr->data, packetPtr->length ); + cmMpParseMidiData( pp->parserH, &ts, packetPtr->data, packetPtr->length ); packetPtr = MIDIPacketNext(packetPtr); } From 5c36dfcf9a93b0b41d143a5000984e8ca8991d4d Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 17 Jan 2014 16:53:54 -0500 Subject: [PATCH 10/14] cmScore.c : Changed _cmScParseMarkers() to allow multiple recd/play markers on the same line. --- app/cmScore.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/app/cmScore.c b/app/cmScore.c index 40be491..8733fff 100644 --- a/app/cmScore.c +++ b/app/cmScore.c @@ -613,29 +613,31 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text, if( cmSymTblIsValid(p->stH) == false ) return kOkScRC; - // go to command/id space - if((ip = cmTextNextWhiteOrEosC(text)) == NULL ) - goto errLabel; - - // goto label - if((ip = cmTextNextNonWhiteC(ip)) == NULL ) - goto errLabel; - - // goto end of label - if((ep = cmTextNextWhiteOrEosC(ip)) == NULL ) - goto errLabel; - else + for(;(cp = cmTextNextNonWhiteC(cp)) != NULL; cp=ep ) { - unsigned n = (ep-ip)+1; - cmChar_t markTextStr[n+1]; - strncpy(markTextStr,ip,n); + // go to command/id space + if((ip = cmTextNextWhiteOrEosC(cp)) == NULL ) + goto errLabel; - // for each command code - // (there may be more than one character) - for(; *cp && !isspace(*cp); ++cp) + // goto label + if((ip = cmTextNextNonWhiteC(ip)) == NULL ) + goto errLabel; + + // goto end of label + if((ep = cmTextNextWhiteOrEosC(ip)) == NULL ) + goto errLabel; + else { - cmMarkScMId_t cmdId = kInvalidScMId; + unsigned n = (ep-ip)+1; + cmChar_t markTextStr[n+1]; + strncpy(markTextStr,ip,n); + markTextStr[n] = 0; + // remove any trailing white space + cmTextTrimEnd(markTextStr); + + cmMarkScMId_t cmdId = kInvalidScMId; + switch( *cp ) { case 'c': cmdId = kRecdBegScMId; break; @@ -653,6 +655,8 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text, mp->scoreIdx = scoreIdx; mp->csvRowIdx = rowIdx; + //printf("%i %c '%s'\n",rowIdx,*cp,markTextStr); + // insert the new mark at the end of the list if( p->markList == NULL ) p->markList = mp; @@ -665,7 +669,9 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text, ep->link = mp; } } + } + return kOkScRC; errLabel: From 84782a1fa8dc51382496d01e9dbd4389cc7b145b Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 17 Jan 2014 16:54:24 -0500 Subject: [PATCH 11/14] cmText.h/c : Added cmTextTrimBegin(),cmTextTrimEnd() and cmTextTime(). --- cmText.c | 43 +++++++++++++++++++++++++++++++++++++++++++ cmText.h | 5 +++++ 2 files changed, 48 insertions(+) diff --git a/cmText.c b/cmText.c index 00a22c1..300676d 100644 --- a/cmText.c +++ b/cmText.c @@ -519,6 +519,49 @@ void cmTextClip( cmChar_t* s, unsigned n ) } +cmChar_t* cmTextTrimBegin( cmChar_t* s ) +{ + if( s==NULL || strlen(s) == 0 ) + return s; + + cmChar_t* s0 = cmTextNextNonWhite(s); + + // no non-white char's exist + if( s0 == NULL ) + { + s[0] = 0; + return s; + } + + if( s0 != s ) + cmTextShrinkS(s,s,s0-s); + + return s; +} + +cmChar_t* cmTextTrimEnd( cmChar_t* s ) +{ + unsigned sn; + + if( s==NULL || (sn = strlen(s))==0) + return s; + + cmChar_t* s0 = cmTextLastNonWhiteChar(s); + + if(s0-s+1 < sn ) + s[s0-s+1] = 0; + + + return s; +} + +cmChar_t* cmTextTrim( cmChar_t* s) +{ + cmTextTrimBegin(s); + cmTextTrimEnd(s); + return s; +} + cmChar_t* cmTextExpandS( cmChar_t* s, const cmChar_t* t, unsigned tn ) { return cmVOC_Expand(s,strlen(s)+1,t,tn); } diff --git a/cmText.h b/cmText.h index cca3818..fde6e70 100644 --- a/cmText.h +++ b/cmText.h @@ -161,6 +161,11 @@ extern "C" { // Remove the last n characters from s by inserting a '\0' at s[ strlen(s)-n ]. void cmTextClip( cmChar_t* s, unsigned n ); + // Trim white space from the begining/end/both of a string + cmChar_t* cmTextTrimBegin( cmChar_t* s ); + cmChar_t* cmTextTrimEnd( cmChar_t* s ); + cmChar_t* cmTextTrim( cmChar_t* ); + // Expand s by copying all bytes past t to t+tn. cmChar_t* cmTextExpandS( cmChar_t* s, const cmChar_t* t, unsigned tn ); From d37fd59317f9a2a20739b7256e48768dcf40287b Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 17 Jan 2014 16:59:38 -0500 Subject: [PATCH 12/14] cmDspKr.c : Added ability to pre-load a list of segments for the cmRecdPlay object. --- dsp/cmDspKr.c | 92 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index 8a607d2..d74021f 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -2484,8 +2484,6 @@ enum kMaxLaSecsPrId, kCurLaSecsPrId, kFadeRatePrId, - kSegFnPrId, - kSegLblPrId, kScInitLocIdxPrId, kScLocIdxPrId, kCmdPrId, @@ -2506,6 +2504,80 @@ typedef struct unsigned scLocIdx; } cmDspRecdPlay_t; +cmDspRC_t _cmDspRecdPlayParseRsrc( cmDspCtx_t* ctx, cmDspInst_t* inst, cmRecdPlay* rcdply ) +{ + cmDspRC_t rc = kOkDspRC; + const cmChar_t* path = NULL; + + // read the 'recdplay' audio file path + if( cmDspRsrcString( ctx->dspH, &path, "recdPlayPath", NULL ) != kOkDspRC ) + { + cmDspInstErr(ctx,inst,kRsrcNotFoundDspRC,"The 'recdPlayPath' resource string was not found."); + } + + if( path == NULL ) + path = ""; + + cmJsonH_t jsH = cmDspSysPgmRsrcHandle(ctx->dspH); + cmJsonNode_t* jnp = cmJsonFindValue(jsH,"recdPlay",NULL, kStringTId); + + if( jnp == NULL || cmJsonIsArray(jnp)==false ) + { + // this is really a warning - the object does not require preloaded segments. + cmDspInstErr(ctx,inst,kRsrcNotFoundDspRC,"The 'recdPlay' resource used to define pre-loaded segments was not found."); + return kOkDspRC; + } + + unsigned n = cmJsonChildCount(jnp); + unsigned i; + + // for each 'recdplay' segment record + for(i=0; istH,label)) == cmInvalidId ) + { + rc = cmDspInstErr(ctx,inst,kSymNotFoundDspRC,"The 'recdPlay' pre-load segment symbol '%s' could not be found or registered.",cmStringNullGuard(label)); + goto errLabel; + } + + // create the full path name for the segment audio file + if((fn = cmFsMakeFn( path, fn, NULL, NULL )) == NULL ) + { + rc = cmDspInstErr(ctx,inst,kFileSysFailDspRC,"The 'recdPlay' file name '%s/%s' could not be generated.",cmStringNullGuard(path),cmStringNullGuard(fn)); + goto errLabel; + } + + + // pre-load the segment + if( cmRecdPlayInsertRecord(rcdply,segSymId,fn) != cmOkRC ) + rc = cmDspInstErr(ctx,inst,kSubSysFailDspRC,"The 'recdPlay' segment label:'%s' file:'%s' could not be loaded.",cmStringNullGuard(label),cmStringNullGuard(fn)); + + + cmFsFreeFn(fn); + + } + + errLabel: + return rc; +} + cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) { cmDspRC_t rc =kOkDspRC; @@ -2517,10 +2589,10 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) if((fn = cmDspStrcz(inst,kFnPrId)) == NULL || strlen(fn)==0 ) - return cmErrMsg(&inst->classPtr->err, kInvalidArgDspRC, "No score file name supplied."); + return cmDspInstErr(ctx,inst, kInvalidArgDspRC, "No score file name supplied."); if( cmScoreInitialize(ctx->cmCtx, &p->scH, fn, cmDspSampleRate(ctx), NULL, 0, NULL, NULL, ctx->stH ) != kOkScRC ) - return cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Unable to open the score '%s'.",fn); + return cmDspInstErr(ctx,inst, kSubSysFailDspRC, "Unable to open the score '%s'.",fn); if( cmScoreIsValid(p->scH) ) { @@ -2539,14 +2611,8 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) for(i=0; ircdply,i, cmScoreMarkerLabelSymbolId(p->scH,i )); - const cmChar_t* segFn = cmDspStrcz(inst,kSegFnPrId); - const cmChar_t* segLbl= cmDspStrcz(inst,kSegLblPrId); - - if( cmTextLength(segFn)>0 && cmTextLength(segLbl)>0 ) - { - unsigned segSymId = cmSymTblRegisterSymbol(ctx->stH,segLbl); - cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn); - } + if((rc = _cmDspRecdPlayParseRsrc(ctx,inst,p->rcdply)) != kOkDspRC ) + rc = cmDspInstErr(ctx,inst,kInstResetFailDspRC,"The 'recdplay' segment pre-load failed."); p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); @@ -2578,8 +2644,6 @@ cmDspInst_t* _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig 1, "maxla", kMaxLaSecsPrId, 0,0, kInDsvFl | kDoubleDsvFl | kReqArgDsvFl, "Maximum look-ahead buffer in seconds.", 1, "curla", kCurLaSecsPrId, 0,0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Current look-head buffer in seconds.", 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, "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, "cmd", kCmdPrId, 0,0, kInDsvFl | kSymDsvFl, "on=reset off=stop.", From 7584fdd936d547f5bfb57818f9bd68a389c7f9c4 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 17 Jan 2014 17:00:51 -0500 Subject: [PATCH 13/14] cmDspPgmKr.c : Removed segment filename/label from cmRecdPlay object. cmRecdPlay objects now take a resource based list of segments to pre-load. --- dsp/cmDspPgmKr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsp/cmDspPgmKr.c b/dsp/cmDspPgmKr.c index a081cc3..b76f5de 100644 --- a/dsp/cmDspPgmKr.c +++ b/dsp/cmDspPgmKr.c @@ -397,7 +397,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, r.midiDevice,r.midiOutPort); cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 1, r.scFn, sfBufCnt, sfMaxWndCnt, sfMinVel, sfEnaMeasFl ); cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 ); - cmDspInst_t* rpp = cmDspSysAllocInst(h,"RecdPlay", NULL, 8, 2, r.scFn, recdPlayInitAllocSecs, recdPlayMaxLaSecs, recdPlayCurLaSecs, recdPlayFadeRateDbPerSec, "/Users/kevin/src/cmkc/src/kc/data/seg_118.wav", "118" ); + cmDspInst_t* rpp = cmDspSysAllocInst(h,"RecdPlay", NULL, 6, 2, r.scFn, recdPlayInitAllocSecs, recdPlayMaxLaSecs, recdPlayCurLaSecs, recdPlayFadeRateDbPerSec); cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" ); cmDspInst_t* modr = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" ); From 8e0fb864e4f27e56111074bb95b11cbaa3ebea01 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 18 Jan 2014 16:13:05 -0800 Subject: [PATCH 14/14] 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. --- dsp/cmDspKr.c | 85 +++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index d74021f..5512919 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -2370,6 +2370,7 @@ cmDspClass_t _cmNanoMapDC; typedef struct { cmDspInst_t inst; + } cmDspNanoMap_t; 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 ) { + cmDspNanoMap_t* p = (cmDspNanoMap_t*)inst; + unsigned i; for(i=0; idstVarId ) { @@ -2438,7 +2441,7 @@ cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t case kStatusNmId: { - unsigned status = cmDsvGetUInt(evt->valuePtr); + unsigned status = cmDsvGetUInt(evt->valuePtr); if( (status & 0xf0) == kNoteOnMdId ) { 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; cmDspSetUInt(ctx,inst,kStatusNmId,status); } + } break; @@ -2501,7 +2505,7 @@ typedef struct unsigned offSymId; unsigned audioOutBaseId; unsigned chCnt; - unsigned scLocIdx; + //unsigned scLocIdx; } cmDspRecdPlay_t; 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 = ""; 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 ) { @@ -2585,7 +2589,7 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst ) cmDspRecdPlay_t* p = (cmDspRecdPlay_t*)inst; - p->scLocIdx = 0; + //p->scLocIdx = 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 ) 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->audioOutBaseId = audioOutBase; p->chCnt = chCnt; - p->scLocIdx = 0; + //p->scLocIdx = 0; 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"); cmRecdPlayRewind(p->rcdply); - p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); + //p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId); } else 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) ) break; - for(; p->scLocIdx<=endScLocIdx; p->scLocIdx+=1) - { - cmScoreLoc_t* loc = cmScoreLoc(p->scH, p->scLocIdx ); - cmScoreMarker_t* mp = loc->markList; + cmScoreLoc_t* loc = cmScoreLoc(p->scH, endScLocIdx ); + if( loc == NULL ) + break; - for(; mp!=NULL; mp=mp->link) - switch( mp->markTypeId ) - { - case kRecdBegScMId: - printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); - cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId ); - break; + cmScoreMarker_t* mp = loc->markList; + + for(; mp!=NULL; mp=mp->link) + switch( mp->markTypeId ) + { + case kRecdBegScMId: + printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); + cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId ); + break; - case kRecdEndScMId: - printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); - cmRecdPlayEndRecord(p->rcdply, mp->labelSymId ); - break; + case kRecdEndScMId: + printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId)); + cmRecdPlayEndRecord(p->rcdply, mp->labelSymId ); + break; - case kPlayBegScMId: - printf("play-beg\n"); - cmRecdPlayBeginPlay(p->rcdply, mp->labelSymId ); - break; + case kPlayBegScMId: + printf("play-beg\n"); + cmRecdPlayBeginPlay(p->rcdply, mp->labelSymId ); + break; - case kPlayEndScMId: - printf("play-end\n"); - cmRecdPlayEndPlay(p->rcdply, mp->labelSymId ); - break; + case kPlayEndScMId: + printf("play-end\n"); + cmRecdPlayEndPlay(p->rcdply, mp->labelSymId ); + break; - case kFadeScMId: - printf("fade-beg\n"); - cmRecdPlayBeginFade(p->rcdply, mp->labelSymId, cmDspDouble(inst,kFadeRatePrId) ); - break; + case kFadeScMId: + printf("fade-beg\n"); + cmRecdPlayBeginFade(p->rcdply, mp->labelSymId, cmDspDouble(inst,kFadeRatePrId) ); + break; - default: - break; - } - } + default: + break; + } + - p->scLocIdx = endScLocIdx+1; + //p->scLocIdx = endScLocIdx+1; } break; }