Преглед на файлове

Added dummy DSP time line ctl and cmDspPgmKr.c/h

master
kevin преди 12 години
родител
ревизия
785762a88e
променени са 10 файла, в които са добавени 171 реда и са изтрити 45 реда
  1. 5
    2
      Makefile.am
  2. 1
    0
      cmMsgProtocol.h
  3. 4
    0
      dsp/cmDspBuiltIn.c
  4. 1
    0
      dsp/cmDspClass.h
  5. 69
    42
      dsp/cmDspKr.c
  6. 1
    1
      dsp/cmDspKr.h
  7. 2
    0
      dsp/cmDspPgm.c
  8. 51
    0
      dsp/cmDspPgmKr.c
  9. 14
    0
      dsp/cmDspPgmKr.h
  10. 23
    0
      dsp/cmDspUi.c

+ 5
- 2
Makefile.am Целия файл

@@ -42,8 +42,11 @@ cmSRC +=  src/libcm/dsp/cmDspSys.c src/libcm/dsp/cmDspClass.c src/libcm/dsp/cmDs
42 42
 cmHDR += src/libcm/dsp/cmDspBuiltIn.h  src/libcm/dsp/cmDspFx.h 
43 43
 cmSRC += src/libcm/dsp/cmDspBuiltIn.c  src/libcm/dsp/cmDspFx.c 
44 44
 
45
-cmHDR += src/libcm/dsp/cmDspPgm.h src/libcm/dsp/cmDspKr.h src/libcm/dsp/cmDspPgmPP.h src/libcm/dsp/cmDspPgmPPMain.h
46
-cmSRC += src/libcm/dsp/cmDspPgm.c src/libcm/dsp/cmDspKr.c src/libcm/dsp/cmDspPgmPP.c src/libcm/dsp/cmDspPgmPPMain.c
45
+cmHDR += src/libcm/dsp/cmDspPgm.h src/libcm/dsp/cmDspPgmPP.h src/libcm/dsp/cmDspPgmPPMain.h
46
+cmSRC += src/libcm/dsp/cmDspPgm.c src/libcm/dsp/cmDspPgmPP.c src/libcm/dsp/cmDspPgmPPMain.c
47
+
48
+cmHDR +=  src/libcm/dsp/cmDspKr.h src/libcm/dsp/cmDspPgmKr.h
49
+cmSRC +=  src/libcm/dsp/cmDspKr.c src/libcm/dsp/cmDspPgmKr.c
47 50
 
48 51
 cmHDR += src/libcm/cmAudDsp.h src/libcm/cmAudDspIF.h src/libcm/cmAudDspLocal.h
49 52
 cmSRC += src/libcm/cmAudDsp.c src/libcm/cmAudDspIF.c src/libcm/cmAudDspLocal.c

+ 1
- 0
cmMsgProtocol.h Целия файл

@@ -30,6 +30,7 @@ extern "C" {
30 30
     kButtonDuiId,  // ui<--eng create button control
31 31
     kCheckDuiId,   // ui<--eng create a check box control
32 32
     kLabelDuiId,   // ui<--end create a label control
33
+    kTimeLineDuiId,// ui<--end create a time-line control
33 34
     kNumberDuiId,  // ui<--eng create a number box
34 35
     kTextDuiId,    // ui<--eng create a text entry control
35 36
     kFnameDuiId,   // ui<--eng create a file/directory picker control

+ 4
- 0
dsp/cmDspBuiltIn.c Целия файл

@@ -19,6 +19,7 @@
19 19
 #include "cmDspCtx.h"
20 20
 #include "cmDspClass.h"
21 21
 #include "cmDspFx.h"
22
+#include "cmDspKr.h"
22 23
 #include "cmMsgProtocol.h"
23 24
 #include "cmThread.h"
24 25
 #include "cmUdpPort.h"
@@ -4990,6 +4991,9 @@ cmDspClassConsFunc_t _cmDspClassBuiltInArray[] =
4990 4991
   cmPresetClassCons,
4991 4992
   cmBcastSymClassCons,
4992 4993
   cmSegLineClassCons,
4994
+  
4995
+  cmTimeLineClassCons,
4996
+  
4993 4997
   NULL,
4994 4998
 };
4995 4999
 

+ 1
- 0
dsp/cmDspClass.h Целия файл

@@ -392,6 +392,7 @@ extern "C" {
392 392
   cmDspRC_t  cmDspUiMeterCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId,  unsigned maxVarId,  unsigned valVarId,  unsigned lblVarId );
393 393
   cmDspRC_t  cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
394 394
   cmDspRC_t  cmDspUiLabelCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId,  unsigned alignVarId );
395
+  cmDspRC_t  cmDspUiTimeLineCreate(cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned valVarId,  unsigned lblVarId );
395 396
 
396 397
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
397 398
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

+ 69
- 42
dsp/cmDspKr.c Целия файл

@@ -56,49 +56,8 @@ typedef struct
56 56
  
57 57
 cmDspClass_t _cmKrDC;
58 58
 
59
-// cm console output function
60
-void _cmKrCmRptFunc( void* userDataPtr, const cmChar_t* fmt, va_list vl )
61
-{
62
-  cmCtx_t* p = (cmCtx_t*)userDataPtr;
63
-  if( p == NULL )
64
-    vprintf(fmt,vl);
65
-  else
66
-    cmRptVPrintf(&p->rpt,fmt,vl);
67
-}
68
-
69
-// initialize the cm library
70
-/*
71
-cmDspRC_t cmDspKrCmLibInit(cmCtx_t* cmCtx )
72
-{
73
-  bool debugFl = false;
74
-#ifdef NDEBUG
75
-  debugFl = true;
76
-#endif
77
-
78
-  unsigned memPadByteCnt       = cmCtx->guardByteCnt;
79
-  unsigned memAlignByteCnt     = cmCtx->alignByteCnt;
80
-  unsigned memAutoBlockByteCnt = 0;
81
-  unsigned memFlags            = cmCtx->mmFlags;
82
-
83
-  if( cmMallocDebugIsInit() == false )
84
-    cmMallocDebugInitialize( memPadByteCnt, memAlignByteCnt, memAutoBlockByteCnt, memFlags, _cmKrCmRptFunc, cmCtx  );
85
-  
86
-  return kOkDspRC;
87
-}
88 59
 
89
-// free the cm library
90
-cmDspRC_t cmDspKrCmLibFinal()
91
-{
92
-#ifdef NDEBUG
93
-  cmMallocDebugReport( vPrintF, _rptUserPtr, 0);
94
-#endif
95
-
96
-  if( cmMallocDebugIsInit()  )
97
-    cmMallocDebugFinalize();
98
-
99
-  return kOkDspRC;
100
-}
101
-*/
60
+//==========================================================================================================================================
102 61
 
103 62
   cmDspInst_t*  _cmDspKrAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
104 63
 {
@@ -267,3 +226,71 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
267 226
 }
268 227
 
269 228
 
229
+//==========================================================================================================================================
230
+enum
231
+{
232
+  kValTlId,
233
+  kLblTlId
234
+};
235
+
236
+cmDspClass_t _cmTimeLineDC;
237
+
238
+typedef struct
239
+{
240
+  cmDspInst_t inst;
241
+} cmDspTimeLine_t;
242
+
243
+cmDspInst_t*  _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
244
+{
245
+  cmDspVarArg_t args[] =
246
+  {
247
+    { "val",  kValTlId,  0, 0, kInDsvFl  | kOutDsvFl    | kStrzDsvFl | kReqArgDsvFl | kSendDfltDsvFl,  "Current string"},
248
+    { "lbl",  kLblTlId,  0, 0, kStrzDsvFl | kOptArgDsvFl, "Label"},
249
+    { NULL, 0, 0, 0, 0 }
250
+  };
251
+
252
+  cmDspTimeLine_t* p = cmDspInstAlloc(cmDspTimeLine_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
253
+
254
+  // create the UI control
255
+  cmDspUiTimeLineCreate(ctx,&p->inst,kValTlId,kLblTlId);
256
+
257
+  return &p->inst;
258
+}
259
+
260
+cmDspRC_t _cmDspTimeLineReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
261
+{
262
+  cmDspApplyAllDefaults(ctx,inst);
263
+  return kOkDspRC;
264
+}
265
+
266
+cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
267
+{
268
+
269
+  switch( evt->dstVarId )
270
+  {
271
+    case kValTlId:
272
+      cmDspSetEvent(ctx,inst,evt);
273
+      break;
274
+
275
+    default:
276
+      {assert(0);}
277
+  }
278
+
279
+  return kOkDspRC;
280
+}
281
+
282
+struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
283
+{
284
+  cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine",
285
+    NULL,
286
+    _cmDspTimeLineAlloc,
287
+    NULL,
288
+    _cmDspTimeLineReset,
289
+    NULL,
290
+    _cmDspTimeLineRecv,
291
+    NULL,NULL,
292
+    "Time Line control.");
293
+
294
+  return &_cmTimeLineDC;
295
+}
296
+

+ 1
- 1
dsp/cmDspKr.h Целия файл

@@ -6,7 +6,7 @@ extern "C" {
6 6
 #endif
7 7
 
8 8
   struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx );
9
-
9
+  struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx );
10 10
 
11 11
 #ifdef __cplusplus
12 12
 }

+ 2
- 0
dsp/cmDspPgm.c Целия файл

@@ -23,6 +23,7 @@
23 23
 #include "cmDspSys.h"
24 24
 #include "cmDspPgm.h"
25 25
 #include "cmDspPgmPP.h"
26
+#include "cmDspPgmKr.h"
26 27
 
27 28
 cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
28 29
 {
@@ -2312,6 +2313,7 @@ cmDspRC_t _cmDspSysPgm_SegLine( cmDspSysH_t h, void** userPtrPtr )
2312 2313
 }
2313 2314
 _cmDspSysPgm_t _cmDspSysPgmArray[] = 
2314 2315
 {
2316
+  { "time_line",     _cmDspSysPgm_TimeLine,     NULL, NULL },
2315 2317
   { "main",          _cmDspSysPgm_Main,         NULL, NULL },
2316 2318
   { "array",         _cmDspSysPgm_Array,        NULL, NULL },
2317 2319
   { "line",          _cmDspSysPgm_Line,         NULL, NULL },

+ 51
- 0
dsp/cmDspPgmKr.c Целия файл

@@ -0,0 +1,51 @@
1
+#include "cmPrefix.h"
2
+#include "cmGlobal.h"
3
+#include "cmFloatTypes.h"
4
+#include "cmRpt.h"
5
+#include "cmErr.h"
6
+#include "cmCtx.h"
7
+#include "cmMem.h"
8
+#include "cmMallocDebug.h"
9
+#include "cmLinkedHeap.h"
10
+#include "cmText.h"
11
+#include "cmFileSys.h"
12
+#include "cmSymTbl.h"
13
+#include "cmJson.h"
14
+#include "cmPrefs.h"
15
+#include "cmDspValue.h"
16
+#include "cmMsgProtocol.h"
17
+#include "cmThread.h"
18
+#include "cmUdpPort.h"
19
+#include "cmUdpNet.h"
20
+#include "cmAudioSys.h"
21
+#include "cmProcObj.h"
22
+#include "cmDspCtx.h"
23
+#include "cmDspClass.h"
24
+#include "cmDspSys.h"
25
+#include "cmDspPgm.h"
26
+
27
+
28
+#include "cmAudioFile.h"
29
+#include "cmProcObj.h"
30
+#include "cmProc.h"
31
+#include "cmProc3.h"
32
+
33
+#include "cmVectOpsTemplateMain.h"
34
+#include "cmVectOps.h"
35
+
36
+
37
+cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
38
+{
39
+  cmDspRC_t rc = kOkDspRC;
40
+
41
+  cmDspInst_t* tlp = cmDspSysAllocInst(h,"TimeLine",   "text",      1, "Hello" );
42
+  cmDspInst_t* prp = cmDspSysAllocInst(h,"Printer", NULL,   1, ">" );
43
+  
44
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
45
+    return rc;
46
+
47
+  
48
+  cmDspSysInstallCb(h, tlp, "val", prp, "in", NULL );
49
+
50
+  return rc;
51
+}

+ 14
- 0
dsp/cmDspPgmKr.h Целия файл

@@ -0,0 +1,14 @@
1
+#ifndef cmDspPgmKr_h
2
+#define cmDspPgmKr_h
3
+
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+  cmDspRC_t _cmDspSysPgm_TimeLine( cmDspSysH_t h, void** userPtrPtr );
9
+
10
+#ifdef __cplusplus
11
+  }
12
+#endif
13
+
14
+#endif

+ 23
- 0
dsp/cmDspUi.c Целия файл

@@ -361,6 +361,29 @@ cmDspRC_t  cmDspUiLabelCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lbl
361 361
   return rc;
362 362
 }
363 363
 
364
+cmDspRC_t  cmDspUiTimeLineCreate(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId )
365
+{
366
+  cmDspRC_t    rc;
367
+  unsigned     arr[] = { valVarId, lblVarId  };
368
+  cmDspValue_t v;
369
+  unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
370
+  cmDsvSetUIntMtx(&v,arr,vn,1);
371
+
372
+  // tell the UI to create a time-line control
373
+  if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTimeLineDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC )
374
+    return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Time Line UI element create failed.");
375
+
376
+  // use instance symbol as default label
377
+  if((rc = _cmDspUiUseInstSymbolAsLabel(ctx, inst, lblVarId, "TimeLine")) != kOkDspRC )
378
+    return rc;
379
+
380
+  // Set the kUiDsvFl on the variables used for the min/max/def/val for this scalar
381
+  // Setting this flag will cause their values to be sent to the UI whenever they change.
382
+  cmDspInstVarSetFlags( ctx, inst, valVarId, kUiDsvFl );
383
+  return rc;
384
+}
385
+
386
+
364 387
 cmDspRC_t  cmDspUiNewColumn(    cmDspCtx_t* ctx, unsigned colW )
365 388
 {
366 389
   cmDspRC_t rc = kOkDspRC;

Loading…
Отказ
Запис