|
@@ -774,20 +774,23 @@ cmTlRC_t _cmTlAllocMidiFileRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
|
774
|
774
|
return rc;
|
775
|
775
|
}
|
776
|
776
|
|
777
|
|
-cmTlRC_t _cmTlAllocMarkerRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmChar_t* refIdStr, int begSmpIdx, unsigned durSmpCnt, unsigned seqId, const cmChar_t* text )
|
|
777
|
+cmTlRC_t _cmTlAllocMarkerRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmChar_t* refIdStr, int begSmpIdx, unsigned durSmpCnt, unsigned seqId, const cmChar_t* text, unsigned bar, const cmChar_t* sectionStr )
|
778
|
778
|
{
|
779
|
|
- cmTlRC_t rc = kOkTlRC;
|
780
|
|
- _cmTlObj_t* op = NULL;
|
781
|
|
- const cmChar_t* textStr = text==NULL ? "" : text;
|
|
779
|
+ cmTlRC_t rc = kOkTlRC;
|
|
780
|
+ _cmTlObj_t* op = NULL;
|
|
781
|
+ const cmChar_t* textStr = text==NULL ? "" : text;
|
|
782
|
+ const cmChar_t* sectStr = sectionStr==NULL ? "" : sectionStr;
|
782
|
783
|
|
783
|
784
|
// add memory at the end of the the cmTlMarker_t record to hold the text string.
|
784
|
|
- unsigned recdByteCnt = sizeof(cmTlMarker_t) + strlen(textStr) + 1;
|
|
785
|
+ unsigned recdByteCnt = sizeof(cmTlMarker_t) + strlen(textStr) + sizeof(bar) + strlen(sectStr) + 2;
|
|
786
|
+
|
785
|
787
|
|
786
|
788
|
if((rc = _cmTlAllocRecd(p,nameStr,refIdStr,begSmpIdx,durSmpCnt,kMarkerTlId,seqId,recdByteCnt,&op)) != kOkTlRC )
|
787
|
789
|
goto errLabel;
|
788
|
790
|
|
789
|
791
|
assert(op != NULL);
|
790
|
792
|
|
|
793
|
+ // get a ptr to the marker part of the object
|
791
|
794
|
cmTlMarker_t* mp = _cmTimeLineMarkerObjPtr(p,op->obj);
|
792
|
795
|
|
793
|
796
|
assert(mp != NULL );
|
|
@@ -795,9 +798,15 @@ cmTlRC_t _cmTlAllocMarkerRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmChar
|
795
|
798
|
// copy the marker text string into the memory just past the cmTlMarker_t recd.
|
796
|
799
|
cmChar_t* tp = (cmChar_t*)(mp + 1);
|
797
|
800
|
strcpy(tp,textStr);
|
|
801
|
+
|
|
802
|
+ // copy the section label string into memory just past the markers text string
|
|
803
|
+ cmChar_t* sp = strlen(tp) + 1;
|
|
804
|
+ strcpy(sp,sectStr);
|
798
|
805
|
|
799
|
|
- mp->text = tp;
|
800
|
|
- op->obj->text = tp;
|
|
806
|
+ mp->text = tp;
|
|
807
|
+ mp->sectionStr = sp;
|
|
808
|
+ mp->bar = bar;
|
|
809
|
+ op->obj->text = tp;
|
801
|
810
|
|
802
|
811
|
// notify listeners
|
803
|
812
|
//_cmTlNotifyListener(p, kInsertMsgTlId, op );
|
|
@@ -843,7 +852,7 @@ cmTlRC_t _cmTlAllocAudioEvtRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
|
843
|
852
|
return rc;
|
844
|
853
|
}
|
845
|
854
|
|
846
|
|
-cmTlRC_t _cmTlAllocRecdFromJson(_cmTl_t* p,const cmChar_t* nameStr, const cmChar_t* typeIdStr,const cmChar_t* refIdStr, int begSmpIdx, unsigned durSmpCnt, unsigned seqId, const cmChar_t* textStr)
|
|
855
|
+cmTlRC_t _cmTlAllocRecdFromJson(_cmTl_t* p,const cmChar_t* nameStr, const cmChar_t* typeIdStr,const cmChar_t* refIdStr, int begSmpIdx, unsigned durSmpCnt, unsigned seqId, const cmChar_t* textStr, unsigned bar, const cmChar_t* sectionStr)
|
847
|
856
|
{
|
848
|
857
|
cmTlRC_t rc = kOkTlRC;
|
849
|
858
|
unsigned typeId = _cmTlIdLabelToId(p,typeIdStr);
|
|
@@ -852,7 +861,7 @@ cmTlRC_t _cmTlAllocRecdFromJson(_cmTl_t* p,const cmChar_t* nameStr, const cmChar
|
852
|
861
|
{
|
853
|
862
|
case kAudioFileTlId: rc = _cmTlAllocAudioFileRecd(p,nameStr,refIdStr,begSmpIdx, seqId,textStr); break;
|
854
|
863
|
case kMidiFileTlId: rc = _cmTlAllocMidiFileRecd( p,nameStr,refIdStr,begSmpIdx, seqId,textStr); break;
|
855
|
|
- case kMarkerTlId: rc = _cmTlAllocMarkerRecd( p,nameStr,refIdStr,begSmpIdx,durSmpCnt,seqId,textStr); break;
|
|
864
|
+ case kMarkerTlId: rc = _cmTlAllocMarkerRecd( p,nameStr,refIdStr,begSmpIdx,durSmpCnt,seqId,textStr,bar,sectionStr); break;
|
856
|
865
|
case kAudioEvtTlId: rc = _cmTlAllocAudioEvtRecd( p,nameStr,refIdStr,begSmpIdx,durSmpCnt,seqId,textStr); break;
|
857
|
866
|
default:
|
858
|
867
|
rc = cmErrMsg(&p->err,kParseFailTlRC,"'%s' is not a valid 'objArray' record type.",cmStringNullGuard(typeIdStr));
|
|
@@ -1146,7 +1155,7 @@ cmTlRC_t cmTimeLineInsert( cmTlH_t h, const cmChar_t* nameStr, unsigned typeId,
|
1146
|
1155
|
{
|
1147
|
1156
|
_cmTl_t* p = _cmTlHandleToPtr(h);
|
1148
|
1157
|
|
1149
|
|
- return _cmTlAllocRecdFromJson(p, nameStr, _cmTlIdToLabel(p,typeId), refObjNameStr, begSmpIdx, durSmpCnt, seqId, fn);
|
|
1158
|
+ return _cmTlAllocRecdFromJson(p, nameStr, _cmTlIdToLabel(p,typeId), refObjNameStr, begSmpIdx, durSmpCnt, seqId, fn, 0, NULL);
|
1150
|
1159
|
}
|
1151
|
1160
|
|
1152
|
1161
|
cmTlObj_t* _cmTimeLineFindFile( _cmTl_t* p, const cmChar_t* fn, unsigned typeId )
|
|
@@ -1356,6 +1365,8 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
1356
|
1365
|
unsigned durSmpCnt;
|
1357
|
1366
|
unsigned seqId;
|
1358
|
1367
|
const cmChar_t* textStr;
|
|
1368
|
+ unsigned bar = 0;
|
|
1369
|
+ const cmChar_t* sectStr = NULL;
|
1359
|
1370
|
|
1360
|
1371
|
if( cmJsonMemberValues(rp,&errLabelPtr,
|
1361
|
1372
|
"label",kStringTId,&nameStr,
|
|
@@ -1365,6 +1376,8 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
1365
|
1376
|
"smpCnt",kIntTId,&durSmpCnt,
|
1366
|
1377
|
"trackId",kIntTId,&seqId,
|
1367
|
1378
|
"textStr",kStringTId,&textStr,
|
|
1379
|
+ "bar", kIntTId | kOptArgJsFl,&bar,
|
|
1380
|
+ "sectStr",kStringTId | kOptArgJsFl,§Str,
|
1368
|
1381
|
NULL) != kOkJsRC )
|
1369
|
1382
|
{
|
1370
|
1383
|
rc = _cmTlParseErr(&p->err, errLabelPtr, i, ifn );
|
|
@@ -1372,7 +1385,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
1372
|
1385
|
}
|
1373
|
1386
|
|
1374
|
1387
|
|
1375
|
|
- if((rc = _cmTlAllocRecdFromJson(p,nameStr,typeIdStr,refIdStr,begSmpIdx,durSmpCnt,seqId,textStr)) != kOkTlRC )
|
|
1388
|
+ if((rc = _cmTlAllocRecdFromJson(p,nameStr,typeIdStr,refIdStr,begSmpIdx,durSmpCnt,seqId,textStr,bar,sectStr)) != kOkTlRC )
|
1376
|
1389
|
goto errLabel;
|
1377
|
1390
|
|
1378
|
1391
|
}
|