|
@@ -24,6 +24,7 @@
|
24
|
24
|
#include "cmOp.h"
|
25
|
25
|
#include "cmMath.h"
|
26
|
26
|
|
|
27
|
+
|
27
|
28
|
#include "cmAudioFile.h"
|
28
|
29
|
#include "cmFileSys.h"
|
29
|
30
|
#include "cmProcObj.h"
|
|
@@ -33,6 +34,10 @@
|
33
|
34
|
#include "cmProc2.h"
|
34
|
35
|
#include "cmVectOpsTemplateMain.h"
|
35
|
36
|
|
|
37
|
+#include "cmAudioFile.h"
|
|
38
|
+#include "cmMidiFile.h"
|
|
39
|
+#include "cmTimeLine.h"
|
|
40
|
+
|
36
|
41
|
enum
|
37
|
42
|
{
|
38
|
43
|
kWndSmpCntKrId,
|
|
@@ -229,10 +234,12 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
|
229
|
234
|
//==========================================================================================================================================
|
230
|
235
|
enum
|
231
|
236
|
{
|
232
|
|
- kValTlId,
|
233
|
|
- kLblTlId,
|
234
|
237
|
kTlFileTlId,
|
235
|
|
- kAudPathTlId
|
|
238
|
+ kAudPathTlId,
|
|
239
|
+ kSelTlId,
|
|
240
|
+ kAudFnTlId,
|
|
241
|
+ kBegSmpIdxTlId,
|
|
242
|
+ kEndSmpIdxTlId
|
236
|
243
|
};
|
237
|
244
|
|
238
|
245
|
cmDspClass_t _cmTimeLineDC;
|
|
@@ -240,29 +247,62 @@ cmDspClass_t _cmTimeLineDC;
|
240
|
247
|
typedef struct
|
241
|
248
|
{
|
242
|
249
|
cmDspInst_t inst;
|
|
250
|
+ cmTlH_t tlH;
|
243
|
251
|
} cmDspTimeLine_t;
|
244
|
252
|
|
245
|
253
|
cmDspInst_t* _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
246
|
254
|
{
|
247
|
255
|
cmDspVarArg_t args[] =
|
248
|
256
|
{
|
249
|
|
- { "val", kValTlId, 0, 0, kInDsvFl | kOutDsvFl | kStrzDsvFl | kReqArgDsvFl | kSendDfltDsvFl, "Current string"},
|
250
|
|
- { "lbl", kLblTlId, 0, 0, kStrzDsvFl | kOptArgDsvFl, "Label"},
|
|
257
|
+ { "tlfile", kTlFileTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Time line file." },
|
|
258
|
+ { "path", kAudPathTlId, 0, 0, kInDsvFl | kStrzDsvFl | kReqArgDsvFl, "Audio path" },
|
|
259
|
+ { "sel", kSelTlId, 0, 0, kInDsvFl | kInDsvFl | kOutDsvFl | kUIntDsvFl, "Selected marker id."},
|
|
260
|
+ { "afn", kAudFnTlId, 0, 0, kOutDsvFl | kStrzDsvFl, "Selected Audio file." },
|
|
261
|
+ { "bsi", kBegSmpIdxTlId, 0, 0, kOutDsvFl | kUIntDsvFl, "Begin audio sample index."},
|
|
262
|
+ { "esi", kEndSmpIdxTlId, 0, 0, kOutDsvFl | kUIntDsvFl, "End audio sample index."},
|
251
|
263
|
{ NULL, 0, 0, 0, 0 }
|
252
|
264
|
};
|
253
|
265
|
|
254
|
266
|
cmDspTimeLine_t* p = cmDspInstAlloc(cmDspTimeLine_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
|
|
267
|
+
|
|
268
|
+ cmDspSetDefaultUInt( ctx, &p->inst, kSelTlId, 0, cmInvalidId);
|
|
269
|
+ cmDspSetDefaultStrcz( ctx, &p->inst, kAudFnTlId, NULL, "");
|
|
270
|
+ cmDspSetDefaultUInt( ctx, &p->inst, kBegSmpIdxTlId, 0, cmInvalidIdx);
|
|
271
|
+ cmDspSetDefaultUInt( ctx, &p->inst, kEndSmpIdxTlId, 0, cmInvalidIdx);
|
255
|
272
|
|
256
|
273
|
// create the UI control
|
257
|
|
- cmDspUiTimeLineCreate(ctx,&p->inst,kValTlId,kLblTlId,kTlFileTlId,kAudPathTlId);
|
|
274
|
+ cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kAudPathTlId,kSelTlId);
|
|
275
|
+
|
|
276
|
+ p->tlH = cmTimeLineNullHandle;
|
258
|
277
|
|
259
|
278
|
return &p->inst;
|
260
|
279
|
}
|
261
|
280
|
|
|
281
|
+cmDspRC_t _cmDspTimeLineFree(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
|
282
|
+{
|
|
283
|
+ cmDspRC_t rc = kOkDspRC;
|
|
284
|
+ cmDspTimeLine_t* p = (cmDspTimeLine_t*)inst;
|
|
285
|
+
|
|
286
|
+ if( cmTimeLineFinalize(&p->tlH) != kOkTlRC )
|
|
287
|
+ return cmErrMsg(&inst->classPtr->err, kInstFinalFailDspRC, "Time-line finalize failed.");
|
|
288
|
+
|
|
289
|
+ return rc;
|
|
290
|
+}
|
|
291
|
+
|
|
292
|
+
|
262
|
293
|
cmDspRC_t _cmDspTimeLineReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
263
|
294
|
{
|
|
295
|
+ cmDspRC_t rc = kOkDspRC;
|
|
296
|
+ cmDspTimeLine_t* p = (cmDspTimeLine_t*)inst;
|
|
297
|
+
|
264
|
298
|
cmDspApplyAllDefaults(ctx,inst);
|
265
|
|
- return kOkDspRC;
|
|
299
|
+
|
|
300
|
+ const cmChar_t* tlFn;
|
|
301
|
+ if((tlFn = cmDspStrcz(inst, kTlFileTlId )) != NULL )
|
|
302
|
+ if( cmTimeLineInitializeFromFile(ctx->cmCtx, &p->tlH, NULL, NULL, tlFn ) != kOkTlRC )
|
|
303
|
+ rc = cmErrMsg(&inst->classPtr->err, kInstResetFailDspRC, "Time-line file open failed.");
|
|
304
|
+
|
|
305
|
+ return rc;
|
266
|
306
|
}
|
267
|
307
|
|
268
|
308
|
cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
|
@@ -270,8 +310,9 @@ cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
270
|
310
|
|
271
|
311
|
switch( evt->dstVarId )
|
272
|
312
|
{
|
273
|
|
- case kValTlId:
|
|
313
|
+ case kSelTlId:
|
274
|
314
|
cmDspSetEvent(ctx,inst,evt);
|
|
315
|
+
|
275
|
316
|
break;
|
276
|
317
|
|
277
|
318
|
default:
|
|
@@ -286,7 +327,7 @@ struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
|
286
|
327
|
cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine",
|
287
|
328
|
NULL,
|
288
|
329
|
_cmDspTimeLineAlloc,
|
289
|
|
- NULL,
|
|
330
|
+ _cmDspTimeLineFree,
|
290
|
331
|
_cmDspTimeLineReset,
|
291
|
332
|
NULL,
|
292
|
333
|
_cmDspTimeLineRecv,
|