cmTimeLine.c/h Added cmTimeLineFileName()

This commit is contained in:
kpl 2012-11-01 23:22:58 -07:00
parent fc08764718
commit 81ed3aba41
2 changed files with 28 additions and 21 deletions

View File

@ -48,17 +48,18 @@ typedef struct
typedef struct typedef struct
{ {
cmErr_t err; cmErr_t err;
cmCtx_t ctx; cmCtx_t ctx;
cmLHeapH_t lH; cmLHeapH_t lH;
double srate; double srate;
unsigned nextSeqId; unsigned nextSeqId;
cmTlCb_t cbFunc; cmTlCb_t cbFunc;
void* cbArg; void* cbArg;
unsigned nextUId; unsigned nextUId;
char* tmpBuf; char* tmpBuf;
unsigned seqCnt; unsigned seqCnt;
_cmTlSeq_t* seq; // seq[seqCnt] _cmTlSeq_t* seq; // seq[seqCnt]
const cmChar_t* filename;
} _cmTl_t; } _cmTl_t;
typedef struct 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 ) if((rc = cmTimeLineInitialize(ctx,hp,cbFunc,cbArg)) != kOkTlRC )
return rc; return rc;
//_cmTl_t* p = _cmTlHandleToPtr(*hp);
//_cmTlNotifyListener(p, kInitMsgTlId, NULL );
return cmTimeLineReadJson(*hp,fn); 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 cmTimeLineFinalize( cmTlH_t* hp )
{ {
cmTlRC_t rc; cmTlRC_t rc;
@ -1218,6 +1222,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t h, const cmChar_t* ifn )
} }
p->filename = cmLhAllocStr(p->lH,ifn);
errLabel: errLabel:
if( rc != kOkTlRC ) if( rc != kOkTlRC )

View File

@ -101,22 +101,24 @@ extern "C" {
extern cmTlH_t cmTimeLineNullHandle; extern cmTlH_t cmTimeLineNullHandle;
// //
cmTlRC_t cmTimeLineInitialize( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg ); 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 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 ); cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp );
double cmTimeLineSampleRate( cmTlH_t h );
bool cmTimeLineIsValid( cmTlH_t h );
double cmTimeLineSampleRate( cmTlH_t h );
// Return the object following 'p' assigned to 'seqId'. // Return the object following 'p' assigned to 'seqId'.
// If 'p' is NULL then return the first object 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 '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. // 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'. // 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 ); cmTlMidiFile_t* cmTlNextMidiFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );
cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId ); cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );