diff --git a/app/cmTimeLine.c b/app/cmTimeLine.c index 3f36079..eb93dd4 100644 --- a/app/cmTimeLine.c +++ b/app/cmTimeLine.c @@ -48,17 +48,18 @@ typedef struct typedef struct { - cmErr_t err; - cmCtx_t ctx; - cmLHeapH_t lH; - double srate; - unsigned nextSeqId; - cmTlCb_t cbFunc; - void* cbArg; - unsigned nextUId; - char* tmpBuf; - unsigned seqCnt; - _cmTlSeq_t* seq; // seq[seqCnt] + cmErr_t err; + cmCtx_t ctx; + cmLHeapH_t lH; + double srate; + unsigned nextSeqId; + cmTlCb_t cbFunc; + void* cbArg; + unsigned nextUId; + char* tmpBuf; + unsigned seqCnt; + _cmTlSeq_t* seq; // seq[seqCnt] + const cmChar_t* filename; } _cmTl_t; typedef struct @@ -922,12 +923,15 @@ cmTlRC_t cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbF if((rc = cmTimeLineInitialize(ctx,hp,cbFunc,cbArg)) != kOkTlRC ) return rc; - //_cmTl_t* p = _cmTlHandleToPtr(*hp); - //_cmTlNotifyListener(p, kInitMsgTlId, NULL ); - return cmTimeLineReadJson(*hp,fn); } +const cmChar_t* cmTimeLineFileName( cmTlH_t h ) +{ + _cmTl_t* p = _cmTlHandleToPtr(h); + return p->filename; +} + cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp ) { cmTlRC_t rc; @@ -1218,6 +1222,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t h, const cmChar_t* ifn ) } + p->filename = cmLhAllocStr(p->lH,ifn); errLabel: if( rc != kOkTlRC ) diff --git a/app/cmTimeLine.h b/app/cmTimeLine.h index ea640bb..c20d0fa 100644 --- a/app/cmTimeLine.h +++ b/app/cmTimeLine.h @@ -101,22 +101,24 @@ extern "C" { extern cmTlH_t cmTimeLineNullHandle; // - cmTlRC_t cmTimeLineInitialize( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg ); - cmTlRC_t cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg, const cmChar_t* fn ); + cmTlRC_t cmTimeLineInitialize( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg ); + cmTlRC_t cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg, const cmChar_t* fn ); - cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp ); + const cmChar_t* cmTimeLineFileName( cmTlH_t h ); - bool cmTimeLineIsValid( cmTlH_t h ); - double cmTimeLineSampleRate( cmTlH_t h ); + cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp ); + + bool cmTimeLineIsValid( cmTlH_t h ); + double cmTimeLineSampleRate( cmTlH_t h ); // Return the object following 'p' assigned to 'seqId'. // If 'p' is NULL then return the first object assigned to seqId. // If 'seqId' is set to cmInvalidId then return the next object on any seq. // If no objects follow 'p' on the specified sequence then return NULL. - cmTlObj_t* cmTimeLineNextObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId ); + cmTlObj_t* cmTimeLineNextObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId ); // Same as cmTimeLineNextObj() but returns next object whose type matches 'typeId'. - cmTlObj_t* cmTimeLineNextTypeObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId, unsigned typeId ); + cmTlObj_t* cmTimeLineNextTypeObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId, unsigned typeId ); cmTlMidiFile_t* cmTlNextMidiFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId ); cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );