Browse Source

Merge branch 'master' of klarke.webfactional.com:webapps/git/repos/libcm

master
kevin 11 years ago
parent
commit
68f00dbbf9
10 changed files with 175 additions and 45 deletions
  1. 5
    2
      Makefile.am
  2. 1
    0
      cmMsgProtocol.h
  3. 4
    0
      dsp/cmDspBuiltIn.c
  4. 1
    0
      dsp/cmDspClass.h
  5. 71
    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. 25
    0
      dsp/cmDspUi.c

+ 5
- 2
Makefile.am View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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, unsigned tlFileId, unsigned audPathId );
395 396
 
396 397
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
397 398
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

+ 71
- 42
dsp/cmDspKr.c View File

@@ -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,73 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
267 226
 }
268 227
 
269 228
 
229
+//==========================================================================================================================================
230
+enum
231
+{
232
+  kValTlId,
233
+  kLblTlId,
234
+  kTlFileTlId,
235
+  kAudPathTlId
236
+};
237
+
238
+cmDspClass_t _cmTimeLineDC;
239
+
240
+typedef struct
241
+{
242
+  cmDspInst_t inst;
243
+} cmDspTimeLine_t;
244
+
245
+cmDspInst_t*  _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
246
+{
247
+  cmDspVarArg_t args[] =
248
+  {
249
+    { "val",  kValTlId,  0, 0, kInDsvFl  | kOutDsvFl    | kStrzDsvFl | kReqArgDsvFl | kSendDfltDsvFl,  "Current string"},
250
+    { "lbl",  kLblTlId,  0, 0, kStrzDsvFl | kOptArgDsvFl, "Label"},
251
+    { NULL, 0, 0, 0, 0 }
252
+  };
253
+
254
+  cmDspTimeLine_t* p = cmDspInstAlloc(cmDspTimeLine_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
255
+
256
+  // create the UI control
257
+  cmDspUiTimeLineCreate(ctx,&p->inst,kValTlId,kLblTlId,kTlFileTlId,kAudPathTlId);
258
+
259
+  return &p->inst;
260
+}
261
+
262
+cmDspRC_t _cmDspTimeLineReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
263
+{
264
+  cmDspApplyAllDefaults(ctx,inst);
265
+  return kOkDspRC;
266
+}
267
+
268
+cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
269
+{
270
+
271
+  switch( evt->dstVarId )
272
+  {
273
+    case kValTlId:
274
+      cmDspSetEvent(ctx,inst,evt);
275
+      break;
276
+
277
+    default:
278
+      {assert(0);}
279
+  }
280
+
281
+  return kOkDspRC;
282
+}
283
+
284
+struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
285
+{
286
+  cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine",
287
+    NULL,
288
+    _cmDspTimeLineAlloc,
289
+    NULL,
290
+    _cmDspTimeLineReset,
291
+    NULL,
292
+    _cmDspTimeLineRecv,
293
+    NULL,NULL,
294
+    "Time Line control.");
295
+
296
+  return &_cmTimeLineDC;
297
+}
298
+

+ 1
- 1
dsp/cmDspKr.h View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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

+ 25
- 0
dsp/cmDspUi.c View File

@@ -361,6 +361,31 @@ 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, unsigned tlFileVarId, unsigned audPathVarId )
365
+{
366
+  cmDspRC_t    rc;
367
+  unsigned     arr[] = { valVarId, lblVarId, tlFileVarId, audPathVarId  };
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
+  cmDspInstVarSetFlags( ctx, inst, tlFileVarId,  kUiDsvFl );
384
+  cmDspInstVarSetFlags( ctx, inst, audPathVarId, kUiDsvFl );
385
+  return rc;
386
+}
387
+
388
+
364 389
 cmDspRC_t  cmDspUiNewColumn(    cmDspCtx_t* ctx, unsigned colW )
365 390
 {
366 391
   cmDspRC_t rc = kOkDspRC;

Loading…
Cancel
Save