Ver código fonte

cmTimeLine.c/h Added cmTimeLineFileName()

master
kpl 12 anos atrás
pai
commit
81ed3aba41
2 arquivos alterados com 28 adições e 21 exclusões
  1. 19
    14
      app/cmTimeLine.c
  2. 9
    7
      app/cmTimeLine.h

+ 19
- 14
app/cmTimeLine.c Ver arquivo

@@ -48,17 +48,18 @@ typedef struct
48 48
 
49 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 63
 } _cmTl_t;
63 64
 
64 65
 typedef struct
@@ -922,12 +923,15 @@ cmTlRC_t   cmTimeLineInitializeFromFile( cmCtx_t* ctx, cmTlH_t* hp, cmTlCb_t cbF
922 923
   if((rc = cmTimeLineInitialize(ctx,hp,cbFunc,cbArg)) != kOkTlRC )
923 924
     return rc;
924 925
 
925
-  //_cmTl_t* p = _cmTlHandleToPtr(*hp);
926
-  //_cmTlNotifyListener(p, kInitMsgTlId, NULL );
927
-
928 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 935
 cmTlRC_t cmTimeLineFinalize( cmTlH_t* hp )
932 936
 {
933 937
   cmTlRC_t rc;
@@ -1218,6 +1222,7 @@ cmTlRC_t cmTimeLineReadJson(  cmTlH_t h, const cmChar_t* ifn )
1218 1222
     
1219 1223
   }
1220 1224
   
1225
+  p->filename = cmLhAllocStr(p->lH,ifn);
1221 1226
 
1222 1227
  errLabel:
1223 1228
   if( rc != kOkTlRC )

+ 9
- 7
app/cmTimeLine.h Ver arquivo

@@ -101,22 +101,24 @@ extern "C" {
101 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 114
   // Return the object following 'p' assigned to 'seqId'.
113 115
   // If 'p' is NULL then return the first object assigned to seqId.
114 116
   // If 'seqId' is set to cmInvalidId then return the next object on any seq.
115 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 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 123
   cmTlMidiFile_t*  cmTlNextMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op, unsigned seqId );
122 124
   cmTlAudioFile_t* cmTlNextAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op, unsigned seqId );

Carregando…
Cancelar
Salvar