Browse Source

cmTimeLine.c/h Added cmTimeLineFileName()

master
kpl 12 years ago
parent
commit
81ed3aba41
2 changed files with 28 additions and 21 deletions
  1. 19
    14
      app/cmTimeLine.c
  2. 9
    7
      app/cmTimeLine.h

+ 19
- 14
app/cmTimeLine.c View File

48
 
48
 
49
 typedef struct
49
 typedef struct
50
 {
50
 {
51
-  cmErr_t     err;
52
-  cmCtx_t     ctx;
53
-  cmLHeapH_t  lH;
54
-  double      srate;
55
-  unsigned    nextSeqId;
56
-  cmTlCb_t    cbFunc;
57
-  void*       cbArg;
58
-  unsigned    nextUId;
59
-  char*       tmpBuf;  
60
-  unsigned    seqCnt;
61
-  _cmTlSeq_t*  seq;    // seq[seqCnt]
51
+  cmErr_t         err;
52
+  cmCtx_t         ctx;
53
+  cmLHeapH_t      lH;
54
+  double          srate;
55
+  unsigned        nextSeqId;
56
+  cmTlCb_t        cbFunc;
57
+  void*           cbArg;
58
+  unsigned        nextUId;
59
+  char*           tmpBuf;  
60
+  unsigned        seqCnt;
61
+  _cmTlSeq_t*     seq;          // seq[seqCnt]
62
+  const cmChar_t* filename;
62
 } _cmTl_t;
63
 } _cmTl_t;
63
 
64
 
64
 typedef struct
65
 typedef struct
922
   if((rc = cmTimeLineInitialize(ctx,hp,cbFunc,cbArg)) != kOkTlRC )
923
   if((rc = cmTimeLineInitialize(ctx,hp,cbFunc,cbArg)) != kOkTlRC )
923
     return rc;
924
     return rc;
924
 
925
 
925
-  //_cmTl_t* p = _cmTlHandleToPtr(*hp);
926
-  //_cmTlNotifyListener(p, kInitMsgTlId, NULL );
927
-
928
   return  cmTimeLineReadJson(*hp,fn);
926
   return  cmTimeLineReadJson(*hp,fn);
929
 }
927
 }
930
 
928
 
929
+const cmChar_t* cmTimeLineFileName( cmTlH_t h )
930
+{ 
931
+  _cmTl_t* p = _cmTlHandleToPtr(h);  
932
+  return p->filename; 
933
+}
934
+
931
 cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp )
935
 cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp )
932
 {
936
 {
933
   cmTlRC_t rc;
937
   cmTlRC_t rc;
1218
     
1222
     
1219
   }
1223
   }
1220
   
1224
   
1225
+  p->filename = cmLhAllocStr(p->lH,ifn);
1221
 
1226
 
1222
  errLabel:
1227
  errLabel:
1223
   if( rc != kOkTlRC )
1228
   if( rc != kOkTlRC )

+ 9
- 7
app/cmTimeLine.h View File

101
   extern cmTlH_t cmTimeLineNullHandle;
101
   extern cmTlH_t cmTimeLineNullHandle;
102
 
102
 
103
   // 
103
   // 
104
-  cmTlRC_t   cmTimeLineInitialize( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg );
105
-  cmTlRC_t   cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg, const cmChar_t* fn );
104
+  cmTlRC_t        cmTimeLineInitialize( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg );
105
+  cmTlRC_t        cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbFunc, void* cbArg, const cmChar_t* fn );
106
 
106
 
107
-  cmTlRC_t   cmTimeLineFinalize( cmTlH_t* hp );
107
+  const cmChar_t* cmTimeLineFileName( cmTlH_t h );
108
 
108
 
109
-  bool       cmTimeLineIsValid( cmTlH_t h );
110
-  double     cmTimeLineSampleRate( cmTlH_t h );
109
+  cmTlRC_t        cmTimeLineFinalize( cmTlH_t* hp );
110
+
111
+  bool            cmTimeLineIsValid( cmTlH_t h );
112
+  double          cmTimeLineSampleRate( cmTlH_t h );
111
 
113
 
112
   // Return the object following 'p' assigned to 'seqId'.
114
   // Return the object following 'p' assigned to 'seqId'.
113
   // If 'p' is NULL then return the first object assigned to seqId.
115
   // If 'p' is NULL then return the first object assigned to seqId.
114
   // If 'seqId' is set to cmInvalidId then return the next object on any seq.
116
   // If 'seqId' is set to cmInvalidId then return the next object on any seq.
115
   // If no objects follow 'p' on the specified sequence then return NULL.
117
   // If no objects follow 'p' on the specified sequence then return NULL.
116
-  cmTlObj_t* cmTimeLineNextObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId );
118
+  cmTlObj_t*       cmTimeLineNextObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId );
117
 
119
 
118
   // Same as cmTimeLineNextObj() but returns next object whose type matches 'typeId'.
120
   // Same as cmTimeLineNextObj() but returns next object whose type matches 'typeId'.
119
-  cmTlObj_t* cmTimeLineNextTypeObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId, unsigned typeId );
121
+  cmTlObj_t*       cmTimeLineNextTypeObj( cmTlH_t h, cmTlObj_t* p, unsigned seqId, unsigned typeId );
120
 
122
 
121
   cmTlMidiFile_t*  cmTlNextMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op, unsigned seqId );
123
   cmTlMidiFile_t*  cmTlNextMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op, unsigned seqId );
122
   cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );
124
   cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );

Loading…
Cancel
Save