Parcourir la source

Merge with upstream.

master
Kevin Larke il y a 9 ans
Parent
révision
11bf5b63a0
100 fichiers modifiés avec 2315 ajouts et 1460 suppressions
  1. 2
    2
      Makefile.am
  2. 459
    0
      app/cmDspPgmJsonToDot.c
  3. 30
    0
      app/cmDspPgmJsonToDot.h
  4. 2
    1
      app/cmOnset.c
  5. 4
    0
      app/cmOnset.h
  6. 4
    2
      app/cmPickup.h
  7. 37
    27
      app/cmScore.c
  8. 5
    2
      app/cmScore.h
  9. 4
    0
      app/cmScoreProc.h
  10. 6
    3
      app/cmSdb.h
  11. 7
    6
      app/cmTakeSeqBldr.c
  12. 4
    1
      app/cmTakeSeqBldr.h
  13. 46
    38
      app/cmTimeLine.c
  14. 4
    0
      app/cmTimeLine.h
  15. 145
    145
      cmApBuf.h
  16. 4
    0
      cmArray.h
  17. 6
    1
      cmAudDsp.c
  18. 3
    2
      cmAudDsp.h
  19. 19
    4
      cmAudDspIF.h
  20. 15
    0
      cmAudDspLocal.h
  21. 4
    0
      cmAudLabelFile.h
  22. 4
    1
      cmAudioAggDev.h
  23. 3
    1
      cmAudioBuf.h
  24. 108
    126
      cmAudioFile.h
  25. 11
    0
      cmAudioFileDev.h
  26. 4
    1
      cmAudioFileMgr.h
  27. 4
    1
      cmAudioNrtDev.h
  28. 85
    85
      cmAudioPort.h
  29. 4
    0
      cmAudioPortFile.h
  30. 6
    7
      cmAudioSys.h
  31. 4
    1
      cmAudioSysMsg.h
  32. 11
    0
      cmComplexTypes.h
  33. 4
    0
      cmCsv.h
  34. 4
    4
      cmCtx.h
  35. 3
    1
      cmDList.h
  36. 4
    0
      cmDListTpl.h
  37. 3
    1
      cmData.h
  38. 5
    1
      cmDevCfg.h
  39. 2
    3
      cmErr.h
  40. 3
    0
      cmExec.h
  41. 1
    1
      cmFeatFile.c
  42. 142
    146
      cmFeatFile.h
  43. 1
    0
      cmFile.c
  44. 7
    8
      cmFile.h
  45. 2
    4
      cmFileSys.h
  46. 37
    36
      cmFloatTypes.h
  47. 3
    3
      cmFrameFile.c
  48. 10
    7
      cmFrameFile.h
  49. 6
    8
      cmGlobal.h
  50. 94
    82
      cmGnuPlot.h
  51. 2
    0
      cmGr.h
  52. 4
    1
      cmGrDevCtx.h
  53. 15
    2
      cmGrPage.h
  54. 3
    0
      cmGrPlot.h
  55. 4
    1
      cmGrPlotAudio.h
  56. 4
    0
      cmHashTbl.h
  57. 2
    3
      cmJson.h
  58. 62
    55
      cmKeyboard.h
  59. 5
    2
      cmLex.c
  60. 1
    5
      cmLex.h
  61. 3
    1
      cmLib.h
  62. 1
    1
      cmLinkedHeap.c
  63. 11
    2
      cmLinkedHeap.h
  64. 4
    0
      cmMain.c
  65. 10
    14
      cmMallocDebug.h
  66. 127
    115
      cmMath.h
  67. 8
    6
      cmMem.h
  68. 4
    0
      cmMidi.h
  69. 118
    105
      cmMidiFile.c
  70. 13
    14
      cmMidiFile.h
  71. 7
    14
      cmMidiFilePlay.c
  72. 41
    37
      cmMidiFilePlay.h
  73. 9
    2
      cmMidiPort.h
  74. 3
    0
      cmMsgProtocol.h
  75. 1
    1
      cmPgmOpts.c
  76. 2
    3
      cmPgmOpts.h
  77. 4
    1
      cmPrefs.h
  78. 112
    134
      cmProc.h
  79. 20
    3
      cmProc2.c
  80. 99
    31
      cmProc2.h
  81. 79
    29
      cmProc3.h
  82. 7
    0
      cmProc4.c
  83. 27
    12
      cmProc4.h
  84. 22
    16
      cmProc5.h
  85. 3
    2
      cmProcObj.h
  86. 3
    0
      cmRbm.h
  87. 1
    1
      cmRpt.c
  88. 1
    4
      cmRpt.h
  89. 4
    1
      cmRtNet.h
  90. 4
    7
      cmRtSys.h
  91. 4
    2
      cmRtSysMsg.h
  92. 2
    9
      cmSerialize.h
  93. 4
    1
      cmStack.h
  94. 4
    0
      cmStrStream.h
  95. 1
    7
      cmSymTbl.h
  96. 4
    0
      cmTagFile.h
  97. 4
    2
      cmTaskMgr.h
  98. 2
    3
      cmText.h
  99. 55
    49
      cmTextTemplate.h
  100. 0
    0
      cmThread.h

+ 2
- 2
Makefile.am Voir le fichier

@@ -77,8 +77,8 @@ cmSRC += src/libcm/cmProcObj.c src/libcm/cmProc.c src/libcm/cmProc2.c src/libcm/
77 77
 cmHDR += src/libcm/app/cmOnset.h src/libcm/app/cmTimeLine.h src/libcm/app/cmScore.h src/libcm/app/cmScoreProc.h 
78 78
 cmSRC += src/libcm/app/cmOnset.c src/libcm/app/cmTimeLine.c src/libcm/app/cmScore.c src/libcm/app/cmScoreProc.c 
79 79
 
80
-cmHDR += src/libcm/app/cmSdb.h  src/libcm/app/cmTakeSeqBldr.h
81
-cmSRC += src/libcm/app/cmSdb.c  src/libcm/app/cmTakeSeqBldr.c
80
+cmHDR += src/libcm/app/cmSdb.h  src/libcm/app/cmTakeSeqBldr.h  src/libcm/app/cmDspPgmJsonToDot.h
81
+cmSRC += src/libcm/app/cmSdb.c  src/libcm/app/cmTakeSeqBldr.c  src/libcm/app/cmDspPgmJsonToDot.c
82 82
 
83 83
 cmHDR += src/libcm/app/cmPickup.h src/libcm/cmRbm.h src/libcm/cmTaskMgr.h  src/libcm/cmSyncRecd.h
84 84
 cmSRC += src/libcm/app/cmPickup.c src/libcm/cmRbm.c src/libcm/cmTaskMgr.c  src/libcm/cmSyncRecd.c

+ 459
- 0
app/cmDspPgmJsonToDot.c Voir le fichier

@@ -0,0 +1,459 @@
1
+#include "cmPrefix.h"
2
+#include "cmGlobal.h"
3
+#include "cmFloatTypes.h"
4
+#include "cmComplexTypes.h"
5
+#include "cmRpt.h"
6
+#include "cmErr.h"
7
+#include "cmCtx.h"
8
+#include "cmMem.h"
9
+#include "cmMallocDebug.h"
10
+#include "cmLinkedHeap.h"
11
+#include "cmSymTbl.h"
12
+#include "cmJson.h"
13
+#include "cmText.h"
14
+#include "cmDspPgmJsonToDot.h"
15
+#include "cmFile.h"
16
+#include "cmFileSys.h"
17
+
18
+struct cmDotProc_str;
19
+
20
+typedef struct cmDotPort_str
21
+{
22
+  struct cmDotProc_str* proc;
23
+  cmChar_t*             labelStr;
24
+  unsigned              portNo;
25
+  unsigned              connCnt;  // count of connections to this port
26
+  struct cmDotPort_str* link;
27
+} cmDotPort_t;
28
+
29
+typedef struct cmDotProc_str
30
+{
31
+  cmChar_t*             classStr;
32
+  cmChar_t*             instStr;
33
+  cmChar_t*             outStr;
34
+  unsigned              portCnt;
35
+  bool                  skipFl;
36
+  
37
+  cmDotPort_t*          ports;
38
+  struct cmDotProc_str* link;
39
+} cmDotProc_t;
40
+
41
+typedef struct cmDotConn_str
42
+{
43
+  cmDotPort_t*          srcPort; // output
44
+  cmDotPort_t*          dstPort; // input
45
+  bool                  skipFl;
46
+  struct cmDotConn_str* link;
47
+} cmDotConn_t;
48
+
49
+
50
+typedef struct cmDot_str
51
+{
52
+  cmErr_t      err;
53
+  cmLHeapH_t   lH;
54
+  cmDotProc_t* procs;
55
+  cmDotConn_t* conns;
56
+} cmDot_t;
57
+
58
+typedef struct
59
+{
60
+  const cmChar_t* s0;
61
+  const cmChar_t* s1;
62
+} cmDotSubst_t;
63
+
64
+cmDotSubst_t _cmDotSubstArray[] =
65
+{
66
+  { "Router",     "Rtr" },
67
+  { "Scalar",     "Sc"  },
68
+  { "ScaleRange", "SR"  },
69
+  { "MsgList",    "ML"  },
70
+  { "Button",     "Btn" },
71
+  { "PortToSym",  "PtS" },
72
+  { "1ofN",       "lOfN"},
73
+  { NULL, NULL }
74
+};
75
+
76
+const cmChar_t* _cmDotSkipClassArray[] =
77
+{
78
+  "Scalar",
79
+  NULL
80
+};
81
+
82
+void _cmDotReplaceDash( cmChar_t* str )
83
+{
84
+  cmChar_t* s = str;
85
+  for(; *s; ++s )
86
+    if( *s == '-' )
87
+      *s = '_';
88
+}
89
+
90
+cmChar_t* _cmDotSubstitute( cmDot_t* p, const cmChar_t* label )
91
+{
92
+  unsigned i;
93
+  cmChar_t* s = cmLhAllocStr(p->lH,label);
94
+  
95
+  for(i=0; _cmDotSubstArray[i].s0 != NULL; ++i)
96
+  {
97
+    unsigned n0 = cmTextLength(_cmDotSubstArray[i].s0);
98
+    
99
+    if( cmTextCmpN( _cmDotSubstArray[i].s0, s, n0 ) == 0 )
100
+    {
101
+      unsigned n1 = cmTextLength(_cmDotSubstArray[i].s1);
102
+      assert(n0>=n1);
103
+      cmTextShrinkS(s,s+n1,n0-n1);
104
+      strncpy(s,_cmDotSubstArray[i].s1,n1);
105
+    }
106
+  }
107
+  
108
+  return s;
109
+}
110
+
111
+bool _cmDotIsSkipClass( const cmChar_t* classStr )
112
+{
113
+  unsigned i;
114
+
115
+  for(i=0; _cmDotSkipClassArray[i]!=NULL; ++i)
116
+    if( cmTextCmp(_cmDotSkipClassArray[i],classStr) == 0 )
117
+      return true;
118
+  
119
+  return false;
120
+}
121
+
122
+cmDotPort_t* _cmDotFindPort( cmDotProc_t* proc, const cmChar_t* labelStr )
123
+{
124
+  cmDotPort_t* port =  proc->ports;
125
+  for(; port!=NULL; port=port->link)
126
+    if( cmTextCmp(port->labelStr,labelStr) == 0 )
127
+      return port;
128
+
129
+  return NULL;
130
+}
131
+
132
+cmDotProc_t* _cmDotFindProc( cmDot_t* p, const cmChar_t* instStr )
133
+{
134
+  cmDotProc_t* dp = p->procs;
135
+  for(; dp!=NULL; dp=dp->link)
136
+    if( cmTextCmp(dp->instStr,instStr) == 0 )
137
+      return dp;
138
+
139
+  return NULL;
140
+}
141
+
142
+cmDotPort_t* _cmDotNewPort( cmDot_t* p, cmDotProc_t* proc, const cmChar_t* labelStr )
143
+{
144
+  cmDotPort_t* port = NULL;
145
+
146
+  if( labelStr==NULL || cmTextLength(labelStr)==0 )
147
+  {
148
+    cmErrMsg(&p->err,kInvalidArgDotRC,"A blank port label was encountered.");
149
+    return NULL;
150
+  }
151
+  
152
+  if((port = _cmDotFindPort(proc,labelStr)) != NULL )
153
+    return port;
154
+
155
+  port = cmLhAllocZ(p->lH,cmDotPort_t,1);
156
+
157
+  port->proc      = proc;
158
+  port->labelStr  = cmLhAllocStr(p->lH,labelStr);
159
+  port->portNo    = proc->portCnt;
160
+ 
161
+  proc->portCnt += 1;
162
+
163
+  cmDotPort_t* p0 = NULL;
164
+  cmDotPort_t* p1 = proc->ports;
165
+  for(; p1!=NULL; p1=p1->link)
166
+    p0 = p1;
167
+
168
+  if( p0 == NULL )
169
+    proc->ports = port;
170
+  else
171
+    p0->link = port;
172
+  
173
+  return port;
174
+}
175
+
176
+cmDotRC_t _cmDotNewConnection( cmDot_t* p, const cmChar_t* srcProcStr, const cmChar_t* srcPortStr, const cmChar_t* dstProcStr, const cmChar_t* dstPortStr )
177
+{
178
+  cmDotRC_t    rc = kOkDotRC;
179
+  cmDotProc_t* srcProc;
180
+  cmDotProc_t* dstProc;
181
+  cmDotPort_t* srcPort;
182
+  cmDotPort_t* dstPort;
183
+  cmDotConn_t* conn;
184
+  cmDotConn_t* c0 = NULL;
185
+  cmDotConn_t* c1 = p->conns;
186
+
187
+  // find the source (output) proc
188
+  if((srcProc = _cmDotFindProc(p,srcProcStr)) == NULL )
189
+  {
190
+    rc = cmErrMsg(&p->err,kInvalidArgDotRC,"The connection source proc instance '%s' could not be found.",cmStringNullGuard(srcProcStr));
191
+    goto errLabel;
192
+  }
193
+
194
+
195
+  // find the dest (input) proc
196
+  if((dstProc = _cmDotFindProc(p,dstProcStr)) == NULL )
197
+  {
198
+    rc = cmErrMsg(&p->err,kInvalidArgDotRC,"The connection destination proc instance '%s' could not be found.",cmStringNullGuard(dstProcStr));
199
+    goto errLabel;
200
+  }
201
+
202
+  // find the source port
203
+  if((srcPort = _cmDotNewPort(p,srcProc,srcPortStr)) == NULL )
204
+  {
205
+    rc = cmErrMsg(&p->err,kInvalidArgDotRC,"The source port %s:%s could not be found or allocated.",cmStringNullGuard(srcProc->instStr),cmStringNullGuard(srcPortStr));
206
+    goto errLabel;
207
+  }
208
+
209
+  // find the dest port
210
+  if((dstPort = _cmDotNewPort(p,dstProc,dstPortStr)) == NULL )
211
+  {
212
+    rc = cmErrMsg(&p->err,kInvalidArgDotRC,"The destination port %s:%s could not be found or allocated.",cmStringNullGuard(dstProc->instStr),cmStringNullGuard(dstPortStr));
213
+    goto errLabel;
214
+  }
215
+
216
+  conn = cmLhAllocZ(p->lH,cmDotConn_t,1);
217
+
218
+  conn->srcPort = srcPort;
219
+  conn->dstPort = dstPort;
220
+  conn->skipFl  = _cmDotIsSkipClass(srcProc->classStr) || _cmDotIsSkipClass(dstProc->classStr);
221
+
222
+  // track the number of connections to each port
223
+  if( !conn->skipFl )
224
+  {
225
+    conn->dstPort->connCnt += 1;
226
+    conn->srcPort->connCnt += 1;
227
+  }
228
+
229
+  
230
+  // set c0 to point to the last connection record
231
+  for(; c1!=NULL; c1=c1->link)
232
+    c0 = c1;
233
+
234
+  // make conn the last connection record
235
+  if( c0 == NULL )
236
+    p->conns = conn;
237
+  else
238
+    c0->link = conn;
239
+
240
+ errLabel:
241
+  return rc;
242
+}
243
+
244
+
245
+cmDotRC_t _cmDotNewProc( cmDot_t* p, const cmChar_t* classStr, const cmChar_t* instStr )
246
+{
247
+  cmDotRC_t rc = kOkDotRC;
248
+  
249
+  if( instStr==NULL || cmTextLength(instStr)==0 )
250
+    return cmErrMsg(&p->err,kInvalidArgDotRC,"A blank or NULL instance label was encountered.");
251
+
252
+  if( _cmDotFindProc( p, instStr ) )
253
+    return cmErrMsg(&p->err,kInvalidArgDotRC,"A duplicate processor instance was encountered ('%s').",instStr);
254
+
255
+  cmDotProc_t* ndp = cmLhAllocZ(p->lH,cmDotProc_t,1);
256
+
257
+  ndp->classStr = cmLhAllocStr(p->lH,classStr);
258
+  ndp->instStr  = cmLhAllocStr(p->lH,instStr);
259
+  ndp->outStr   = _cmDotSubstitute(p,instStr);
260
+  ndp->skipFl   = _cmDotIsSkipClass(classStr);
261
+
262
+  cmDotProc_t* d0p = NULL;
263
+  cmDotProc_t* d1p = p->procs;
264
+
265
+  for(; d1p!=NULL; d1p=d1p->link )
266
+    d0p = d1p;
267
+
268
+  if( d0p == NULL )
269
+    p->procs = ndp;
270
+  else
271
+    d0p->link = ndp;
272
+  
273
+  return rc;
274
+}
275
+
276
+unsigned _cmDotProcConnCount( cmDotProc_t* proc )
277
+{
278
+  unsigned connN = 0;
279
+  
280
+  cmDotPort_t* port = proc->ports;
281
+  for(; port!=NULL; port=port->link)
282
+    connN += port->connCnt;
283
+
284
+  return connN;
285
+}
286
+
287
+cmDotRC_t _cmDotWriteOutput( cmDot_t* p, const cmChar_t* outFn )
288
+{
289
+  cmDotRC_t rc = kOkDotRC;
290
+  
291
+  cmFileH_t fH = cmFileNullHandle;
292
+
293
+  cmFileSysPathPart_t* pathParts = cmFsPathParts(outFn);
294
+  const cmChar_t* fn = NULL;
295
+  
296
+  if( pathParts == NULL )
297
+  {
298
+    rc = cmErrMsg(&p->err,kFileFailDotRC,"The output file name '%s' could be parsed.",cmStringNullGuard(outFn));
299
+    goto errLabel;
300
+  }
301
+
302
+  if((fn = cmFsMakeFn( pathParts->dirStr, pathParts->fnStr, "dot", NULL )) == NULL )
303
+  {
304
+    rc = cmErrMsg(&p->err,kFileFailDotRC,"The output file name could not be formed.");
305
+    goto errLabel;
306
+  }
307
+
308
+  if( cmFileOpen(&fH,fn,kWriteFileFl,p->err.rpt) != kOkFileRC )
309
+  {
310
+    rc = cmErrMsg(&p->err,kFileFailDotRC,"The output file '%s' could not be created.",cmStringNullGuard(outFn));
311
+    goto errLabel;
312
+  }
313
+
314
+  cmFilePrintf(fH,"digraph dsppgm\n{\n node [shape=record]\n");
315
+
316
+  cmDotProc_t* proc = p->procs;
317
+  for(; proc!=NULL; proc=proc->link )
318
+    if( proc->skipFl==false && _cmDotProcConnCount(proc)>0 )
319
+    { 
320
+      cmFilePrintf(fH,"\"%s\" [label=\"<n> %s",proc->outStr,proc->outStr);
321
+      
322
+      cmDotPort_t* port = proc->ports;
323
+      for(; port!=NULL; port=port->link)
324
+        if( port->connCnt > 0 )
325
+          cmFilePrintf(fH,"|<p%i> %s",port->portNo,port->labelStr);
326
+      
327
+      cmFilePrintf(fH,"\"];\n");
328
+    }
329
+  
330
+  cmDotConn_t* c = p->conns;
331
+  for(; c!=NULL; c=c->link)
332
+    if( !c->skipFl )
333
+    {
334
+      cmFilePrintf(fH,"\"%s\":p%i -> \"%s\":p%i;\n",
335
+        c->srcPort->proc->outStr,c->srcPort->portNo,
336
+        c->dstPort->proc->outStr,c->dstPort->portNo );
337
+    }
338
+  
339
+  cmFilePrintf(fH,"}\n");
340
+   
341
+ errLabel:
342
+  cmFileClose(&fH);
343
+  cmFsFreeFn(fn);
344
+  cmFsFreePathParts(pathParts);
345
+  return rc;
346
+}
347
+
348
+cmDotRC_t cmDspPgmJsonToDot( cmCtx_t* ctx, const cmChar_t* inFn, const cmChar_t* outFn )
349
+{
350
+  cmDotRC_t       rc     = kOkDotRC;
351
+  cmJsonH_t       jsH    = cmJsonNullHandle;
352
+  cmJsonNode_t*   arr    = NULL;
353
+  cmJsonNode_t*   rp     = NULL;
354
+  const char*     errLbl = NULL;
355
+  cmDot_t         dot;
356
+  unsigned        i;
357
+  cmDot_t*        p = &dot;
358
+
359
+  memset(p,0,sizeof(dot));
360
+  
361
+  cmErrSetup(&p->err,&ctx->rpt,"cmDspPgmJsonToDot");
362
+
363
+  // open the pgm description json file
364
+  if( cmJsonInitializeFromFile( &jsH, inFn, ctx ) != kOkJsRC )
365
+    return cmErrMsg(&p->err,kJsonFailDotRC,"The program description file '%s' could not be opened.",cmStringNullGuard(inFn));
366
+
367
+  // create an lheap to hold internal data objects
368
+  if(cmLHeapIsValid( p->lH = cmLHeapCreate( 8192, ctx))==false )
369
+  {
370
+    rc = cmErrMsg(&p->err,kLHeapFailDotRC,"The internal LHeap could not be created.");
371
+    goto errLabel;
372
+  }
373
+
374
+  // locate the proc instance desc. array in the JSON tree
375
+  if((arr = cmJsonFindValue(jsH, "inst_array", NULL, kArrayTId )) == NULL )
376
+  {
377
+    rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'inst_array' tag was not found.");
378
+    goto errLabel;
379
+  }
380
+
381
+  // get a count of proc instances
382
+  unsigned n = cmJsonChildCount(arr);
383
+
384
+  // parse each proc instance
385
+  for(i=0; i<n; ++i)
386
+  {
387
+    
388
+    if((rp = cmJsonArrayElement(arr,i)) == NULL )
389
+    {
390
+      rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'inst_array' element %i was not found.",i);
391
+      goto errLabel;      
392
+    }
393
+
394
+    cmChar_t* classStr = NULL;
395
+    cmChar_t* instStr = NULL;
396
+    if( cmJsonMemberValues(rp, &errLbl,
397
+        "class", kStringTId, &classStr,
398
+        "label", kStringTId, &instStr,
399
+        NULL ) != kOkJsRC )
400
+    {
401
+      rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'inst_array' element %i parse failed.",i);
402
+      goto errLabel;      
403
+    }
404
+
405
+    // create a proc instance data record
406
+    _cmDotNewProc( p, classStr, instStr );
407
+    
408
+  }
409
+
410
+  // locate the connection desc array in the JSON tree
411
+  if((arr = cmJsonFindValue(jsH, "conn_array", NULL, kArrayTId)) == NULL )
412
+  {
413
+    rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'conn_array' tag was not found.");
414
+    goto errLabel;
415
+  }
416
+
417
+  // get a count of the connections
418
+  n = cmJsonChildCount(arr);
419
+
420
+  // for each connection
421
+  for(i=0; i<n; ++i)
422
+  {
423
+    
424
+    if((rp = cmJsonArrayElement(arr,i)) == NULL )
425
+    {
426
+      rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'conn_array' element %i was not found.",i);
427
+      goto errLabel;      
428
+    }
429
+
430
+    cmChar_t* srcStr     = NULL;
431
+    cmChar_t* srcPortStr = NULL;
432
+    cmChar_t* dstStr     = NULL;
433
+    cmChar_t* dstPortStr = NULL;
434
+
435
+    if( cmJsonMemberValues(rp, &errLbl,
436
+        "sid",  kStringTId, &srcStr,
437
+        "svar", kStringTId, &srcPortStr,
438
+        "did",  kStringTId, &dstStr,
439
+        "dvar", kStringTId, &dstPortStr,
440
+        NULL) != kOkJsRC )
441
+    {
442
+      rc = cmErrMsg(&p->err,kJsonSyntaxErrDotRC,"The 'conn_array' element %i parse failed.",i);
443
+      goto errLabel;      
444
+    }
445
+
446
+    // create a connection data record
447
+    _cmDotNewConnection( p, srcStr, srcPortStr, dstStr, dstPortStr );    
448
+    
449
+  }
450
+  
451
+  rc = _cmDotWriteOutput(p, outFn );
452
+
453
+  
454
+ errLabel:
455
+  cmJsonFinalize(&jsH);
456
+  cmLHeapDestroy(&p->lH);
457
+  
458
+  return rc;
459
+}

+ 30
- 0
app/cmDspPgmJsonToDot.h Voir le fichier

@@ -0,0 +1,30 @@
1
+#ifndef cmDspPgmJsonToDot_h
2
+#define cmDspPgmJsonToDot_h
3
+
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+  //( { file_desc:"Convert a JSON graph description to a DOT vector graphics file." kw:[file plot]}
9
+  
10
+  enum
11
+  {
12
+    kOkDotRC = cmOkRC,
13
+    kJsonFailDotRC,
14
+    kJsonSyntaxErrDotRC,
15
+    kInvalidArgDotRC,
16
+    kLHeapFailDotRC,
17
+    kFileFailDotRC
18
+  };
19
+
20
+  typedef unsigned cmDotRC_t;
21
+
22
+  cmDotRC_t cmDspPgmJsonToDot( cmCtx_t* ctx, const cmChar_t* inFn, const cmChar_t* outFn );
23
+
24
+  //)
25
+  
26
+#ifdef __cplusplus
27
+}
28
+#endif
29
+  
30
+#endif

+ 2
- 1
app/cmOnset.c Voir le fichier

@@ -286,12 +286,13 @@ cmOnRC_t cmOnsetProc( cmOnH_t h, const cmOnsetCfg_t* cfg, const cmChar_t* inAudi
286 286
   p->medFiltFrmCnt = cmMax(3,floor(cfg->medFiltWndMs * p->afInfo.srate / (1000.0 * p->hopSmpCnt)));
287 287
   p->preDelaySmpCnt= floor(cfg->preDelayMs * p->afInfo.srate / 1000.0);
288 288
 
289
+  cmRptPrintf(p->err.rpt,"wndFrmCnt:%i preWndMult:%f thresh:%f maxHz:%f filtCoeff:%f filterId:%i preDelayMs:%f\n",cfg->wndFrmCnt,cfg->preWndMult,cfg->threshold,cfg->maxFrqHz,cfg->filtCoeff,cfg->medFiltWndMs,cfg->filterId,cfg->preDelayMs );
289 290
   cmRptPrintf(p->err.rpt,"Analysis Hop Duration: %8.2f ms %i smp\n",(double)p->hopSmpCnt*1000/p->afInfo.srate,p->hopSmpCnt);  
290 291
   cmRptPrintf(p->err.rpt,"Median Filter Window:  %8.2f ms %i frames\n",cfg->medFiltWndMs,p->medFiltFrmCnt);
291 292
   cmRptPrintf(p->err.rpt,"Detection Pre-delay:   %8.2f ms %i smp\n",cfg->preDelayMs, p->preDelaySmpCnt);
292 293
 
293 294
   // initialize the audio file reader
294
-  if( cmAudioFileRdOpen( p->afRdPtr, p->hopSmpCnt, inAudioFn, p->cfg.audioChIdx, 0, cmInvalidIdx ) != cmOkRC )
295
+  if( cmAudioFileRdOpen( p->afRdPtr, p->hopSmpCnt, inAudioFn, p->cfg.audioChIdx, 0, 0 ) != cmOkRC )
295 296
   {
296 297
     rc =  cmErrMsg(&p->err,kDspProcFailOnRC, "The audio file reader open failed.");
297 298
     goto errLabel;

+ 4
- 0
app/cmOnset.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Musical event onset detector." kw:[audio] }
9
+  
8 10
   enum
9 11
   {
10 12
     kOkOnRC = cmOkRC,
@@ -65,6 +67,8 @@ extern "C" {
65 67
 
66 68
   cmOnRC_t cmOnsetTest( cmCtx_t* c );
67 69
 
70
+  //)
71
+  
68 72
 #ifdef __cplusplus
69 73
 }
70 74
 #endif

+ 4
- 2
app/cmPickup.h Voir le fichier

@@ -5,7 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-
8
+  //( { file_desc:"'fluxo' channel calibration and gain normalization program." kw:[fluxo]}
9
+  
9 10
   enum
10 11
   {
11 12
     kOkPuRC = cmOkRC,
@@ -88,7 +89,8 @@ extern "C" {
88 89
   void cmPuReport( cmPuH_t h, cmRpt_t* rpt );
89 90
 
90 91
   void cmPuTest(cmCtx_t* ctx);
91
-
92
+  //)
93
+  
92 94
 #ifdef __cplusplus
93 95
 }
94 96
 #endif

+ 37
- 27
app/cmScore.c Voir le fichier

@@ -133,19 +133,19 @@ typedef struct
133 133
 
134 134
 cmScEvtRef_t _cmScEvtRefArray[] = 
135 135
 {
136
-  { kTimeSigEvtScId, 0, "tsg" },
137
-  { kKeySigEvtScId, 0,  "ksg" },
138
-  { kTempoEvtScId, 0,   "tmp" },
139
-  { kTrackEvtScId, 0,   "trk" },
140
-  { kTextEvtScId, 0,    "txt" },
141
-  { kNameEvtScId, 0,    "nam" },
142
-  { kEOTrackEvtScId, 0, "eot" },
143
-  { kCopyEvtScId, 0,    "cpy" },
144
-  { kBlankEvtScId, 0,   "blk" },
145
-  { kBarEvtScId, 0,     "bar" },
146
-  { kPgmEvtScId, 0,     "pgm" },
147
-  { kCtlEvtScId, 0,     "ctl" },
148
-  { kNonEvtScId, 0,     "non" },
136
+  { kTimeSigEvtScId, kTimeSigMdId,  "tsg" },
137
+  { kKeySigEvtScId,  kKeySigMdId,   "ksg" },
138
+  { kTempoEvtScId,   kTempoMdId,    "tmp" },
139
+  { kTrackEvtScId,   kTrkNameMdId,  "trk" },
140
+  { kTextEvtScId,    kTextMdId,     "txt" },
141
+  { kNameEvtScId,    kInstrNameMdId,"nam" },
142
+  { kEOTrackEvtScId, kEndOfTrkMdId, "eot" },
143
+  { kCopyEvtScId,    kCopyMdId,     "cpy" },
144
+  { kBlankEvtScId,   0,             "blk" },
145
+  { kBarEvtScId,     0,             "bar" },
146
+  { kPgmEvtScId,     kPgmMdId,      "pgm" },
147
+  { kCtlEvtScId,     kCtlMdId,      "ctl" },
148
+  { kNonEvtScId,     kNoteOnMdId,   "non" },
149 149
   { kInvalidEvtScId, 0, "***" }
150 150
 };
151 151
 
@@ -196,6 +196,20 @@ const cmChar_t* cmScEvtTypeIdToLabel( unsigned id )
196 196
   return NULL;
197 197
 }
198 198
 
199
+const cmChar_t* cmScStatusToOpString( unsigned id )
200
+{
201
+  if( id == 0 )
202
+    return "<unknown>";
203
+  
204
+  cmScEvtRef_t* r = _cmScEvtRefArray;
205
+  for(; r->id != kInvalidEvtScId; ++r )
206
+    if( r->flag == id )
207
+      return r->label;
208
+  return NULL;
209
+  
210
+}
211
+
212
+
199 213
 unsigned _cmScDynLabelToId( const cmChar_t* label )
200 214
 {
201 215
   cmScEvtRef_t* r = _cmScDynRefArray;
@@ -2419,10 +2433,8 @@ cmScRC_t      cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
2419 2433
     goto errLabel;
2420 2434
   }
2421 2435
 
2422
-  // Convert the track message 'dtick' field to delta-microseconds.
2423
-  cmMidiFileTickToMicros(mfH);
2424
-
2425
-
2436
+  //printf("secs:%f smps:%f\n",cmMidiFileDurSecs(mfH),cmMidiFileDurSecs(mfH)*96000);
2437
+  
2426 2438
   unsigned                 msgCnt = cmMidiFileMsgCount(mfH);
2427 2439
   unsigned                 i;
2428 2440
   const cmMidiTrackMsg_t** tmpp   = cmMidiFileMsgArray(mfH);
@@ -2456,14 +2468,15 @@ cmScRC_t      cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
2456 2468
     unsigned                midiCh = 0;
2457 2469
     unsigned                d0     = 0;
2458 2470
     unsigned                d1     = 0;
2459
-    unsigned metaId = 0;
2460
-    double   dsecs  = (double)tmp->dtick / 1000000.0;
2471
+    unsigned                metaId = 0;
2472
+    double                  dsecs  = (double)tmp->amicro / 1000000.0;
2461 2473
 
2462 2474
     acc_secs += dsecs;
2463 2475
 
2464 2476
     if( tmp->status == kMetaStId )
2465 2477
     {
2466
-      opStr  = cmMidiMetaStatusToLabel(tmp->metaId);
2478
+      //opStr  = cmMidiMetaStatusToLabel(tmp->metaId);
2479
+      opStr  = cmScStatusToOpString(tmp->metaId);
2467 2480
       metaId = tmp->metaId;
2468 2481
 
2469 2482
       switch( tmp->metaId )
@@ -2474,7 +2487,8 @@ cmScRC_t      cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
2474 2487
     }
2475 2488
     else
2476 2489
     {
2477
-      opStr = cmMidiStatusToLabel(tmp->status);
2490
+      //opStr = cmMidiStatusToLabel(tmp->status);
2491
+      opStr = cmScStatusToOpString(tmp->status);
2478 2492
       if( cmMidiIsChStatus( tmp->status ) )
2479 2493
       {
2480 2494
         midiCh = tmp->u.chMsgPtr->ch;
@@ -2647,10 +2661,6 @@ void cmScoreFix( cmCtx_t* ctx )
2647 2661
   if( cmMidiFileOpen(mfn,&mfH,ctx) != kOkMfRC )
2648 2662
     goto errLabel;
2649 2663
 
2650
-  cmMidiFileTickToMicros(mfH);
2651
-
2652
-  cmMidiFileCalcNoteDurations(mfH);
2653
-
2654 2664
   mn = cmMidiFileMsgCount(mfH);
2655 2665
 
2656 2666
   msg = cmMidiFileMsgArray(mfH);
@@ -2680,7 +2690,7 @@ void cmScoreFix( cmCtx_t* ctx )
2680 2690
         const cmMidiTrackMsg_t* m = msg[mi];
2681 2691
 
2682 2692
         assert( mi+1 <= id );
2683
-        secs += m->dtick/1000000.0;
2693
+        secs += m->amicro/1000000.0;
2684 2694
 
2685 2695
         if( mi+1 != id )
2686 2696
         {
@@ -2696,7 +2706,7 @@ void cmScoreFix( cmCtx_t* ctx )
2696 2706
           ++mi;
2697 2707
 
2698 2708
           if( m->status == kNoteOnMdId )
2699
-            cmCsvSetCellDouble(   csvH, ci, kDSecsColScIdx, m->u.chMsgPtr->durTicks/1000000.0 );
2709
+            cmCsvSetCellDouble(   csvH, ci, kDSecsColScIdx, m->u.chMsgPtr->durMicros  /1000000.0 );
2700 2710
           break;
2701 2711
         }
2702 2712
         

+ 5
- 2
app/cmScore.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Object for managing musical score data." kw:[score]}
9
+  
8 10
   enum
9 11
   {
10 12
     kOkScRC = cmOkRC,
@@ -155,7 +157,7 @@ extern "C" {
155 157
 
156 158
   const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
157 159
   const cmChar_t* cmScDynIdToLabel( unsigned id );
158
-
160
+  const cmChar_t* cmScStatusToOpString( unsigned id );
159 161
 
160 162
   // Initialize a score object from a CSV File generated from a score spreadsheet.
161 163
   // The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these 
@@ -273,7 +275,8 @@ extern "C" {
273 275
 
274 276
   void          cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
275 277
 
276
-
278
+  //)
279
+  
277 280
 #ifdef __cplusplus
278 281
 }
279 282
 #endif

+ 4
- 0
app/cmScoreProc.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Programs for processing cmScore and peformane data." kw:[score seq]}
9
+
8 10
   typedef unsigned cmSpRC_t;
9 11
 
10 12
   enum
@@ -21,6 +23,8 @@ extern "C" {
21 23
 
22 24
   cmSpRC_t  cmScoreProc(cmCtx_t* ctx );
23 25
 
26
+  //)
27
+  
24 28
 #ifdef __cplusplus
25 29
 }
26 30
 #endif

+ 6
- 3
app/cmSdb.h Voir le fichier

@@ -5,7 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  /*
8
+  /*( { file_desc:"Musical instrument sample database manager and synthetic sequence generator." kw:[audio] }
9
+
9 10
     The CSV file used to initialize a SDB object has the  following column syntax.
10 11
     
11 12
     Column Name     Type  Description
@@ -40,7 +41,7 @@ extern "C" {
40 41
         so that their cmSdb value is zero based.  See cmSdbLoad().
41 42
  
42 43
    */
43
-
44
+  
44 45
   enum
45 46
   {
46 47
     kOkSdbRC,
@@ -291,7 +292,9 @@ extern "C" {
291 292
   void                   cmSdbSeqPrint( cmSdbSeqH_t sh, cmRpt_t* rpt );
292 293
 
293 294
   cmSdbRC_t cmSdbTest( cmCtx_t* ctx );
294
-
295
+  
296
+  //)
297
+  
295 298
 #ifdef __cplusplus
296 299
 }
297 300
 #endif

+ 7
- 6
app/cmTakeSeqBldr.c Voir le fichier

@@ -956,14 +956,15 @@ cmTsbRC_t cmTakeSeqBldrLoadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool ov
956 956
   }
957 957
 
958 958
   // convert the dtick field to delta samples
959
-  cmMidiFileTickToSamples( mfH, cmTimeLineSampleRate(p->tlH), false );
959
+  //cmMidiFileTickToSamples( mfH, cmTimeLineSampleRate(p->tlH), false );
960 960
   
961 961
   // calculate MIDI note and pedal durations (see cmMidiChMsg_t.durTicks)
962 962
   cmMidiFileCalcNoteDurations( mfH );
963 963
   
964
-  unsigned                 i   = 0;
965
-  unsigned                 n   = cmMidiFileMsgCount(mfH);
966
-  const cmMidiTrackMsg_t** a   = cmMidiFileMsgArray(mfH);
964
+  unsigned                 i     = 0;
965
+  unsigned                 n     = cmMidiFileMsgCount(mfH);
966
+  const cmMidiTrackMsg_t** a     = cmMidiFileMsgArray(mfH);
967
+  double                   srate = cmTimeLineSampleRate(p->tlH);        
967 968
   
968 969
   // allocate and link a new take render record
969 970
   cmTakeTsb_t* t = cmMemAllocZ(cmTakeTsb_t,1);
@@ -1011,8 +1012,8 @@ cmTsbRC_t cmTakeSeqBldrLoadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool ov
1011 1012
     m1->scEvtIdx  = stm != NULL ? stm->scEvtIdx : cmInvalidIdx;
1012 1013
     m1->flags     = stm != NULL ? stm->flags    : 0;
1013 1014
     m1->ref       = m0;
1014
-    m1->offsetSmp = mf0 == NULL ? 0 : mf1->dtick;
1015
-    m1->durSmp    = mf1->u.chMsgPtr->durTicks;
1015
+    m1->offsetSmp = mf0 == NULL ? 0 : round(mf1->amicro * srate / 1000000.0);
1016
+    m1->durSmp    = mf1->u.chMsgPtr->durMicros * srate / 1000000.0;
1016 1017
     m1->d0        = mf1->u.chMsgPtr->d0;
1017 1018
     m1->d1        = mf1->u.chMsgPtr->d1;
1018 1019
     m1->status    = mf1->status;

+ 4
- 1
app/cmTakeSeqBldr.h Voir le fichier

@@ -5,7 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-
8
+  //( { file_desc:"Concatenate multipel overlapping MIDI performances into a single virtual performance based by associating score information with the MIDI events." kw:[seq] }
9
+  
9 10
   enum
10 11
   {
11 12
     kOkTsbRC = cmOkRC,
@@ -123,6 +124,8 @@ extern "C" {
123 124
 
124 125
   cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx );
125 126
 
127
+  //)
128
+  
126 129
 #ifdef __cplusplus
127 130
 }
128 131
 #endif

+ 46
- 38
app/cmTimeLine.c Voir le fichier

@@ -530,16 +530,14 @@ cmTlRC_t _cmTlAllocRecd2(
530 530
   tp->flags      = 0;
531 531
   tp->text       = NULL;
532 532
 
533
+  //printf("%9i %9i %9i %9i\n",tp->begSmpIdx,tp->durSmpCnt,refPtr==NULL?0:refPtr->obj->seqSmpIdx, tp->seqSmpIdx);
534
+  
533 535
   op->obj        = tp;
534 536
   op->mem        = mem;
535 537
   op->memByteCnt = byteCnt;
536 538
   op->next       = NULL;
537 539
   op->prev       = NULL;
538 540
 
539
-
540
-  //if( seqId == 4 )
541
-  //  printf("seq:%i id:%i type:%i accum:%i ref:%i offs:%i %f\n",seqId, tp->uid, tp->typeId, tp->seqSmpIdx, refPtr==NULL?-1:refPtr->obj->uid, begSmpIdx, begSmpIdx/(96000.0*60.0) );
542
-
543 541
   _cmTlInsertAfter(p, _cmTlFindRecdBefore(p,op), op );
544 542
 
545 543
 
@@ -651,36 +649,36 @@ cmTlRC_t _cmTlProcMidiFile( _cmTl_t* p,  _cmTlObj_t* op, cmMidiFileH_t mfH )
651 649
   const cmMidiTrackMsg_t** mapp         = cmMidiFileMsgArray(mfH);
652 650
   unsigned                 mi           = 0;
653 651
   _cmTlObj_t*              refOp        = op;
652
+  double                   smpPerMicro  = p->srate / 1000000.0;
653
+  unsigned                 begSmpIdx0   = 0;
654 654
   mfp->noteOnCnt = 0;
655 655
   
656 656
   // for each midi message
657 657
   for(; mi<mn; ++mi)
658 658
   {
659
-    _cmTlObj_t*             meop = NULL;
660
-    const cmMidiTrackMsg_t* mp   = mapp[mi];
661
-
662
-    int      begSmpIdx         = mp->dtick;
663
-    int      durSmpCnt         = 0;
664
-    unsigned midiTrkMsgByteCnt = cmMidiFilePackTrackMsgBufByteCount( mp );
665
-    unsigned recdByteCnt       = sizeof(cmTlMidiEvt_t) + midiTrkMsgByteCnt;
666
-
667
-    //if( mfp->obj.seqId==4 && mi<=25 )
668
-    //  printf("%s: bsi:%9i acc:%f smp acc:%f min %s\n", mp->status == kNoteOnMdId?"non":"   ", begSmpIdx, accum, accum / (p->srate * 60),cmStringNullGuard(mfp->obj.name));
659
+    _cmTlObj_t*             meop              = NULL;
660
+    const cmMidiTrackMsg_t* mp                = mapp[mi];
661
+    int                     begSmpIdx         = mp->amicro * smpPerMicro;
662
+    int                     durSmpCnt         = 0;
663
+    unsigned                midiTrkMsgByteCnt = cmMidiFilePackTrackMsgBufByteCount( mp );
664
+    unsigned                recdByteCnt       = sizeof(cmTlMidiEvt_t) + midiTrkMsgByteCnt;
669 665
 
670 666
     // count the note-on messages
671 667
     if( cmMidiIsNoteOn(mp->status) )
672 668
     {
673
-      durSmpCnt = mp->u.chMsgPtr->durTicks;
669
+      durSmpCnt = mp->u.chMsgPtr->durMicros * smpPerMicro;
674 670
       ++mfp->noteOnCnt;
675 671
     }
676 672
 
677 673
     if( cmMidiIsCtl(mp->status) && cmMidiIsSustainPedal(mp->status,mp->u.chMsgPtr->d0) )
678
-      durSmpCnt = mp->u.chMsgPtr->durTicks;
674
+      durSmpCnt = mp->u.chMsgPtr->durMicros * smpPerMicro;
679 675
 
680 676
     // allocate the generic time-line object record
681
-    if((rc = _cmTlAllocRecd2(p, NULL, refOp, begSmpIdx, durSmpCnt, kMidiEvtTlId, mfp->obj.seqId, recdByteCnt, &meop)) != kOkTlRC )
677
+    if((rc = _cmTlAllocRecd2(p, NULL, refOp, begSmpIdx-begSmpIdx0, durSmpCnt, kMidiEvtTlId, mfp->obj.seqId, recdByteCnt, &meop)) != kOkTlRC )
682 678
       goto errLabel;
683 679
 
680
+    begSmpIdx0 = begSmpIdx;
681
+    
684 682
     assert( meop != NULL );
685 683
     
686 684
     cmTlMidiEvt_t* mep = _cmTimeLineMidiEvtObjPtr(p,meop->obj);
@@ -731,7 +729,7 @@ cmTlRC_t _cmTlAllocMidiFileRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
731 729
   unsigned durSmpCnt = floor(cmMidiFileDurSecs(mfH)*p->srate);
732 730
 
733 731
   // convert the midi file from delta ticks to delta samples
734
-  cmMidiFileTickToSamples(mfH,p->srate,false);
732
+  //cmMidiFileTickToSamples(mfH,p->srate,false);
735 733
 
736 734
   // assign note durations to all note-on msg's
737 735
   cmMidiFileCalcNoteDurations(mfH);
@@ -757,6 +755,7 @@ cmTlRC_t _cmTlAllocMidiFileRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
757 755
 
758 756
   op->obj->text = mp->fn;
759 757
 
758
+
760 759
   // insert the events in the midi file as individual time line objects
761 760
   if((rc = _cmTlProcMidiFile(p, op, mfH)) != kOkTlRC )
762 761
     goto errLabel;
@@ -1363,7 +1362,7 @@ cmTlRC_t cmTimeLineReadJson(  cmTlH_t* hp, const cmChar_t* ifn )
1363 1362
 
1364 1363
   if( cmJsonMemberValues(jnp,&errLabelPtr,
1365 1364
       "srate",kRealTId,&p->srate,
1366
-      "onset",kObjectTId,&cnp,
1365
+      "onset",kObjectTId | kOptArgJsFl,&cnp,
1367 1366
       "objArray",kArrayTId,&jnp,
1368 1367
       NULL) != kOkJsRC )
1369 1368
   {
@@ -1374,28 +1373,31 @@ cmTlRC_t cmTimeLineReadJson(  cmTlH_t* hp, const cmChar_t* ifn )
1374 1373
     goto errLabel;
1375 1374
   }
1376 1375
 
1377
-  if((jsRC = cmJsonMemberValues(cnp,&errLabelPtr,
1378
-      "wndMs",        kRealTId, &p->onsetCfg.wndMs,
1379
-      "hopFact",      kIntTId,  &p->onsetCfg.hopFact,
1380
-      "audioChIdx",   kIntTId,  &p->onsetCfg.audioChIdx,
1381
-      "wndFrmCnt",    kIntTId,  &p->onsetCfg.wndFrmCnt,
1382
-      "preWndMult",   kRealTId, &p->onsetCfg.preWndMult,
1383
-      "threshold",    kRealTId, &p->onsetCfg.threshold,
1384
-      "maxFrqHz",     kRealTId, &p->onsetCfg.maxFrqHz,
1385
-      "filtCoeff",    kRealTId, &p->onsetCfg.filtCoeff,
1386
-      "medFiltWndMs", kRealTId, &p->onsetCfg.medFiltWndMs,
1387
-      "filterId",     kIntTId,  &p->onsetCfg.filterId,
1388
-      "preDelayMs",   kRealTId, &p->onsetCfg.preDelayMs,
1389
-        NULL)) !=        kOkJsRC )
1376
+  if( cnp != NULL )
1390 1377
   {
1378
+    if((jsRC = cmJsonMemberValues(cnp,&errLabelPtr,
1379
+          "wndMs",        kRealTId, &p->onsetCfg.wndMs,
1380
+          "hopFact",      kIntTId,  &p->onsetCfg.hopFact,
1381
+          "audioChIdx",   kIntTId,  &p->onsetCfg.audioChIdx,
1382
+          "wndFrmCnt",    kIntTId,  &p->onsetCfg.wndFrmCnt,
1383
+          "preWndMult",   kRealTId, &p->onsetCfg.preWndMult,
1384
+          "threshold",    kRealTId, &p->onsetCfg.threshold,
1385
+          "maxFrqHz",     kRealTId, &p->onsetCfg.maxFrqHz,
1386
+          "filtCoeff",    kRealTId, &p->onsetCfg.filtCoeff,
1387
+          "medFiltWndMs", kRealTId, &p->onsetCfg.medFiltWndMs,
1388
+          "filterId",     kIntTId,  &p->onsetCfg.filterId,
1389
+          "preDelayMs",   kRealTId, &p->onsetCfg.preDelayMs,
1390
+          NULL)) !=        kOkJsRC )
1391
+    {
1391 1392
     
1392
-    if(jsRC == kNodeNotFoundJsRC )
1393
-      rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analysizer cfg. required field:'%s' was not found in '%s'.",errLabelPtr,cmStringNullGuard(ifn));
1394
-    else
1395
-      rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analyzer cfg.  in '%s'.",cmStringNullGuard(ifn));
1396
-    goto errLabel;
1393
+      if(jsRC == kNodeNotFoundJsRC )
1394
+        rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analysizer cfg. required field:'%s' was not found in '%s'.",errLabelPtr,cmStringNullGuard(ifn));
1395
+      else
1396
+        rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analyzer cfg.  in '%s'.",cmStringNullGuard(ifn));
1397
+      goto errLabel;
1398
+    }
1397 1399
   }
1398
-
1400
+  
1399 1401
   for(i=0; i<cmJsonChildCount(jnp); ++i)
1400 1402
   {
1401 1403
     const cmJsonNode_t* rp = cmJsonArrayElementC(jnp,i);
@@ -1478,6 +1480,12 @@ cmTlRC_t cmTimeLineGenOnsetMarks( cmTlH_t h, unsigned seqId )
1478 1480
   unsigned   i,j;
1479 1481
   unsigned   smpIdx;
1480 1482
 
1483
+  if( p->onsetCfg.wndMs == 0 )
1484
+  {
1485
+    rc = cmErrMsg(&p->err,kOnsetFailTlRC,"Audio onset analyzer not-configured.");
1486
+    goto errLabel;    
1487
+  }
1488
+
1481 1489
   // initialize the audio onset analyzer
1482 1490
   if( cmOnsetInitialize(&p->ctx, &onsH ) != kOkOnRC )
1483 1491
   {

+ 4
- 0
app/cmTimeLine.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Manage, save, and restore a time-line containing  MIDI files, Audio files, Audio events, and arbitrary markers ." kw[seq] }
9
+ 
8 10
 
9 11
   typedef cmHandle_t cmTlH_t;
10 12
 
@@ -248,6 +250,8 @@ extern "C" {
248 250
   // callback function.
249 251
   cmTlRC_t cmTimeLineDecode( const void* msg, unsigned msgByteCnt, cmTlUiMsg_t* uiMsg );
250 252
 
253
+  //)
254
+  
251 255
 #ifdef __cplusplus
252 256
 }
253 257
 #endif

+ 145
- 145
cmApBuf.h Voir le fichier

@@ -1,34 +1,33 @@
1
-/// \file cmApBuf.h
2
-/// \brief  Thread-safe audio buffer class.
3
-///
4
-/// This file defines an audio buffer class which handles
5
-/// buffering incoming (recording) and outgoing (playback)
6
-/// samples in a thread-safe manner. 
7
-///
8
-/// Usage example and testing code:
9
-/// See cmApBufTest() and cmAudioSysTest().
10
-/// \snippet cmApBuf.c cmApBufExample
11
-///
12
-/// Notes on channel flags:
13
-/// Disabled channels:  kChFl is cleared
14
-///   cmApBufGet()     
15
-///      in  - return NULL buffer pointers  
16
-///      out - return NULL buffer points
17
-///
18
-///   cmApBufUpdate()
19
-///      in  - incoming samples are set to 0. 
20
-///      out - outgoing samples are set to 0.
21
-///
22
-/// Muted channels: kMuteFl is set 
23
-///   cmApBufUpdate()
24
-///      in  - incoming samples are set to 0. 
25
-///      out - outgoing samples are set to 0.
26
-///
27
-/// Tone channels: kToneFl is set 
28
-///   cmApBufUpdate()
29
-///      in  - incoming samples are filled with a 1k sine tone
30
-///      out - outgoing samples are filled with a 1k sine tone
31
-///
1
+//( {file_desc: "Thread safe audio buffer class." kw:[rt audio]}
2
+//
3
+// This file defines an audio buffer class which handles
4
+// buffering incoming (recording) and outgoing (playback)
5
+// samples in a thread-safe manner. 
6
+//
7
+// Usage example and testing code:
8
+// See cmApBufTest() and cmAudioSysTest().
9
+// \snippet cmApBuf.c cmApBufExample
10
+//
11
+// Notes on channel flags:
12
+// Disabled channels:  kChFl is cleared
13
+//   cmApBufGet()     
14
+//      in  - return NULL buffer pointers  
15
+//      out - return NULL buffer points
16
+//
17
+//   cmApBufUpdate()
18
+//      in  - incoming samples are set to 0. 
19
+//      out - outgoing samples are set to 0.
20
+//
21
+// Muted channels: kMuteFl is set 
22
+//   cmApBufUpdate()
23
+//      in  - incoming samples are set to 0. 
24
+//      out - outgoing samples are set to 0.
25
+//
26
+// Tone channels: kToneFl is set 
27
+//   cmApBufUpdate()
28
+//      in  - incoming samples are filled with a 1k sine tone
29
+//      out - outgoing samples are filled with a 1k sine tone
30
+//)
32 31
 
33 32
 #ifndef cmApBuf_h
34 33
 #define cmApBuf_h
@@ -36,199 +35,200 @@
36 35
 #ifdef __cplusplus
37 36
 extern "C" {
38 37
 #endif
39
-
40
-  typedef cmRC_t cmAbRC_t;  ///< Result code type
38
+  
39
+  //(
40
+  typedef cmRC_t cmAbRC_t;  //< Result code type
41 41
   
42 42
   enum
43 43
   {
44 44
     kOkAbRC = 0
45 45
   };
46 46
 
47
-  /// Allocate and initialize an audio buffer.
48
-  /// devCnt - count of devices this buffer will handle.
49
-  /// meterMs - length of the meter buffers in milliseconds (automatically limit to the range:10 to 1000)
47
+  // Allocate and initialize an audio buffer.
48
+  // devCnt - count of devices this buffer will handle.
49
+  // meterMs - length of the meter buffers in milliseconds (automatically limit to the range:10 to 1000)
50 50
   cmAbRC_t cmApBufInitialize( unsigned devCnt, unsigned meterMs );
51 51
 
52
-  /// Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
52
+  // Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
53 53
   cmAbRC_t cmApBufFinalize();
54 54
 
55
-  /// Configure a buffer for a given device.  
55
+  // Configure a buffer for a given device.  
56 56
   cmAbRC_t cmApBufSetup( 
57
-    unsigned devIdx,              ///< device to setup
58
-    double   srate,               ///< device sample rate (only required for synthesizing the correct test-tone frequency)
59
-    unsigned dspFrameCnt,         /// dspFrameCnt - count of samples in channel buffers returned via cmApBufGet() 
60
-    unsigned cycleCnt,            ///< number of audio port cycles to store 
61
-    unsigned inChCnt,             ///< input channel count on this device
62
-    unsigned inFramesPerCycle,    ///< maximum number of incoming sample frames on an audio port cycle
63
-    unsigned outChCnt,            ///< output channel count on this device
64
-    unsigned outFramesPerCycle    ///< maximum number of outgoing sample frames in an audio port cycle
57
+    unsigned devIdx,              //< device to setup
58
+    double   srate,               //< device sample rate (only required for synthesizing the correct test-tone frequency)
59
+    unsigned dspFrameCnt,         // dspFrameCnt - count of samples in channel buffers returned via cmApBufGet() 
60
+    unsigned cycleCnt,            //< number of audio port cycles to store 
61
+    unsigned inChCnt,             //< input channel count on this device
62
+    unsigned inFramesPerCycle,    //< maximum number of incoming sample frames on an audio port cycle
63
+    unsigned outChCnt,            //< output channel count on this device
64
+    unsigned outFramesPerCycle    //< maximum number of outgoing sample frames in an audio port cycle
65 65
                          );
66 66
 
67
-  /// Prime the buffer with 'audioCycleCnt' * outFramesPerCycle samples ready to be played
67
+  // Prime the buffer with 'audioCycleCnt' * outFramesPerCycle samples ready to be played
68 68
   cmAbRC_t cmApBufPrimeOutput( unsigned devIdx, unsigned audioCycleCnt );
69 69
 
70
-  /// Notify the audio buffer that a device is being enabled or disabled.
70
+  // Notify the audio buffer that a device is being enabled or disabled.
71 71
   void     cmApBufOnPortEnable( unsigned devIdx, bool enabelFl );
72 72
 
73
-  /// This function is called asynchronously by the audio device driver to transfer incoming samples to the
74
-  /// the buffer and to send outgoing samples to the DAC. This function is 
75
-  /// intended to be called from the audio port callback function (\see cmApCallbackPtr_t).
76
-  /// This function is thread-safe under the condition where the audio device uses
77
-  /// different threads for input and output.
78
-  ///
79
-  /// Enable Flag: 
80
-  /// Input: If an input channel is disabled then the incoming samples are replaced with zeros.
81
-  /// Output: If an output channel is disabled then the packet samples are set to zeros.
82
-  ///
83
-  /// Tone Flag:
84
-  /// Input: If the tone flag is set on an input channel then the incoming samples are set to a sine tone.
85
-  /// Output: If the tone flag is set on an output channel then the packet samples are set to a sine tone.
86
-  ///
87
-  /// The enable flag has higher precedence than the tone flag therefore disabled channels
88
-  /// will be set to zero even if the tone flag is set.
73
+  // This function is called asynchronously by the audio device driver to transfer incoming samples to the
74
+  // the buffer and to send outgoing samples to the DAC. This function is 
75
+  // intended to be called from the audio port callback function (\see cmApCallbackPtr_t).
76
+  // This function is thread-safe under the condition where the audio device uses
77
+  // different threads for input and output.
78
+  //
79
+  // Enable Flag: 
80
+  // Input: If an input channel is disabled then the incoming samples are replaced with zeros.
81
+  // Output: If an output channel is disabled then the packet samples are set to zeros.
82
+  //
83
+  // Tone Flag:
84
+  // Input: If the tone flag is set on an input channel then the incoming samples are set to a sine tone.
85
+  // Output: If the tone flag is set on an output channel then the packet samples are set to a sine tone.
86
+  //
87
+  // The enable flag has higher precedence than the tone flag therefore disabled channels
88
+  // will be set to zero even if the tone flag is set.
89 89
   cmAbRC_t cmApBufUpdate(
90
-    cmApAudioPacket_t* inPktArray,  ///< full audio packets from incoming audio (from ADC)
91
-    unsigned           inPktCnt,    ///< count of incoming audio packets
92
-    cmApAudioPacket_t* outPktArray, ///< empty audio packet for outgoing audio (to DAC)  
93
-    unsigned           outPktCnt    ///< count of outgoing audio packets
90
+    cmApAudioPacket_t* inPktArray,  //< full audio packets from incoming audio (from ADC)
91
+    unsigned           inPktCnt,    //< count of incoming audio packets
92
+    cmApAudioPacket_t* outPktArray, //< empty audio packet for outgoing audio (to DAC)  
93
+    unsigned           outPktCnt    //< count of outgoing audio packets
94 94
                          );
95
-  /// Channel flags
95
+  // Channel flags
96 96
   enum
97 97
   {
98
-    kInApFl     = 0x01,  ///< Identify an input channel
99
-    kOutApFl    = 0x02,  ///< Identify an output channel
100
-    kEnableApFl = 0x04,  ///< Set to enable a channel, Clear to disable. 
101
-
102
-    kChApFl     = 0x08,  ///< Used to enable/disable a channel
103
-    kMuteApFl   = 0x10,  ///< Mute this channel
104
-    kToneApFl   = 0x20,  ///< Generate a tone on this channel
105
-    kMeterApFl  = 0x40,  ///< Turn meter's on/off
106
-    kPassApFl   = 0x80   ///< Pass input channels throught to the output. Must use cmApBufGetIO() to implement this functionality.
98
+    kInApFl     = 0x01,  //< Identify an input channel
99
+    kOutApFl    = 0x02,  //< Identify an output channel
100
+    kEnableApFl = 0x04,  //< Set to enable a channel, Clear to disable. 
101
+
102
+    kChApFl     = 0x08,  //< Used to enable/disable a channel
103
+    kMuteApFl   = 0x10,  //< Mute this channel
104
+    kToneApFl   = 0x20,  //< Generate a tone on this channel
105
+    kMeterApFl  = 0x40,  //< Turn meter's on/off
106
+    kPassApFl   = 0x80   //< Pass input channels throught to the output. Must use cmApBufGetIO() to implement this functionality.
107 107
   
108 108
   };
109 109
 
110
-  /// Return the meter window period as set by cmApBufInitialize()
110
+  // Return the meter window period as set by cmApBufInitialize()
111 111
   unsigned cmApBufMeterMs();
112 112
   
113 113
   // Set the meter update period. THis function limits the value to between 10 and 1000.
114 114
   void     cmApBufSetMeterMs( unsigned meterMs );
115 115
 
116
-  /// Returns the channel count set via cmApBufSetup().
116
+  // Returns the channel count set via cmApBufSetup().
117 117
   unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags );
118 118
 
119
-  /// Set chIdx to -1 to enable all channels on this device.
120
-  /// Set flags to {kInApFl | kOutApFl} | {kChApFl | kToneApFl | kMeterFl} | { kEnableApFl=on | 0=off }  
119
+  // Set chIdx to -1 to enable all channels on this device.
120
+  // Set flags to {kInApFl | kOutApFl} | {kChApFl | kToneApFl | kMeterFl} | { kEnableApFl=on | 0=off }  
121 121
   void cmApBufSetFlag( unsigned devIdx, unsigned chIdx, unsigned flags );
122 122
   
123
-  /// Return true if the the flags is set.
123
+  // Return true if the the flags is set.
124 124
   bool cmApBufIsFlag( unsigned devIdx, unsigned chIdx, unsigned flags );
125 125
 
126
-  /// Set chIdx to -1 to enable all channels on this device.
126
+  // Set chIdx to -1 to enable all channels on this device.
127 127
   void  cmApBufEnableChannel(   unsigned devIdx, unsigned chIdx, unsigned flags );
128 128
 
129
-  /// Returns true if an input/output channel is enabled on the specified device.
129
+  // Returns true if an input/output channel is enabled on the specified device.
130 130
   bool  cmApBufIsChannelEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
131 131
 
132
-  /// Set the state of the tone generator on the specified channel.
133
-  /// Set chIdx to -1 to apply the change to all channels on this device.
134
-  /// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
132
+  // Set the state of the tone generator on the specified channel.
133
+  // Set chIdx to -1 to apply the change to all channels on this device.
134
+  // Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
135 135
   void  cmApBufEnableTone(   unsigned devIdx, unsigned chIdx, unsigned flags );
136 136
 
137
-  /// Returns true if an input/output tone is enabled on the specified device.
137
+  // Returns true if an input/output tone is enabled on the specified device.
138 138
   bool  cmApBufIsToneEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
139 139
 
140
-  /// Mute a specified channel.
141
-  /// Set chIdx to -1 to apply the change to all channels on this device.
142
-  /// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
140
+  // Mute a specified channel.
141
+  // Set chIdx to -1 to apply the change to all channels on this device.
142
+  // Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
143 143
   void  cmApBufEnableMute(   unsigned devIdx, unsigned chIdx, unsigned flags );
144 144
 
145
-  /// Returns true if an input/output channel is muted on the specified device.
145
+  // Returns true if an input/output channel is muted on the specified device.
146 146
   bool  cmApBufIsMuteEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
147 147
 
148
-  /// Set the specified channel to pass through.
149
-  /// Set chIdx to -1 to apply the change to all channels on this device.
150
-  /// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
148
+  // Set the specified channel to pass through.
149
+  // Set chIdx to -1 to apply the change to all channels on this device.
150
+  // Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
151 151
   void  cmApBufEnablePass(   unsigned devIdx, unsigned chIdx, unsigned flags );
152 152
 
153
-  /// Returns true if pass through is enabled on the specified channel.
153
+  // Returns true if pass through is enabled on the specified channel.
154 154
   bool  cmApBufIsPassEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
155 155
 
156
-  /// Turn meter data collection on and off.
157
-  /// Set chIdx to -1 to apply the change to all channels on this device.
158
-  /// Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
156
+  // Turn meter data collection on and off.
157
+  // Set chIdx to -1 to apply the change to all channels on this device.
158
+  // Set flags to {kInApFl | kOutApFl} | { kEnableApFl=on | 0=off }
159 159
   void  cmApBufEnableMeter(   unsigned devIdx, unsigned chIdx, unsigned flags );
160 160
 
161
-  /// Returns true if an input/output tone is enabled on the specified device.
161
+  // Returns true if an input/output tone is enabled on the specified device.
162 162
   bool  cmApBufIsMeterEnabled(unsigned devIdx, unsigned chIdx, unsigned flags );
163 163
 
164
-  /// Return the meter value for the requested channel.
165
-  /// Set flags to kInApFl | kOutApFl.
164
+  // Return the meter value for the requested channel.
165
+  // Set flags to kInApFl | kOutApFl.
166 166
   cmApSample_t cmApBufMeter(unsigned devIdx, unsigned chIdx, unsigned flags );
167 167
 
168
-  /// Set chIdx to -1 to apply the gain to all channels on the specified device.
168
+  // Set chIdx to -1 to apply the gain to all channels on the specified device.
169 169
   void cmApBufSetGain( unsigned devIdx, unsigned chIdx, unsigned flags, double gain );
170 170
 
171
-  /// Return the current gain seting for the specified channel.
171
+  // Return the current gain seting for the specified channel.
172 172
   double cmApBufGain( unsigned devIdx, unsigned chIdx, unsigned flags ); 
173 173
 
174
-  /// Get the meter and fault status of the channel input or output channel array of a device.
175
-  /// Set 'flags' to { kInApFl | kOutApFl }.
176
-  /// The returns value is the count of channels actually written to meterArray.
177
-  /// If 'faultCntPtr' is non-NULL then it is set to the faultCnt of the associated devices input or output buffer.
174
+  // Get the meter and fault status of the channel input or output channel array of a device.
175
+  // Set 'flags' to { kInApFl | kOutApFl }.
176
+  // The returns value is the count of channels actually written to meterArray.
177
+  // If 'faultCntPtr' is non-NULL then it is set to the faultCnt of the associated devices input or output buffer.
178 178
   unsigned cmApBufGetStatus( unsigned devIdx, unsigned flags, double* meterArray, unsigned meterCnt, unsigned* faultCntPtr );
179 179
 
180
-  /// Do all enabled input/output channels on this device have samples available?
181
-  /// 'flags' can be set to either or both kInApFl and kOutApFl
180
+  // Do all enabled input/output channels on this device have samples available?
181
+  // 'flags' can be set to either or both kInApFl and kOutApFl
182 182
   bool  cmApBufIsDeviceReady( unsigned devIdx, unsigned flags ); 
183 183
 
184
-  /// This function is called by the application to get full incoming sample buffers and
185
-  /// to fill empty outgoing sample buffers.
186
-  /// Upon return each element in bufArray[bufChCnt] holds a pointer to a buffer assoicated 
187
-  /// with an audio channel or to NULL if the channel is disabled.
188
-  /// 'flags' can be set to kInApFl or kOutApFl but not both.
189
-  /// The buffers pointed to by bufArray[] each contain 'dspFrameCnt' samples. Where 
190
-  /// 'dspFrameCnt' was set in the earlier call to cmApBufSetup() for this device.
191
-  /// (see cmApBufInitialize()).
192
-  /// Note that this function just returns audio information it does not
193
-  /// change any cmApBuf() internal states.
184
+  // This function is called by the application to get full incoming sample buffers and
185
+  // to fill empty outgoing sample buffers.
186
+  // Upon return each element in bufArray[bufChCnt] holds a pointer to a buffer assoicated 
187
+  // with an audio channel or to NULL if the channel is disabled.
188
+  // 'flags' can be set to kInApFl or kOutApFl but not both.
189
+  // The buffers pointed to by bufArray[] each contain 'dspFrameCnt' samples. Where 
190
+  // 'dspFrameCnt' was set in the earlier call to cmApBufSetup() for this device.
191
+  // (see cmApBufInitialize()).
192
+  // Note that this function just returns audio information it does not
193
+  // change any cmApBuf() internal states.
194 194
   void cmApBufGet(     unsigned devIdx, unsigned flags, cmApSample_t* bufArray[], unsigned bufChCnt );
195 195
 
196
-  /// This function replaces calls to cmApBufGet() and implements pass-through and output 
197
-  /// buffer zeroing: 
198
-  /// 
199
-  /// 1) cmApBufGet(in);
200
-  /// 2) cmApBufGet(out);
201
-  /// 3) Copy through channels marked for 'pass' and set the associated oBufArray[i] channel to NULL.
202
-  /// 4) Zero all other enabled output channels.
203
-  ///
204
-  /// Notes:
205
-  /// 1) The oBufArray[] channels that are disabled or marked for pass-through will 
206
-  /// be set to NULL.
207
-  /// 2) The client is required to use this function to implement pass-through internally.
208
-  /// 3) This function just returns audio information it does not
209
-  /// change any cmApBuf() internal states.
210
-  /// 4) The timestamp pointers are optional.
196
+  // This function replaces calls to cmApBufGet() and implements pass-through and output 
197
+  // buffer zeroing: 
198
+  // 
199
+  // 1) cmApBufGet(in);
200
+  // 2) cmApBufGet(out);
201
+  // 3) Copy through channels marked for 'pass' and set the associated oBufArray[i] channel to NULL.
202
+  // 4) Zero all other enabled output channels.
203
+  //
204
+  // Notes:
205
+  // 1) The oBufArray[] channels that are disabled or marked for pass-through will 
206
+  // be set to NULL.
207
+  // 2) The client is required to use this function to implement pass-through internally.
208
+  // 3) This function just returns audio information it does not
209
+  // change any cmApBuf() internal states.
210
+  // 4) The timestamp pointers are optional.
211 211
   void cmApBufGetIO(   unsigned iDevIdx, cmApSample_t* iBufArray[], unsigned iBufChCnt, cmTimeSpec_t* iTimeStampPtr, 
212 212
                        unsigned oDevIdx, cmApSample_t* oBufArray[], unsigned oBufChCnt, cmTimeSpec_t* oTimeStampPtr );
213 213
 
214 214
 
215
-  /// The application calls this function each time it completes processing of a bufArray[]
216
-  /// returned from cmApBufGet(). 'flags' can be set to either or both kInApFl and kOutApFl.
217
-  /// This function should only be called from the client thread.
215
+  // The application calls this function each time it completes processing of a bufArray[]
216
+  // returned from cmApBufGet(). 'flags' can be set to either or both kInApFl and kOutApFl.
217
+  // This function should only be called from the client thread.
218 218
   void cmApBufAdvance( unsigned devIdx, unsigned flags );
219 219
 
220
-    /// Copy all available samples incoming samples from an input device to an output device.
221
-  /// The source code for this example is a good example of how an application should use cmApBufGet()
222
-  /// and cmApBufAdvance().
220
+    // Copy all available samples incoming samples from an input device to an output device.
221
+  // The source code for this example is a good example of how an application should use cmApBufGet()
222
+  // and cmApBufAdvance().
223 223
   void cmApBufInputToOutput( unsigned inDevIdx, unsigned outDevIdx );
224 224
 
225
-  /// Print the current buffer state.
225
+  // Print the current buffer state.
226 226
   void cmApBufReport( cmRpt_t* rpt );
227 227
 
228
-  /// Run a buffer usage simulation to test the class. cmAudioPortTest.c calls this function.
228
+  // Run a buffer usage simulation to test the class. cmAudioPortTest.c calls this function.
229 229
   void cmApBufTest( cmRpt_t* rpt );
230 230
 
231
-
231
+  //)
232 232
 
233 233
 
234 234
 #ifdef __cplusplus

+ 4
- 0
cmArray.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc: "Dynamic array container class." kw:[container] }
9
+  
8 10
 enum
9 11
 {
10 12
   kOkArRC = cmOkRC,
@@ -55,6 +57,8 @@ enum
55 57
   // Zero elements i:i+n-1
56 58
 #define cmArrayClrN(t,h,i,n) ((t*)cmArraySet(h,i,NULL,n))
57 59
 
60
+  //)
61
+  
58 62
 #ifdef __cplusplus
59 63
 }
60 64
 #endif

+ 6
- 1
cmAudDsp.c Voir le fichier

@@ -30,7 +30,7 @@
30 30
 #include "dsp/cmDspClass.h"
31 31
 #include "dsp/cmDspSys.h"
32 32
 #include "cmAudDsp.h"
33
-
33
+#include "cmDspPgmJsonToDot.h"
34 34
 
35 35
 cmAdH_t cmAdNullHandle = cmSTATIC_NULL_HANDLE;
36 36
 
@@ -1005,6 +1005,11 @@ cmAdRC_t _cmAudDspPrintPgm( cmAd_t* p, unsigned asSubSysIdx, const cmChar_t* fn
1005 1005
     {
1006 1006
       if( cmDspSysPrintPgm(p->dsSsArray[i].dsH,fn) != kOkDspRC )
1007 1007
         rc = cmErrMsg(&p->err,kDspSysFailAdRC,"The program print failed.");
1008
+      else
1009
+      {
1010
+        if( cmDspPgmJsonToDot(&p->ctx,fn,fn) != kOkDspRC )
1011
+          rc = cmErrMsg(&p->err,kDspSysFailAdRC,"The program print conversion to DOT failed.");
1012
+      }
1008 1013
       
1009 1014
       break;
1010 1015
     }

+ 3
- 2
cmAudDsp.h Voir le fichier

@@ -5,8 +5,7 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  // This API supports a serialized interface to an internal instance of 
9
-  // cmAudioSys and cmDspSys.  
8
+  //( { file_desc: "Supports a serialized interface to an internal instance of  cmAudioSys and cmDspSys." kw:[rt]}
10 9
 
11 10
   enum
12 11
   {
@@ -50,6 +49,8 @@ extern "C" {
50 49
   // client program to the aud_dsp system.
51 50
   cmAdRC_t cmAudDspReceiveClientMsg( cmAdH_t h, unsigned msgBytecnt, const void* msg );
52 51
   
52
+  //)
53
+  
53 54
 
54 55
 #ifdef __cplusplus
55 56
   }

+ 19
- 4
cmAudDspIF.h Voir le fichier

@@ -5,10 +5,24 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc: "Virtual interface to the audio DSP system." kw:[rt]}
9
+  //
10
+  // This class provides a two-way interface to the audio DSP system.
11
+  // It is designed to work independenty of the physical
12
+  // method of communication.  For example, when used by
13
+  // cmAudDspLocal, it  supports in memory transfer of messages
14
+  // between the application and the audio-DSP engine.
15
+  // Another implementation however could use it to support
16
+  // a networked communication scheme to a remote audio-DSP
17
+  // system.  Note that in either case, however, this class
18
+  // resides with, and is linked to, the application, and not
19
+  // the engine.  
20
+  
8 21
   // This API has two basic responsibilities:
9 22
   //
10 23
   // 1) Provides a function based interface to the audio DSP system for the
11
-  // client application.
24
+  // client application.  This is more convenient, and safer, than the lower level
25
+  // message based interface provided by cmAudDsp.h.
12 26
   //    The client calls these API functions to send commands to the audio DSP
13 27
   //    system. Internally the cmAdIfxxx functions converts the commands to 
14 28
   //    raw message packets and passes them to a transmission service
@@ -29,9 +43,9 @@ extern "C" {
29 43
   //    client provided cmAdIfDispatch_t function (ssInitFunc,statusFunc or uiFunc).
30 44
   //    Note that this entire chain of calls occurs in the client thread
31 45
   //    and in the context of the cmAdIfDispatchMsgToHost() procedure.
32
-                         
33
-  
46
+  //)
34 47
 
48
+  //(
35 49
   enum
36 50
   {
37 51
     kOkAiRC = cmOkRC,
@@ -163,7 +177,8 @@ extern "C" {
163 177
                               
164 178
    */
165 179
 
166
-
180
+  //)
181
+  
167 182
 #ifdef __cplusplus
168 183
 }
169 184
 #endif

+ 15
- 0
cmAudDspLocal.h Voir le fichier

@@ -5,6 +5,20 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc: "Implementation of the audio DSP interface for local, in-memory, communication." kw:[rt]}
9
+  //
10
+  //  This class instantiates an audio-DSP engine (cmAudDsp),
11
+  //  an interface for communicating with it (cmAudDspIF),
12
+  //  and message delivery functions for copying messages
13
+  //  in both directions between cmAuDsp and cmAudDspIF.
14
+  //
15
+  //  Note that the underlying inteface which allows an application to
16
+  //  control, and receive message from, cmAudDsp is provided by
17
+  //  cmAudDspIF - which this class provides a handle to.
18
+  //)  
19
+
20
+  //(
21
+  
8 22
   enum
9 23
   {
10 24
     kOkAdlRC = cmOkRC,
@@ -32,6 +46,7 @@ extern "C" {
32 46
 
33 47
   cmAiH_t   cmAudDspLocalIF_Handle( cmAdlH_t h );
34 48
   
49
+  //)
35 50
 
36 51
 #ifdef __cplusplus
37 52
 }

+ 4
- 0
cmAudLabelFile.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Read and write Audacity label files." kw:[audio file] }
9
+  
8 10
 enum
9 11
 {
10 12
   kOkAlfRC = cmOkRC,
@@ -43,6 +45,8 @@ enum
43 45
   
44 46
   void cmAudLabelFileTest( cmCtx_t* ctx );
45 47
 
48
+  //)
49
+  
46 50
 #ifdef __cplusplus
47 51
 }
48 52
 #endif

+ 4
- 1
cmAudioAggDev.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc: "Audio device driver for cmAudioPort which aggregates multiple hardware devices to appear as a single devices." kw:[rt] }
9
+  
8 10
   enum
9 11
   {
10 12
     kOkAgRC = cmOkRC,
@@ -95,7 +97,8 @@ extern "C" {
95 97
 
96 98
   int cmApAggTest(  bool runFl, cmCtx_t* ctx, int argc, const char* argv[] );
97 99
 
98
-
100
+  //)
101
+  
99 102
 #ifdef __cplusplus
100 103
 }
101 104
 #endif

+ 3
- 1
cmAudioBuf.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( {file_desc: "Obsolete audio buffer class. This class is superceded by cmApBuf."}
9
+  
8 10
   enum
9 11
   {
10 12
     kOkBaRC = cmOkRC
@@ -53,7 +55,7 @@ extern "C" {
53 55
 
54 56
   cmBaRC_t cmAudioBufAdvance( unsigned devIdx, unsigned flags );
55 57
 
56
-
58
+  //)
57 59
 
58 60
 
59 61
 #ifdef __cplusplus

+ 108
- 126
cmAudioFile.h Voir le fichier

@@ -1,13 +1,9 @@
1
-/// \file cmAudioFile.h
2
-/// \brief Audio file reader/writer class.
3
-///
4
-/// This class supports reading uncompressed AIFF and WAV files and writing uncompressed AIFF files.
5
-///  The reading and writing routines are known to work with 8,16,24, and 32 bit integer sample formats.
6
-///
7
-/// Testing and example usage for this API can be found in cmProcTest.c cmAudioReadWriteTest().
8
-///
9
-/// Usage example:
10
-/// \snippet cmAudioFile.c cmAudioFileExample
1
+//( { file_desc: "Read and write AIFF and WAV audio files." kw:[file audio] }
2
+//
3
+// This class supports reading uncompressed AIFF and WAV files and writing uncompressed AIFF files.
4
+//  The reading and writing routines are known to work with 8,16,24, and 32 bit integer sample formats.
5
+//
6
+//)
11 7
 
12 8
 #ifndef cmAudioFile_h
13 9
 #define cmAudioFile_h
@@ -16,15 +12,17 @@
16 12
 extern "C" {
17 13
 #endif
18 14
 
15
+  //(
16
+  
19 17
 #ifndef cmAudioFile_MAX_FRAME_READ_CNT
20
-/// Maximum number of samples which will be read in one call to fread().
21
-/// This value is only significant in that an internal buffer is created on the stack
22
-/// whose size must be limited to prevent stack overflows.
18
+  // Maximum number of samples which will be read in one call to fread().
19
+  // This value is only significant in that an internal buffer is created on the stack
20
+  // whose size must be limited to prevent stack overflows.
23 21
 #define cmAudioFile_MAX_FRAME_READ_CNT (8192) 
24 22
 #endif
25 23
 
26 24
 
27
-  /// Audio file result codes.
25
+  // Audio file result codes.
28 26
   enum
29 27
   {
30 28
     kOkAfRC = 0,
@@ -41,18 +39,18 @@ extern "C" {
41 39
     kUnknownErrAfRC
42 40
   };
43 41
 
44
-  /// Informational flags used by audioFileInfo
42
+  // Informational flags used by audioFileInfo
45 43
   enum
46 44
   {
47
-    kAiffAfFl        = 0x01,    ///< this is an AIFF file 
48
-    kWavAfFl         = 0x02,    ///< this is a WAV file 
49
-    kSwapAfFl        = 0x04,    ///< file header bytes must be swapped
50
-    kAifcAfFl        = 0x08,    ///< this is an AIFC file
51
-    kSwapSamplesAfFl = 0x10     ///< file sample bytes must be swapped
45
+    kAiffAfFl        = 0x01,    // this is an AIFF file 
46
+    kWavAfFl         = 0x02,    // this is a WAV file 
47
+    kSwapAfFl        = 0x04,    // file header bytes must be swapped
48
+    kAifcAfFl        = 0x08,    // this is an AIFC file
49
+    kSwapSamplesAfFl = 0x10     // file sample bytes must be swapped
52 50
   };
53 51
 
54 52
 
55
-  /// Constants
53
+  // Constants
56 54
   enum
57 55
   {
58 56
     kAudioFileLabelCharCnt = 256,
@@ -64,7 +62,7 @@ extern "C" {
64 62
     kAfBextOriginTimeN = 8
65 63
   };
66 64
 
67
-  /// Aiff marker record
65
+  // Aiff marker record
68 66
   typedef struct
69 67
   {
70 68
     unsigned    id;
@@ -72,9 +70,9 @@ extern "C" {
72 70
     char        label[kAudioFileLabelCharCnt];
73 71
   } cmAudioFileMarker_t;
74 72
 
75
-  /// Broadcast WAV header record As used by ProTools audio files. See http://en.wikipedia.org/wiki/Broadcast_Wave_Format
76
-  /// When generated from Protools the timeRefLow/timeRefHigh values appear to actually refer
77
-  /// to the position on the Protools time-line rather than the wall clock time.
73
+  // Broadcast WAV header record As used by ProTools audio files. See http://en.wikipedia.org/wiki/Broadcast_Wave_Format
74
+  // When generated from Protools the timeRefLow/timeRefHigh values appear to actually refer
75
+  // to the position on the Protools time-line rather than the wall clock time.
78 76
   typedef struct
79 77
   {
80 78
     char     desc[      kAfBextDescN       + 1 ];
@@ -86,102 +84,103 @@ extern "C" {
86 84
     unsigned timeRefHigh;  // sample count since midnight high word
87 85
   } cmAudioFileBext_t;
88 86
 
89
-  /// Audio file information record used by audioFileNew and audioFileOpen
87
+  // Audio file information record used by audioFileNew and audioFileOpen
90 88
   typedef struct 
91 89
   {
92
-    unsigned             bits;        ///< bits per sample
93
-    unsigned             chCnt;       ///< count of audio file channels
94
-    double               srate;       ///< audio file sample rate in samples per second
95
-    unsigned             frameCnt;    ///< total number of sample frames in the audio file
96
-    unsigned             flags;       ///< informational flags 
97
-    unsigned             markerCnt;   ///< count of markers in markerArray
98
-    cmAudioFileMarker_t* markerArray; ///< array of markers 
99
-    cmAudioFileBext_t    bextRecd;    ///< only used with Broadcast WAV files
90
+    unsigned             bits;        // bits per sample
91
+    unsigned             chCnt;       // count of audio file channels
92
+    double               srate;       // audio file sample rate in samples per second
93
+    unsigned             frameCnt;    // total number of sample frames in the audio file
94
+    unsigned             flags;       // informational flags 
95
+    unsigned             markerCnt;   // count of markers in markerArray
96
+    cmAudioFileMarker_t* markerArray; // array of markers 
97
+    cmAudioFileBext_t    bextRecd;    // only used with Broadcast WAV files
100 98
   } cmAudioFileInfo_t;
101 99
 
102 100
 
103 101
   
104
-  typedef cmHandle_t cmAudioFileH_t;    ///< opaque audio file handle   
105
-  extern cmAudioFileH_t cmNullAudioFileH;  ///< NULL audio file handle
106
-
107
-  /// Create an audio file handle and optionally use the handle to open an audio file.
108
-  ///
109
-  /// \param  fn         The audio file name to open or NULL to create the audio file handle without opening the file.
110
-  /// \param  infoPtr    A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
111
-  /// \param  rcPtr      A pointer to a result code to be set in the event of a runtime error or NULL to ignore.
112
-  /// \param  rpt        A pointer to a cmRpt_t object which error messages from this class will be directed to.
113
-  /// \retval cmAudioFileH_t A new audio file handle.
114
-  ///
102
+  typedef cmHandle_t cmAudioFileH_t;    // opaque audio file handle   
103
+  extern cmAudioFileH_t cmNullAudioFileH;  // NULL audio file handle
104
+
105
+  // Create an audio file handle and optionally use the handle to open an audio file.
106
+  //
107
+  //   fn         The audio file name to open or NULL to create the audio file handle without opening the file.
108
+  //   infoPtr    A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
109
+  //   rcPtr      A pointer to a result code to be set in the event of a runtime error or NULL to ignore.
110
+  //   rpt        A pointer to a cmRpt_t object which error messages from this class will be directed to.
111
+  //  Returns  cmAudioFileH_t A new audio file handle.
112
+  //
115 113
   cmAudioFileH_t cmAudioFileNewOpen( const cmChar_t* fn, cmAudioFileInfo_t* infoPtr, cmRC_t* rcPtr, cmRpt_t* rpt ); 
116 114
 
117
-  /// Open an audio file for writing
115
+  // Open an audio file for writing
118 116
   cmAudioFileH_t cmAudioFileNewCreate( const cmChar_t* fn, double srate, unsigned bits, unsigned chCnt, cmRC_t* rcPtr, cmRpt_t* rpt );
119 117
 
120 118
 
121
-  /// Open an audio file for reading using a handle returned from an earlier call to audioFileNewXXX().
122
-  ///
123
-  /// \param  h          A file handle returned from and earlier call to cmAudioFileNewOpen() or cmAudioFileNewCreate().
124
-  /// \param  fn         The audio file name to open or NULL to create the audio file handle without opening the file.
125
-  /// \param  infoPtr    A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
126
-  /// \retval Returns an cmRC_t value indicating the success (kOkAfRC) or failure of the call.
127
-  ///
128
-  /// If the audio file handle 'h' refers to an open file then it is automatically closed prior to being
129
-  /// reopened with the new file.
119
+  // Open an audio file for reading using a handle returned from an earlier call to audioFileNewXXX().
120
+  //
121
+  //   h          A file handle returned from and earlier call to cmAudioFileNewOpen() or cmAudioFileNewCreate().
122
+  //   fn         The audio file name to open or NULL to create the audio file handle without opening the file.
123
+  //   infoPtr    A pointer to an audioFileInfo record to be filled when the file is open or NULL to ignore.
124
+  // Returns an cmRC_t value indicating the success (kOkAfRC) or failure of the call.
125
+  //
126
+  // If the audio file handle 'h' refers to an open file then it is automatically closed prior to being
127
+  // reopened with the new file.
130 128
   cmRC_t     cmAudioFileOpen(       cmAudioFileH_t h, const cmChar_t* fn, cmAudioFileInfo_t* infoPtr );
131 129
 
132
-  /// Open an audio file for writing.  The type of the audio file, AIF or WAV
133
-  /// is determined by the file name extension.
130
+  // Open an audio file for writing.  The type of the audio file, AIF or WAV
131
+  // is determined by the file name extension.
134 132
   cmRC_t     cmAudioFileCreate(     
135
-    cmAudioFileH_t h,    ///< Handle returned from an earlier call to cmAudioFileNewCreate() or cmAudioFileNewOpen().
136
-    const cmChar_t* fn,  ///< File name of the new file.
137
-    double srate,        ///< Sample rate of the new file.
138
-    unsigned bits,       ///< Sample word width for the new file in bits (must be 8,16,24 or 32).
139
-    unsigned chCnt       ///< Audio channel count for the new file.
133
+    cmAudioFileH_t h,    // Handle returned from an earlier call to cmAudioFileNewCreate() or cmAudioFileNewOpen().
134
+    const cmChar_t* fn,  // File name of the new file.
135
+    double srate,        // Sample rate of the new file.
136
+    unsigned bits,       // Sample word width for the new file in bits (must be 8,16,24 or 32).
137
+    unsigned chCnt       // Audio channel count for the new file.
140 138
                                     );
141 139
 
142
-  /// Close a the file associated with handle 'h' but do not release the handle.
143
-  /// If the file was opened for writing (cmAudioFileCreate()) then this function will
144
-  /// write the file header prior to closing the file.
140
+  // Close a the file associated with handle 'h' but do not release the handle.
141
+  // If the file was opened for writing (cmAudioFileCreate()) then this function will
142
+  // write the file header prior to closing the file.
145 143
   cmRC_t     cmAudioFileClose(      cmAudioFileH_t* h );
146 144
 
147
-  /// Close the file associated with handle 'h' (via an internal call to 
148
-  /// cmAudioFileClose()) and release the handle and any resources
149
-  /// associated with it.  This is the complement to cmAudioFileOpen/Create().
145
+  // Close the file associated with handle 'h' (via an internal call to 
146
+  // cmAudioFileClose()) and release the handle and any resources
147
+  // associated with it.  This is the complement to cmAudioFileOpen/Create().
150 148
   cmRC_t     cmAudioFileDelete(     cmAudioFileH_t* h );
151 149
 
152
-  /// Return true if the handle is not closed or deleted.
150
+  // Return true if the handle is not closed or deleted.
153 151
   bool       cmAudioFileIsValid(    cmAudioFileH_t h );
154 152
 
155
-  /// Return true if the handle is open.
153
+  // Return true if the handle is open.
156 154
   bool       cmAudioFileIsOpen(     cmAudioFileH_t h );
157 155
 
158
-  /// Return true if the current file position is at the end of the file.
156
+  // Return true if the current file position is at the end of the file.
159 157
   bool       cmAudioFileIsEOF(      cmAudioFileH_t h );
160 158
 
161
-  /// Return the current file position as a frame index.
159
+  // Return the current file position as a frame index.
162 160
   unsigned   cmAudioFileTell(       cmAudioFileH_t h );
163 161
 
164
-  /// Set the current file position as an offset from the first frame.
162
+  // Set the current file position as an offset from the first frame.
165 163
   cmRC_t     cmAudioFileSeek(       cmAudioFileH_t h, unsigned frmIdx );
166 164
 
167
-  /// \name Sample Reading Functions.
168
-  ///@{
169
-  /// Fill a user suppled buffer with up to frmCnt samples.
170
-  /// If less than frmCnt samples are available at the specified audio file location then the unused
171
-  /// buffer space is set to zero. Check *actualFrmCntPtr for the count of samples actually available
172
-  /// in the return buffer.  Functions which do not include a begFrmIdx argument begin reading from
173
-  /// the current file location (see cmAudioFileSeek()). The buf argument is always a pointer to an
174
-  /// array of pointers of length chCnt.  Each channel buffer specified in buf[] must contain at least
175
-  /// frmCnt samples.
176
-  ///
177
-  /// \param h               An audio file handle returned from an earlier call to audioFileNew()
178
-  /// \param fn              The name of the audio file to read.
179
-  /// \param begFrmIdx       The frame index of the first sample to read. Functions that do not use this parameter begin reading at the current file location (See cmAudioFileTell()).
180
-  /// \param frmCnt          The number of samples allocated in buf.
181
-  /// \param chIdx           The index of the first channel to read.
182
-  /// \param chCnt           The count of channels to read.
183
-  /// \param buf             An array containing chCnt pointers to arrays of frmCnt samples.
184
-  /// \param actualFrmCntPtr The number of frames actually written to the return buffer (ignored if NULL)
165
+  // Sample Reading Functions.
166
+  //
167
+  // Fill a user suppled buffer with up to frmCnt samples.
168
+  // If less than frmCnt samples are available at the specified audio file location then the unused
169
+  // buffer space is set to zero. Check *actualFrmCntPtr for the count of samples actually available
170
+  // in the return buffer.  Functions which do not include a begFrmIdx argument begin reading from
171
+  // the current file location (see cmAudioFileSeek()). The buf argument is always a pointer to an
172
+  // array of pointers of length chCnt.  Each channel buffer specified in buf[] must contain at least
173
+  // frmCnt samples.
174
+  //
175
+  // 
176
+  //  h               An audio file handle returned from an earlier call to audioFileNew()
177
+  //  fn              The name of the audio file to read.
178
+  //  begFrmIdx       The frame index of the first sample to read. Functions that do not use this parameter begin reading at the current file location (See cmAudioFileTell()).
179
+  //  frmCnt          The number of samples allocated in buf.
180
+  //  chIdx           The index of the first channel to read.
181
+  //  chCnt           The count of channels to read.
182
+  //  buf             An array containing chCnt pointers to arrays of frmCnt samples.
183
+  //  actualFrmCntPtr The number of frames actually written to the return buffer (ignored if NULL)
185 184
 
186 185
   cmRC_t     cmAudioFileReadInt(    cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int**    buf, unsigned* actualFrmCntPtr );
187 186
   cmRC_t     cmAudioFileReadFloat(  cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float**  buf, unsigned* actualFrmCntPtr );
@@ -191,10 +190,7 @@ extern "C" {
191 190
   cmRC_t     cmAudioFileGetFloat(  const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float**  buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
192 191
   cmRC_t     cmAudioFileGetDouble( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
193 192
 
194
-  ///@}
195
-
196
-  /// \name Sum the returned samples into the output buffer.
197
-  ///@{
193
+  // Sum the returned samples into the output buffer.
198 194
   cmRC_t     cmAudioFileReadSumInt(    cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int**    buf, unsigned* actualFrmCntPtr );
199 195
   cmRC_t     cmAudioFileReadSumFloat(  cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float**  buf, unsigned* actualFrmCntPtr );
200 196
   cmRC_t     cmAudioFileReadSumDouble( cmAudioFileH_t h, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr );
@@ -202,12 +198,8 @@ extern "C" {
202 198
   cmRC_t     cmAudioFileGetSumInt(    const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, int**    buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
203 199
   cmRC_t     cmAudioFileGetSumFloat(  const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, float**  buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
204 200
   cmRC_t     cmAudioFileGetSumDouble( const char* fn, unsigned begFrmIdx, unsigned frmCnt, unsigned chIdx, unsigned chCnt, double** buf, unsigned* actualFrmCntPtr, cmAudioFileInfo_t* afInfoPtr, cmRpt_t* rpt );
205
-  ///@}
206
-
207
-  ///@}
208 201
 
209
-  /// \name Sample Writing Functions
210
-  ///@{
202
+  // Sample Writing Functions
211 203
   cmRC_t    cmAudioFileWriteInt(    cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, int**    bufPtrPtr );
212 204
   cmRC_t    cmAudioFileWriteFloat(  cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, float**  bufPtrPtr );
213 205
   cmRC_t    cmAudioFileWriteDouble( cmAudioFileH_t h, unsigned frmCnt, unsigned chCnt, double** bufPtrPtr );
@@ -215,14 +207,11 @@ extern "C" {
215 207
   cmRC_t    cmAudioFileWriteFileInt(    const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, int**    bufPtrPtr, cmRpt_t* rpt );
216 208
   cmRC_t    cmAudioFileWriteFileFloat(  const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, float**  bufPtrPtr, cmRpt_t* rpt );
217 209
   cmRC_t    cmAudioFileWriteFileDouble( const char* fn, double srate, unsigned bit, unsigned frmCnt, unsigned chCnt, double** bufPtrPtr, cmRpt_t* rpt );
218
-  ///@}
219 210
 
220 211
 
221 212
 
222
-  /// \name cmSample_t and cmReal_t Alias Macros
223
-  ///@{
224
-  /// Alias the cmSample_t and cmReal_t sample reading and writing functions to the appropriate
225
-  /// type based on #CM_FLOAT_SMP and #CM_FLOAT_REAL.
213
+  // Alias the cmSample_t and cmReal_t sample reading and writing functions to the appropriate
214
+  // type based on #CM_FLOAT_SMP and #CM_FLOAT_REAL.
226 215
 
227 216
 #if CM_FLOAT_SMP == 1
228 217
 
@@ -263,51 +252,44 @@ extern "C" {
263 252
 #define cmAudioFileWriteFileReal cmAudioFileWriteFileDouble
264 253
 
265 254
 #endif
266
-  ///@}
267 255
 
268 256
 
269
-  /// \name Minimum, Maximum, Mean
270
-  ///@{
271
-  /// Scan an entire audio file and return the minimum, maximum and mean sample value.
272
-  /// On error *minPtr, *maxPtr, and *meanPtr are set to -acSample_MAX, cmSample_MAX, and 0 respectively
257
+  // Scan an entire audio file and return the minimum, maximum and mean sample value.
258
+  // On error *minPtr, *maxPtr, and *meanPtr are set to -acSample_MAX, cmSample_MAX, and 0 respectively
273 259
   cmRC_t     cmAudioFileMinMaxMean( cmAudioFileH_t h, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr );
274 260
   cmRC_t     cmAudioFileMinMaxMeanFn( const cmChar_t* fn, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr, cmRpt_t* rpt );
275
-  ///@}
276 261
 
277
-  /// Return the file name associated with a audio file handle.
262
+  // Return the file name associated with a audio file handle.
278 263
   const cmChar_t* cmAudioFileName( cmAudioFileH_t h );
279 264
 
280
-  /// Given an error code return the associated message.
265
+  // Given an error code return the associated message.
281 266
   const char* cmAudioFileErrorMsg( unsigned rc );
282 267
 
283
-  /// \name Get information about an audio file
284
-  ///@{
285
-
286
-  /// Return the cmAudioFileInfo_t record associated with a file.
268
+  // Return the cmAudioFileInfo_t record associated with a file.
287 269
   cmRC_t     cmAudioFileGetInfo(   const cmChar_t* fn, cmAudioFileInfo_t* infoPtr, cmRpt_t* rpt );
288 270
   
289
-  /// Print the cmAudioFileInfo_t to a file.
271
+  // Print the cmAudioFileInfo_t to a file.
290 272
   void       cmAudioFilePrintInfo( const cmAudioFileInfo_t* infoPtr, cmRpt_t* );
291 273
 
292
-  /// Print the file header information and frmCnt sample values beginning at frame index frmIdx.
274
+  // Print the file header information and frmCnt sample values beginning at frame index frmIdx.
293 275
   cmRC_t     cmAudioFileReport(   cmAudioFileH_t h,  cmRpt_t* rpt, unsigned frmIdx, unsigned frmCnt );
294 276
 
295
-    /// Print the file header information and  frmCnt sample values beginning at frame index frmIdx.
277
+  // Print the file header information and  frmCnt sample values beginning at frame index frmIdx.
296 278
   cmRC_t     cmAudioFileReportFn( const cmChar_t* fn, unsigned frmIdx, unsigned frmCnt, cmRpt_t* rpt );
297
-  ///@}
298 279
 
299
-  /// Change the sample rate value in the header.  Note that this function does not resample the audio
300
-  /// signal it simply changes the value of the sample rate in the header.
280
+  // Change the sample rate value in the header.  Note that this function does not resample the audio
281
+  // signal it simply changes the value of the sample rate in the header.
301 282
   cmRC_t     cmAudioFileSetSrate( const cmChar_t* audioFn, unsigned srate );
302 283
 
303 284
   // Generate a sine tone and write it to a file.
304 285
   cmRC_t     cmAudioFileSine( cmCtx_t* ctx, const cmChar_t* fn, double srate, unsigned bits, double hz, double gain, double secs );
305 286
 
306 287
 
307
-  /// Testing and example routine for functions in cmAudioFile.h.
308
-  /// Also see cmProcTest.c cmAudioFileReadWriteTest()
288
+  // Testing and example routine for functions in cmAudioFile.h.
289
+  // Also see cmProcTest.c cmAudioFileReadWriteTest()
309 290
   void       cmAudioFileTest( cmCtx_t* ctx, int argc, const char* argv[] );
310
-
291
+  
292
+  //)
311 293
   
312 294
 #ifdef __cplusplus
313 295
 }

+ 11
- 0
cmAudioFileDev.h Voir le fichier

@@ -1,6 +1,11 @@
1 1
 #ifndef cmAudioFileDev_h
2 2
 #define cmAudioFileDev_h
3 3
 
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+//( { file_desc:"Implements cmAudioFileDev for reading and writing audio files under control of cmAudioPort.", kw:[audio file rt]}
4 9
 enum
5 10
 {
6 11
   kOkAfdRC = cmOkRC,
@@ -72,4 +77,10 @@ void      cmAudioFileDevReport( cmAfdH_t h, cmRpt_t* rpt );
72 77
 
73 78
 void      cmAudioFileDevTest( cmRpt_t* rpt );
74 79
 
80
+//)
81
+
82
+#ifdef __cplusplus
83
+}
84
+#endif
85
+
75 86
 #endif

+ 4
- 1
cmAudioFileMgr.h Voir le fichier

@@ -4,6 +4,9 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
+
8
+  //( { file_desc:"Manages a collection of audio files and maintains downsampled copies of their signals." kw:[audio file] }
9
+  
7 10
   enum
8 11
   {
9 12
     kOkAfmRC = cmOkRC,
@@ -56,7 +59,7 @@ extern "C" {
56 59
   bool         cmAfmIsValid( cmAfmH_t h );
57 60
   cmAfmFileH_t cmAfmIdToHandle( cmAfmH_t h, unsigned fileId );
58 61
 
59
-    
62
+  //)  
60 63
 
61 64
 
62 65
 #ifdef __cplusplus

+ 4
- 1
cmAudioNrtDev.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Audio device driver which generates the callbacks to run cmAudioPort in a non-real time mode." kw:[audio rt]}
9
+  
8 10
   cmApRC_t cmApNrtAllocate( cmRpt_t* rpt );
9 11
 
10 12
   cmApRC_t cmApNrtFree();
@@ -57,7 +59,8 @@ extern "C" {
57 59
   /// Return true if the device is currently started.
58 60
   bool          cmApNrtDeviceIsStarted( unsigned devIdx );
59 61
 
60
-
62
+  //)
63
+  
61 64
 #ifdef __cplusplus
62 65
 }
63 66
 #endif

+ 85
- 85
cmAudioPort.h Voir le fichier

@@ -1,27 +1,24 @@
1
-/// \file cmAudioPort.h
2
-/// \brief Cross platform audio I/O interface.
3
-///
4
-/// This interface provides data declarations for platform dependent 
5
-/// audio I/O functions. The implementation for the functions are
6
-/// in platform specific modules. See cmAudioPortOsx.c and cmAudioPortAlsa.c.
7
-///
8
-/// ALSA Notes:  
9
-/// Assign capture device to line or mic input:
10
-/// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Mic
11
-/// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Line
12
-///
13
-/// -c 0                            select the first card
14
-/// -iface=MIXER                    the cset is targetting the MIXER component
15
-/// -name='Input Source',index=0    the control to set is the first 'Input Source'
16
-/// Note that the 'Capture' control sets the input gain.
17
-///
18
-/// See alsamixer for a GUI to accomplish the same thing.
19
-///
20
-///
21
-/// Usage example and testing code:
22
-/// See cmApPortTest() and cmAudioSysTest().
23
-/// \snippet cmAudioPort.c cmAudioPortExample
24
-///
1
+//( { file_desc: "Cross platform audio device interface." kw:[audio rt] }
2
+//
3
+// This interface provides data declarations for platform dependent 
4
+// audio I/O functions. The implementation for the functions are
5
+// in platform specific modules. See cmAudioPortOsx.c and cmAudioPortAlsa.c.
6
+//
7
+// ALSA Notes:  
8
+// Assign capture device to line or mic input:
9
+// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Mic
10
+// amixer -c 0 cset iface=MIXER,name='Input Source',index=0 Line
11
+//
12
+// -c 0                            select the first card
13
+// -iface=MIXER                    the cset is targetting the MIXER component
14
+// -name='Input Source',index=0    the control to set is the first 'Input Source'
15
+// Note that the 'Capture' control sets the input gain.
16
+//
17
+// See alsamixer for a GUI to accomplish the same thing.
18
+//
19
+//
20
+//)
21
+
25 22
 #ifndef cmAudioPort_h
26 23
 #define cmAudioPort_h
27 24
 
@@ -29,8 +26,10 @@
29 26
 extern "C" {
30 27
 #endif
31 28
 
32
-  typedef unsigned cmApRC_t;      ///< Audio port interface result code.
33
-  typedef float    cmApSample_t;  ///< Audio sample type.
29
+  //(
30
+  
31
+  typedef unsigned cmApRC_t;      // Audio port interface result code.
32
+  typedef float    cmApSample_t;  // Audio sample type.
34 33
 
35 34
   enum 
36 35
   { 
@@ -45,81 +44,81 @@ extern "C" {
45 44
   // cmApAudioPacket_t flags
46 45
   enum
47 46
   {
48
-    kInterleavedApFl = 0x01,  ///< The audio samples are interleaved.
49
-    kFloatApFl       = 0x02   ///< The audio samples are single precision floating point values.
47
+    kInterleavedApFl = 0x01,  // The audio samples are interleaved.
48
+    kFloatApFl       = 0x02   // The audio samples are single precision floating point values.
50 49
   };
51 50
 
52
-  /// Audio packet record used by the cmApAudioPacket_t callback.
53
-  /// Audio ports send and receive audio using this data structure. 
51
+  // Audio packet record used by the cmApAudioPacket_t callback.
52
+  // Audio ports send and receive audio using this data structure. 
54 53
   typedef struct
55 54
   {
56
-    unsigned devIdx;         ///< device associated with packet
57
-    unsigned begChIdx;       ///< first device channel 
58
-    unsigned chCnt;          ///< count of channels
59
-    unsigned audioFramesCnt; ///< samples per channel (see note below)
60
-    unsigned bitsPerSample;  ///< bits per sample word
61
-    unsigned flags;          ///< kInterleavedApFl | kFloatApFl
62
-    void*    audioBytesPtr;  ///< pointer to sample data
63
-    void*    userCbPtr;      ///< user defined value passed in cmApDeviceSetup()
64
-    cmTimeSpec_t timeStamp;  ///< Packet time stamp.
55
+    unsigned devIdx;         // device associated with packet
56
+    unsigned begChIdx;       // first device channel 
57
+    unsigned chCnt;          // count of channels
58
+    unsigned audioFramesCnt; // samples per channel (see note below)
59
+    unsigned bitsPerSample;  // bits per sample word
60
+    unsigned flags;          // kInterleavedApFl | kFloatApFl
61
+    void*    audioBytesPtr;  // pointer to sample data
62
+    void*    userCbPtr;      // user defined value passed in cmApDeviceSetup()
63
+    cmTimeSpec_t timeStamp;  // Packet time stamp.
65 64
   }  cmApAudioPacket_t; 
66 65
 
67 66
 
68
-  /// Audio port callback signature. 
69
-  /// inPktArray[inPktCnt] are full packets of audio coming from the ADC to the application.
70
-  /// outPktArray[outPktCnt] are empty packets of audio which will be filled by the application 
71
-  /// and then sent to the DAC.
72
-  ///
73
-  /// The value of audioFrameCnt  gives the number of samples per channel which are available
74
-  /// in the packet data buffer 'audioBytesPtr'.  The callback function may decrease this number in
75
-  /// output packets if the number of samples available is less than the size of the buffer.
76
-  /// It is the responsibility of the calling audio port to notice this change and pass the new,
77
-  /// decreased number of samples to the hardware.
78
-  ///
79
-  /// In general it should be assmed that this call is made from a system thread which is not 
80
-  /// the same as the application thread.
81
-  /// The usual thread safety precautions should therefore be taken if this function implementation
82
-  /// interacts with data structures also handled by the application. The audio buffer class (\see cmApBuf.h) 
83
-  /// is designed to provide a safe and efficient way to communicate between
84
-  /// the audio thread and the application.
67
+  // Audio port callback signature. 
68
+  // inPktArray[inPktCnt] are full packets of audio coming from the ADC to the application.
69
+  // outPktArray[outPktCnt] are empty packets of audio which will be filled by the application 
70
+  // and then sent to the DAC.
71
+  //
72
+  // The value of audioFrameCnt  gives the number of samples per channel which are available
73
+  // in the packet data buffer 'audioBytesPtr'.  The callback function may decrease this number in
74
+  // output packets if the number of samples available is less than the size of the buffer.
75
+  // It is the responsibility of the calling audio port to notice this change and pass the new,
76
+  // decreased number of samples to the hardware.
77
+  //
78
+  // In general it should be assmed that this call is made from a system thread which is not 
79
+  // the same as the application thread.
80
+  // The usual thread safety precautions should therefore be taken if this function implementation
81
+  // interacts with data structures also handled by the application. The audio buffer class (\see cmApBuf.h) 
82
+  // is designed to provide a safe and efficient way to communicate between
83
+  // the audio thread and the application.
85 84
   typedef void (*cmApCallbackPtr_t)( cmApAudioPacket_t* inPktArray, unsigned inPktCnt, cmApAudioPacket_t* outPktArray, unsigned outPktCnt );
86 85
 
87
-  /// Setup the audio port management object for this machine.
86
+  // Setup the audio port management object for this machine.
88 87
   cmApRC_t      cmApInitialize( cmRpt_t* rpt );
89 88
 
90
-  /// Stop all audio devices and release any resources held 
91
-  /// by the audio port management object.
89
+  // Stop all audio devices and release any resources held 
90
+  // by the audio port management object.
92 91
   cmApRC_t      cmApFinalize();
93 92
 
94
-  /// Return the count of audio devices attached to this machine.
93
+  // Return the count of audio devices attached to this machine.
95 94
   unsigned      cmApDeviceCount();
96 95
 
97
-  /// Get a textual description of the device at index 'devIdx'.
96
+  // Get a textual description of the device at index 'devIdx'.
98 97
   const char*   cmApDeviceLabel(          unsigned devIdx );
99 98
 
100
-  /// Given an audio device label return the associated device index.
99
+  // Given an audio device label return the associated device index.
101 100
   unsigned      cmApDeviceLabelToIndex( const cmChar_t* label );
102 101
 
103
-  /// Get the count of audio input or output channesl on device at index 'devIdx'.
102
+  // Get the count of audio input or output channesl on device at index 'devIdx'.
104 103
   unsigned      cmApDeviceChannelCount(   unsigned devIdx, bool inputFl );
105 104
 
106
-  /// Get the current sample rate of a device.  Note that if the device has both
107
-  /// input and output capability then the sample rate is the same for both.
105
+  // Get the current sample rate of a device.  Note that if the device has both
106
+  // input and output capability then the sample rate is the same for both.
108 107
   double        cmApDeviceSampleRate(     unsigned devIdx );
109 108
 
110
-  /// Get the count of samples per callback for the input or output for this device.
109
+  // Get the count of samples per callback for the input or output for this device.
111 110
   unsigned      cmApDeviceFramesPerCycle( unsigned devIdx, bool inputFl );
112 111
 
113
-  /// Configure a device.  
114
-  /// All devices must be setup before they are started.
115
-  /// framesPerCycle is the requested number of samples per audio callback. The
116
-  /// actual number of samples made from a callback may be smaller. See the note
117
-  /// regarding this in cmApAudioPacket_t.
118
-  /// If the device cannot support the requested configuration then the function
119
-  /// will return an error code.
120
-  /// If the device is started when this function is called then it will be 
121
-  /// automatically stopped and then restarted following the reconfiguration.
122
-  /// If the reconfiguration fails then the device may not be restared.
112
+  // Configure a device.  
113
+  // All devices must be setup before they are started.
114
+  // framesPerCycle is the requested number of samples per audio callback. The
115
+  // actual number of samples made from a callback may be smaller. See the note
116
+  // regarding this in cmApAudioPacket_t.
117
+  // If the device cannot support the requested configuration then the function
118
+  // will return an error code.
119
+  // If the device is started when this function is called then it will be 
120
+  // automatically stopped and then restarted following the reconfiguration.
121
+  // If the reconfiguration fails then the device may not be restared.
123 122
   cmApRC_t      cmApDeviceSetup(          
124 123
     unsigned          devIdx, 
125 124
     double            srate, 
@@ -127,25 +126,26 @@ extern "C" {
127 126
     cmApCallbackPtr_t callbackPtr,
128 127
     void*             userCbPtr );
129 128
 
130
-  /// Start a device. Note that the callback may be made prior to this function returning.
129
+  // Start a device. Note that the callback may be made prior to this function returning.
131 130
   cmApRC_t      cmApDeviceStart( unsigned devIdx );
132 131
 
133
-  /// Stop a device.
132
+  // Stop a device.
134 133
   cmApRC_t      cmApDeviceStop(  unsigned devIdx );
135 134
 
136
-  /// Return true if the device is currently started.
135
+  // Return true if the device is currently started.
137 136
   bool          cmApDeviceIsStarted( unsigned devIdx );
138 137
 
139
-  /// Print a report of all the current audio device configurations.
138
+  // Print a report of all the current audio device configurations.
140 139
   void          cmApReport( cmRpt_t* rpt );
141 140
 
142
-  /// Test the audio port by synthesizing a sine signal or passing audio through
143
-  /// from the input to the output.  This is also a good example of how to 
144
-  /// use all of the functions in the interface.
145
-  /// Set runFl to false to print a report without starting any audio devices.
146
-  /// See cmAudiotPortTest.c for usage example for this function.
141
+  // Test the audio port by synthesizing a sine signal or passing audio through
142
+  // from the input to the output.  This is also a good example of how to 
143
+  // use all of the functions in the interface.
144
+  // Set runFl to false to print a report without starting any audio devices.
145
+  // See cmAudiotPortTest.c for usage example for this function.
147 146
   int           cmApPortTest(bool runFl, cmRpt_t* rpt, int argc, const char* argv[] );
148 147
 
148
+  //)
149 149
 #ifdef __cplusplus
150 150
 }
151 151
 #endif

+ 4
- 0
cmAudioPortFile.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"This is an audio device driver for cmAudioPort which supports reading and writing audio files as though they are real-time devices." kw[audio file rt] } 
9
+  
8 10
   cmApRC_t      cmApFileAllocate( cmRpt_t* rpt );
9 11
   cmApRC_t      cmApFileFree();
10 12
 
@@ -41,6 +43,8 @@ extern "C" {
41 43
   void          cmApFileReport( cmRpt_t* rpt );
42 44
   void          cmApFileTest( cmRpt_t* rpt );
43 45
 
46
+  //)
47
+  
44 48
 #ifdef __cplusplus
45 49
 }
46 50
 #endif

+ 6
- 7
cmAudioSys.h Voir le fichier

@@ -1,5 +1,4 @@
1
-// cmAudioSys.h
2
-// Implements a real-time audio processing engine.
1
+//( { file_desc: "This is the kernel of a real-time audio processing engine." kw:[audio rt] }
3 2
 //
4 3
 // The audio system is composed a collection of independent sub-systems.
5 4
 // Each sub-system maintains a thread which runs asynchrounsly
@@ -49,9 +48,7 @@
49 48
 // delivered to the DSP procedure at the end of the DSP execution
50 49
 // procedure.
51 50
 //
52
-// Usage example and testing code:
53
-// See  cmAudioSysTest().
54
-// \snippet cmAudioSys.c cmAudioSysTest
51
+//)
55 52
 
56 53
 #ifndef cmAudioSys_h
57 54
 #define cmAudioSys_h
@@ -59,7 +56,8 @@
59 56
 #ifdef __cplusplus
60 57
 extern "C" {
61 58
 #endif
62
-
59
+  
60
+  //(
63 61
   // Audio system result codes
64 62
   enum
65 63
   {
@@ -296,7 +294,8 @@ extern "C" {
296 294
   // Audio system test and example function.
297 295
   void      cmAudioSysTest( cmRpt_t* rpt, int argc, const char* argv[] );
298 296
 
299
-
297
+  //)
298
+  
300 299
 
301 300
 #ifdef __cplusplus
302 301
 }

+ 4
- 1
cmAudioSysMsg.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Constrants and data structures used to communicate messages to and from cmAudioSys" kw:[audio real_time]}
9
+  
8 10
   /// Reserved DSP message selector id's (second field of all host<->audio system messages)
9 11
   enum
10 12
   {
@@ -112,7 +114,8 @@ extern "C" {
112 114
     
113 115
   } cmAudioSysStatus_t;
114 116
 
115
-
117
+  //)
118
+  
116 119
 #ifdef __cplusplus
117 120
 }
118 121
 #endif

+ 11
- 0
cmComplexTypes.h Voir le fichier

@@ -1,9 +1,15 @@
1 1
 #ifndef cmComplexTypes_h
2 2
 #define cmComplexTypes_h
3 3
 
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
4 8
 #include <complex.h>
5 9
 #include <fftw3.h>
6 10
 
11
+//( { file_desc: "Constants and functions used for working with complex values." kw:[base math] }
12
+
7 13
 #if CM_FLOAT_SMP == 1
8 14
 
9 15
 #define cmCabsS  cabsf
@@ -95,5 +101,10 @@ void cmVOCR_Abs(     cmSample_t*   y, const cmComplexR_t* x, unsigned n );
95 101
 void cmVOCR_MultVS(  cmComplexR_t* y, cmReal_t v, unsigned n );
96 102
 void cmVOCR_DivVS(   cmComplexR_t* y, cmReal_t v, unsigned n );
97 103
 
104
+//)
105
+
106
+#ifdef __cplusplus
107
+}
108
+#endif
98 109
 
99 110
 #endif

+ 4
- 0
cmCsv.h Voir le fichier

@@ -6,6 +6,8 @@
6 6
 extern "C" {
7 7
 #endif
8 8
 
9
+  //( { file_desc:"Comma seperated value file reader and writer." kw[file] }
10
+  
9 11
   enum
10 12
   {
11 13
     kOkCsvRC = 0,
@@ -146,6 +148,8 @@ extern "C" {
146 148
 
147 149
   cmCsvRC_t  cmCsvPrint( cmCsvH_t h, unsigned rowCnt );
148 150
 
151
+  //)
152
+  
149 153
 #ifdef __cplusplus
150 154
 }
151 155
 #endif

+ 4
- 4
cmCtx.h Voir le fichier

@@ -1,5 +1,6 @@
1
-//{ 
2
-//(
1
+ 
2
+//( { file_desc:"Global application context record." kw[base] }
3
+//
3 4
 // cmCtx_t is used to hold application supplied cmRpt_t, cmErr_t and
4 5
 // other global values for easy distribution throughtout a cm based application.
5 6
 //
@@ -44,8 +45,7 @@ extern "C" {
44 45
     unsigned         mmFlags      //  Initialization flags used to configure \ref cmMallocDebug.h
45 46
                    );
46 47
   //)
47
-  //}
48
-
48
+ 
49 49
 #ifdef __cplusplus
50 50
 }
51 51
 #endif

+ 3
- 1
cmDList.h Voir le fichier

@@ -6,6 +6,8 @@
6 6
 extern "C" {
7 7
 #endif
8 8
 
9
+  //( { file_desc:"Dynamic generic array with user programmable indexing and sorting capablity." kw:[container] }
10
+  
9 11
   enum
10 12
   {
11 13
     kOkDlRC = cmOkRC,
@@ -86,7 +88,7 @@ extern "C" {
86 88
   // which this iterator is attached to.
87 89
   const void* cmDListIterFind(      cmDListIterH_t  iH, const void* key, unsigned keyN, unsigned* recdByteNRef);
88 90
 
89
-
91
+  //) 
90 92
 #ifdef __cplusplus
91 93
 }
92 94
 #endif

+ 4
- 0
cmDListTpl.h Voir le fichier

@@ -1,4 +1,6 @@
1 1
 
2
+//( { file_desc:"Template 'include' code for using cmDList as a template." kw:[container] }
3
+
2 4
 // The following two macros must be defined prior to including this code:
3 5
 // #define cmSFX(a) a##_MySuffix
4 6
 // #define cmTYPE   My_Type 
@@ -117,6 +119,8 @@ const cmTYPE* cmSFX(cmDListIterFind)(      cmDListIterH_t  iH, const cmTYPE* key
117 119
 
118 120
 #endif // cmGEN_CODE
119 121
 
122
+//)
120 123
 
121 124
 #undef cmSFX
122 125
 #undef cmTYPE
126
+

+ 3
- 1
cmData.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Generic, introspective, data structure." }
9
+  
8 10
   /*
9 11
     TODO:
10 12
     0) Figure out an error handling scheme that does not rely on
@@ -688,7 +690,7 @@ extern "C" {
688 690
   void     cmDataPrint( const cmData_t* p, cmRpt_t* rpt );
689 691
   
690 692
   void     cmDataTest( cmCtx_t* ctx );
691
-
693
+  //)
692 694
 
693 695
 #ifdef __cplusplus
694 696
 }

+ 5
- 1
cmDevCfg.h Voir le fichier

@@ -4,6 +4,9 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
+
8
+  //( { file_desc:"A class for managing persistent device configuration information." kw:[audio hardware] }
9
+  
7 10
   /*
8 11
     IMPLEMENTATION:
9 12
     1) A 'cfg' record is a device reference with a 'cfg label'.
@@ -210,7 +213,8 @@ extern "C" {
210 213
   // Set 'fn' to NULL to use filename from cmDevCfgAlloc()
211 214
   cmDcRC_t cmDevCfgWrite( cmDevCfgH_t h, const cmChar_t* fn );
212 215
   
213
-
216
+  //)
217
+  
214 218
 #ifdef __cplusplus
215 219
 }
216 220
 #endif

+ 2
- 3
cmErr.h Voir le fichier

@@ -1,5 +1,5 @@
1
-//{ 
2
-//(
1
+//( { file_desc:"Format error messages and track the last error generated." kw:[base]}
2
+//
3 3
 // This class is used to format error messages and track the last error generated.
4 4
 //
5 5
 // Most of the cmHandle_t based classes use cmErr_t to format error messages with a 
@@ -75,7 +75,6 @@ extern "C" {
75 75
   cmRC_t cmErrClearRC( cmErr_t* err );
76 76
    
77 77
   //)
78
-  //}
79 78
 
80 79
 #ifdef __cplusplus
81 80
 }

+ 3
- 0
cmExec.h Voir le fichier

@@ -6,6 +6,7 @@
6 6
 extern "C" {
7 7
 #endif
8 8
 
9
+  //( file_desc:"Run a child process via 'execvp()'" kw[system]
9 10
   enum
10 11
   {
11 12
     kOkExRC,
@@ -22,6 +23,8 @@ extern "C" {
22 23
   cmExRC_t cmExecV( cmErr_t* err, int* returnValRef, const cmChar_t* pgmFn, va_list vl );
23 24
   cmExRC_t cmExec(  cmErr_t* err, int* returnValRef, const cmChar_t* pgmFn, ... );  
24 25
 
26
+  //)
27
+  
25 28
 #ifdef __cplusplus
26 29
 }
27 30
 #endif

+ 1
- 1
cmFeatFile.c Voir le fichier

@@ -2106,7 +2106,7 @@ cmFtRC_t        cmFtReaderAdvance( cmFtFileH_t h, cmFtFrameDesc_t* fdp )
2106 2106
   {
2107 2107
     if( rc == kOkFtRC )
2108 2108
     {
2109
-      fdp->smpIdx = frameDescPtr->time.sampleIdx;
2109
+      fdp->smpIdx = frameDescPtr->tm.sampleIdx;
2110 2110
       fdp->frmIdx = cmFrameFileFrameLoadedIndex(fp->ffH);
2111 2111
     }
2112 2112
     else

+ 142
- 146
cmFeatFile.h Voir le fichier

@@ -1,7 +1,6 @@
1
-/// \file cmFeatFile.h
2
-/// \brief Audio file acoustic feature analyzer and accompanying file reader.
3
-///
4
-///
1
+//( { file_desc:" Audio file acoustic feature analyzer and accompanying file reader." kw:[audio analysis file]}
2
+//
3
+//
5 4
 
6 5
 #ifndef cmFeatFile_h
7 6
 #define cmFeatFile_h
@@ -12,7 +11,7 @@ extern "C" {
12 11
 
13 12
 
14 13
 
15
-  /// Result codes for all functions in cmFeatFile.h
14
+  // Result codes for all functions in cmFeatFile.h
16 15
   enum
17 16
   {
18 17
     kOkFtRC = cmOkRC,
@@ -36,241 +35,238 @@ extern "C" {
36 35
     kInvalidFrmIdxFtRC
37 36
   };
38 37
 
39
-  /// Feature Id's
38
+  // Feature Id's
40 39
   enum
41 40
   {
42
-    kInvalidFtId,     ///< 0  
43
-    kAmplFtId,        ///< 1 Fourier transform amplitude 
44
-    kDbAmplFtId,      ///< 2 Fourier transform decibel
45
-    kPowFtId,         ///< 3 Fourier transform power
46
-    kDbPowFtId,       ///< 4 Fourier transform power decibel
47
-    kPhaseFtId,       ///< 5 Fourier transform phase (not unwrapped)
48
-    kBfccFtId,        ///< 6 Bark Frequency Cepstral Coeffcients
49
-    kMfccFtId,        ///< 7 Mel Frequency Cepstral Coefficients
50
-    kCepsFtId,        ///< 8 Cepstral Coefficients
51
-    kConstQFtId,      ///< 9 Constant-Q transform
52
-    kLogConstQFtId,   ///< 10 Log Constant-Q transform
53
-    kRmsFtId,         ///< 11 Root means square of the audio signal
54
-    kDbRmsFtId,       ///< 12 RMS in decibels                         
55
-
56
-    kD1AmplFtId,      ///< 13 1st order difference over time of the Fourier transform amplitude              
57
-    kD1DbAmplFtId,    ///< 14 1st order difference over time of the Fourier transform decibel                
58
-    kD1PowFtId,       ///< 15 1st order difference over time of the Fourier transform power                  
59
-    kD1DbPowFtId,     ///< 16 1st order difference over time of the Fourier transform power decibel          
60
-    kD1PhaseFtId,     ///< 17 1st order difference over time of the Fourier transform phase (not unwrapped)  
61
-    kD1BfccFtId,      ///< 18 1st order difference over time of the Bark Frequency Cepstral Coeffcients      
62
-    kD1MfccFtId,      ///< 19 1st order difference over time of the Mel Frequency Cepstral Coefficients      
63
-    kD1CepsFtId,      ///< 20 1st order difference over time of the Cepstral Coefficients                    
64
-    kD1ConstQFtId,    ///< 21 1st order difference over time of the Constant-Q transform                     
65
-    kD1LogConstQFtId, ///< 22 1st order difference over time of the Log Constant-Q transform                
66
-    kD1RmsFtId,       ///< 23 1st order difference over time of the Root means square of the audio signal   
67
-    kD1DbRmsFtId,     ///< 24 1st order difference over time of the RMS in decibels                         
41
+    kInvalidFtId,     // 0  
42
+    kAmplFtId,        // 1 Fourier transform amplitude 
43
+    kDbAmplFtId,      // 2 Fourier transform decibel
44
+    kPowFtId,         // 3 Fourier transform power
45
+    kDbPowFtId,       // 4 Fourier transform power decibel
46
+    kPhaseFtId,       // 5 Fourier transform phase (not unwrapped)
47
+    kBfccFtId,        // 6 Bark Frequency Cepstral Coeffcients
48
+    kMfccFtId,        // 7 Mel Frequency Cepstral Coefficients
49
+    kCepsFtId,        // 8 Cepstral Coefficients
50
+    kConstQFtId,      // 9 Constant-Q transform
51
+    kLogConstQFtId,   // 10 Log Constant-Q transform
52
+    kRmsFtId,         // 11 Root means square of the audio signal
53
+    kDbRmsFtId,       // 12 RMS in decibels                         
54
+
55
+    kD1AmplFtId,      // 13 1st order difference over time of the Fourier transform amplitude              
56
+    kD1DbAmplFtId,    // 14 1st order difference over time of the Fourier transform decibel                
57
+    kD1PowFtId,       // 15 1st order difference over time of the Fourier transform power                  
58
+    kD1DbPowFtId,     // 16 1st order difference over time of the Fourier transform power decibel          
59
+    kD1PhaseFtId,     // 17 1st order difference over time of the Fourier transform phase (not unwrapped)  
60
+    kD1BfccFtId,      // 18 1st order difference over time of the Bark Frequency Cepstral Coeffcients      
61
+    kD1MfccFtId,      // 19 1st order difference over time of the Mel Frequency Cepstral Coefficients      
62
+    kD1CepsFtId,      // 20 1st order difference over time of the Cepstral Coefficients                    
63
+    kD1ConstQFtId,    // 21 1st order difference over time of the Constant-Q transform                     
64
+    kD1LogConstQFtId, // 22 1st order difference over time of the Log Constant-Q transform                
65
+    kD1RmsFtId,       // 23 1st order difference over time of the Root means square of the audio signal   
66
+    kD1DbRmsFtId,     // 24 1st order difference over time of the RMS in decibels                         
68 67
 
69 68
   };
70 69
 
71
-  /// User defined feature parameters
70
+  // User defined feature parameters
72 71
   typedef struct
73 72
   {
74
-    unsigned id;         ///< feature id
75
-    unsigned cnt;        ///< length of feature vector
76
-    bool     normFl;     ///< normalize this feature 
77
-    bool     enableFl;   ///< true if this feature is enabled
73
+    unsigned id;         // feature id
74
+    unsigned cnt;        // length of feature vector
75
+    bool     normFl;     // normalize this feature 
76
+    bool     enableFl;   // true if this feature is enabled
78 77
   } cmFtAttr_t;
79 78
 
80 79
 
81
-  /// Skip input audio range record
80
+  // Skip input audio range record
82 81
   typedef struct
83 82
   {
84
-    unsigned smpIdx;  ///< Index of first sample to skip
85
-    unsigned smpCnt;  ///< Count of successive samples to skip.
83
+    unsigned smpIdx;  // Index of first sample to skip
84
+    unsigned smpCnt;  // Count of successive samples to skip.
86 85
   } cmFtSkip_t;
87 86
 
88 87
 
89
-  /// Analysis parameters
88
+  // Analysis parameters
90 89
   typedef struct
91 90
   {
92
-    const char*        audioFn;               ///< Audio file name.
93
-    const char*        featFn;                ///< Feature file name.
94
-    unsigned           chIdx;                 ///< Audio file channel index
95
-    cmReal_t           wndMs;                 ///< Length of the analysis window in milliseconds.
96
-    unsigned           hopFact;               ///< Analysis window overlap factor 1 = 1:1 2=2:1 ...
97
-    bool               normAudioFl;           ///< Normalize the audio over the length of the audio file
98
-    cmMidiByte_t       constQMinPitch;        ///< Used to determine the base const-q octave.
99
-    cmMidiByte_t       constQMaxPitch;        ///< Used to determine the maximum const-q frequency of interest.
100
-    unsigned           constQBinsPerOctave;   ///< Bands per const-q octave.
101
-    unsigned           onsetMedFiltWndSmpCnt; ///< Complex onset median filter 
102
-    cmReal_t           onsetThreshold;        ///< Complex onset threshold
103
-    cmReal_t           minDb;                 ///< Fourier Transform magnitude values below minDb are set to minDb.
104
-    cmReal_t           floorThreshDb;         ///< Frames with an RMS below this value will be skipped
105
-    cmFtSkip_t*        skipArray;             ///< skipArray[skipCnt] user defined sample skip ranges
106
-    unsigned           skipCnt;               ///< Count of records in skipArray[].
107
-    cmFtAttr_t*        attrArray;             ///< attrArray[attrCnt] user defined parameter array
108
-    unsigned           attrCnt;               ///< Count of records in attrArray[].
91
+    const char*        audioFn;               // Audio file name.
92
+    const char*        featFn;                // Feature file name.
93
+    unsigned           chIdx;                 // Audio file channel index
94
+    cmReal_t           wndMs;                 // Length of the analysis window in milliseconds.
95
+    unsigned           hopFact;               // Analysis window overlap factor 1 = 1:1 2=2:1 ...
96
+    bool               normAudioFl;           // Normalize the audio over the length of the audio file
97
+    cmMidiByte_t       constQMinPitch;        // Used to determine the base const-q octave.
98
+    cmMidiByte_t       constQMaxPitch;        // Used to determine the maximum const-q frequency of interest.
99
+    unsigned           constQBinsPerOctave;   // Bands per const-q octave.
100
+    unsigned           onsetMedFiltWndSmpCnt; // Complex onset median filter 
101
+    cmReal_t           onsetThreshold;        // Complex onset threshold
102
+    cmReal_t           minDb;                 // Fourier Transform magnitude values below minDb are set to minDb.
103
+    cmReal_t           floorThreshDb;         // Frames with an RMS below this value will be skipped
104
+    cmFtSkip_t*        skipArray;             // skipArray[skipCnt] user defined sample skip ranges
105
+    unsigned           skipCnt;               // Count of records in skipArray[].
106
+    cmFtAttr_t*        attrArray;             // attrArray[attrCnt] user defined parameter array
107
+    unsigned           attrCnt;               // Count of records in attrArray[].
109 108
   } cmFtParam_t;
110 109
 
111 110
 
112
-  /// Feature summary information
111
+  // Feature summary information
113 112
   typedef struct 
114 113
   {
115
-    unsigned    id;   ///< feature id (same as associated cmFtAttr.id)
116
-    unsigned    cnt;  ///< length of each feature vector (same as associated cmFtAttr.cnt)
117
-
118
-    /// The raw feature summary values are calculated prior to normalization.
119
-    cmReal_t* rawMinV;  ///< Vector of min value over time for each feature element.
120
-    cmReal_t* rawMaxV;  ///< Vector of max value over time for each feature element.
121
-    cmReal_t* rawAvgV;  ///< Vector of avg value over time for each feature element.
122
-    cmReal_t* rawSdvV;  ///< Vector of standard deviation values over time for each feature element.
123
-    cmReal_t  rawMin;   ///< Min value of all values for this feature. Equivalent to min(rawMinV).
124
-    cmReal_t  rawMax;   ///< Max value of all values for this feature. Equivalent to max(rawMaxV).
125
-
126
-    /// normalized feature summary values
127
-    cmReal_t* normMinV; ///< Vector of min value over time for each feature element.
128
-    cmReal_t* normMaxV; ///< Vector of max value over time for each feature element.
129
-    cmReal_t* normAvgV; ///< Vector of avg value over time for each feature element.
130
-    cmReal_t* normSdvV; ///< Vector of standard deviation values over time for each feature element.
131
-    cmReal_t  normMin;  ///< Min value of all values for this feature. Equivalent to min(normMinV).
132
-    cmReal_t  normMax;  ///< Max value of all values for this feature. Equivalent to max(rawMaxV).
114
+    unsigned    id;   // feature id (same as associated cmFtAttr.id)
115
+    unsigned    cnt;  // length of each feature vector (same as associated cmFtAttr.cnt)
116
+
117
+    // The raw feature summary values are calculated prior to normalization.
118
+    cmReal_t* rawMinV;  // Vector of min value over time for each feature element.
119
+    cmReal_t* rawMaxV;  // Vector of max value over time for each feature element.
120
+    cmReal_t* rawAvgV;  // Vector of avg value over time for each feature element.
121
+    cmReal_t* rawSdvV;  // Vector of standard deviation values over time for each feature element.
122
+    cmReal_t  rawMin;   // Min value of all values for this feature. Equivalent to min(rawMinV).
123
+    cmReal_t  rawMax;   // Max value of all values for this feature. Equivalent to max(rawMaxV).
124
+
125
+    // normalized feature summary values
126
+    cmReal_t* normMinV; // Vector of min value over time for each feature element.
127
+    cmReal_t* normMaxV; // Vector of max value over time for each feature element.
128
+    cmReal_t* normAvgV; // Vector of avg value over time for each feature element.
129
+    cmReal_t* normSdvV; // Vector of standard deviation values over time for each feature element.
130
+    cmReal_t  normMin;  // Min value of all values for this feature. Equivalent to min(normMinV).
131
+    cmReal_t  normMax;  // Max value of all values for this feature. Equivalent to max(rawMaxV).
133 132
 
134 133
   } cmFtSumm_t;
135 134
 
136
-  /// Feature file info record
135
+  // Feature file info record
137 136
   typedef struct
138 137
   {
139
-    unsigned    frmCnt;         ///< count of frames in the file
140
-    cmReal_t    srate;          ///< audio sample rate
141
-    unsigned    smpCnt;         ///< audio sample count
142
-    unsigned    fftSmpCnt;      ///< FFT window length (always power of 2)
143
-    unsigned    hopSmpCnt;      ///< audio sample hop count
144
-    unsigned    binCnt;         ///< FFT bin count (always fftSmpCnt/2 + 1)
145
-    unsigned    skipFrmCnt;     ///< count of frames skipped based on user skip array 
146
-    unsigned    floorFrmCnt;    ///< count of frames skipped because below floorThreshDb
147
-    cmFtParam_t param;          ///< analysis parameter record used to form this feature file
148
-    cmFtSumm_t* summArray;      ///< summArray[ param.attrCnt ] feature summary information
138
+    unsigned    frmCnt;         // count of frames in the file
139
+    cmReal_t    srate;          // audio sample rate
140
+    unsigned    smpCnt;         // audio sample count
141
+    unsigned    fftSmpCnt;      // FFT window length (always power of 2)
142
+    unsigned    hopSmpCnt;      // audio sample hop count
143
+    unsigned    binCnt;         // FFT bin count (always fftSmpCnt/2 + 1)
144
+    unsigned    skipFrmCnt;     // count of frames skipped based on user skip array 
145
+    unsigned    floorFrmCnt;    // count of frames skipped because below floorThreshDb
146
+    cmFtParam_t param;          // analysis parameter record used to form this feature file
147
+    cmFtSumm_t* summArray;      // summArray[ param.attrCnt ] feature summary information
149 148
   } cmFtInfo_t;
150 149
 
151
-  /// Data structure returned by cmFtReaderAdvance(). 
150
+  // Data structure returned by cmFtReaderAdvance(). 
152 151
   typedef struct
153 152
   {
154
-    unsigned smpIdx;  ///< The audio signal sample index this frames information is based on.
155
-    unsigned frmIdx;  ///< The frame index relative to other frames in this feature file.
153
+    unsigned smpIdx;  // The audio signal sample index this frames information is based on.
154
+    unsigned frmIdx;  // The frame index relative to other frames in this feature file.
156 155
   } cmFtFrameDesc_t;
157 156
 
158
-  typedef cmHandle_t cmFtH_t;      ///< Analyzer handle
159
-  typedef cmHandle_t cmFtFileH_t;  ///< Feature file handle.
160
-  typedef unsigned   cmFtRC_t;     ///< Result code type used by all functions in cmFeatFile.h.
157
+  typedef cmHandle_t cmFtH_t;      // Analyzer handle
158
+  typedef cmHandle_t cmFtFileH_t;  // Feature file handle.
159
+  typedef unsigned   cmFtRC_t;     // Result code type used by all functions in cmFeatFile.h.
161 160
 
162
-  extern cmFtH_t     cmFtNullHandle;      ///< A NULL handle useful for indicating an uninitialized analyzer.
163
-  extern cmFtFileH_t cmFtFileNullHandle;  ///< A NULL handle useful for indicating an uninitialized feature file.
161
+  extern cmFtH_t     cmFtNullHandle;      // A NULL handle useful for indicating an uninitialized analyzer.
162
+  extern cmFtFileH_t cmFtFileNullHandle;  // A NULL handle useful for indicating an uninitialized feature file.
164 163
 
165 164
 
166
-  /// Given a feature type id return the associated label.
165
+  // Given a feature type id return the associated label.
167 166
   const char*     cmFtFeatIdToLabel( unsigned featId );
168 167
 
169
-  /// Given a feature type label return the associated id.
168
+  // Given a feature type label return the associated id.
170 169
   unsigned        cmFtFeatLabelToId( const char* label );
171 170
 
172
-  /// \name Feature Analyzer Related functions
173
-  ///@{ 
171
+  // Feature Analyzer Related functions
174 172
 
175
-  /// Initialize the feature analyzer. The memory manager and file system must
176
-  /// be initialized (cmMdInitialize(), cmFsInitialize()) prior to calling this function.
173
+  // Initialize the feature analyzer. The memory manager and file system must
174
+  // be initialized (cmMdInitialize(), cmFsInitialize()) prior to calling this function.
177 175
   cmFtRC_t        cmFtInitialize( cmFtH_t* hp, cmCtx_t* ctx );
178 176
 
179
-  /// Finalize a feature analyzer.
177
+  // Finalize a feature analyzer.
180 178
   cmFtRC_t        cmFtFinalize( cmFtH_t* h );
181 179
 
182
-  /// Return true if the handle represents an initialized feature analyzer.
180
+  // Return true if the handle represents an initialized feature analyzer.
183 181
   bool            cmFtIsValid( cmFtH_t  h );
184 182
 
185
-  /// Parse a JSON file containing a set of analysis parameters. 
183
+  // Parse a JSON file containing a set of analysis parameters. 
186 184
   cmFtRC_t        cmFtParse( cmFtH_t  h, const char* cfgFn );
187 185
 
188
-  /// Run the analyzer.
186
+  // Run the analyzer.
189 187
   cmFtRC_t        cmFtAnalyze( cmFtH_t h );
190 188
 
191
-  /// If cmFtAnalyze() is being run in a seperate thread this function
192
-  /// can be used to access the analyzers progress.
189
+  // If cmFtAnalyze() is being run in a seperate thread this function
190
+  // can be used to access the analyzers progress.
193 191
   const char*     cmFtAnalyzeProgress( cmFtH_t h, unsigned* passPtr, cmReal_t* percentPtr );  
194 192
 
195
-  ///@}
196 193
   
197
-  /// \name Feature File Related Functions
198
-  ///@{
194
+  // Feature File Related Functions
199 195
 
200
-  /// Open a feature file.
201
-  /// Note that inforPtrPtr is optional and will be ignored if it is set to NULL.
196
+  // Open a feature file.
197
+  // Note that inforPtrPtr is optional and will be ignored if it is set to NULL.
202 198
   cmFtRC_t        cmFtReaderOpen(    cmFtH_t h, cmFtFileH_t* hp, const char* featFn, const cmFtInfo_t** infoPtrPtr );
203 199
 
204
-  /// Close a feature file.
200
+  // Close a feature file.
205 201
   cmFtRC_t        cmFtReaderClose(   cmFtFileH_t* hp );
206 202
 
207
-  /// Return true if the handle reprents an open feature file.
203
+  // Return true if the handle reprents an open feature file.
208 204
   bool            cmFtReaderIsValid( cmFtFileH_t h );
209 205
 
210
-  /// Return the count of features types this file contains.
206
+  // Return the count of features types this file contains.
211 207
   unsigned        cmFtReaderFeatCount( cmFtFileH_t h );
212 208
 
213
-  /// Return the feature type id associated with the specified index.
209
+  // Return the feature type id associated with the specified index.
214 210
   unsigned        cmFtReaderFeatId( cmFtFileH_t h, unsigned index );
215 211
 
216
-  /// Reset the current file location to the first frame but do not load it.
217
-  /// The next call to cmFtReadAdvance() will load the next frame.
212
+  // Reset the current file location to the first frame but do not load it.
213
+  // The next call to cmFtReadAdvance() will load the next frame.
218 214
   cmFtRC_t        cmFtReaderRewind(  cmFtFileH_t h );
219 215
 
220
-  /// Make frmIdx the current file location.
216
+  // Make frmIdx the current file location.
221 217
   cmFtRC_t        cmFtReaderSeek(    cmFtFileH_t h, unsigned frmIdx );
222 218
 
223
-  /// Load the current frame, advance the current file position, and return
224
-  /// a pointer to a cmFtFrameDesc_t record for the loaded frame.
225
-  /// Returns kEofFtRC upon reaching end of file. 
226
-  /// The frameDescPtr is optional.
219
+  // Load the current frame, advance the current file position, and return
220
+  // a pointer to a cmFtFrameDesc_t record for the loaded frame.
221
+  // Returns kEofFtRC upon reaching end of file. 
222
+  // The frameDescPtr is optional.
227 223
   cmFtRC_t        cmFtReaderAdvance( cmFtFileH_t h, cmFtFrameDesc_t* frameDescPtr );
228 224
 
229
-  /// Returns a pointer to a data matrix in the feature identified by featId in the current feature frame. 
225
+  // Returns a pointer to a data matrix in the feature identified by featId in the current feature frame. 
230 226
   cmReal_t*       cmFtReaderData(    cmFtFileH_t h, unsigned featId, unsigned* cntPtr );
231 227
 
232
-  /// Copy the contents of a given set of frames into buf[frmCnt*elePerFrmCnt].
228
+  // Copy the contents of a given set of frames into buf[frmCnt*elePerFrmCnt].
233 229
   cmFtRC_t        cmFtReaderCopy(    cmFtFileH_t h, unsigned featId, unsigned frmIdx, cmReal_t* buf, unsigned frmCnt, unsigned elePerFrmCnt, unsigned* outEleCntPtr );  
234 230
 
235
-  /// Data structure used to specify multiple features for use by cmFtReaderMultiSetup().
231
+  // Data structure used to specify multiple features for use by cmFtReaderMultiSetup().
236 232
   typedef struct
237 233
   {
238
-    unsigned featId; ///< Feature id of feature to include in the feature vector
239
-    unsigned cnt;    ///< Set to count of feat ele's for this feat. Error if greater than avail. Set to -1 to use all avail ele's.
240
-                     ///  returned with actual count used
234
+    unsigned featId; // Feature id of feature to include in the feature vector
235
+    unsigned cnt;    // Set to count of feat ele's for this feat. Error if greater than avail. Set to -1 to use all avail ele's.
236
+                     //  returned with actual count used
241 237
 
242
-    unsigned id0;    ///< Ignored on input. Used internally by cmFtReaderXXX() 
243
-    unsigned id1;    ///< Ignored on input. Used internally by cmFtReaderXXX() 
238
+    unsigned id0;    // Ignored on input. Used internally by cmFtReaderXXX() 
239
+    unsigned id1;    // Ignored on input. Used internally by cmFtReaderXXX() 
244 240
   } cmFtMulti_t;
245 241
   
246
-  /// Setup an array of cmFtMulti_t records.  The cmFtMulti_t array
247
-  /// used by cmFtReaderMulitData() must be initialized by this function.
242
+  // Setup an array of cmFtMulti_t records.  The cmFtMulti_t array
243
+  // used by cmFtReaderMulitData() must be initialized by this function.
248 244
   cmFtRC_t        cmFtReaderMultiSetup(  cmFtFileH_t h, cmFtMulti_t* multiArray, unsigned multiCnt, unsigned* featVectEleCntPtr ); 
249 245
 
250
-  /// Fill outV[outN] with a consecutive data from the features specified in the cmFtMulti_t array.
251
-  /// Use cmFtReaderMultiSetup() to configure the cmFtMulti_t array prior to calling this function.
246
+  // Fill outV[outN] with a consecutive data from the features specified in the cmFtMulti_t array.
247
+  // Use cmFtReaderMultiSetup() to configure the cmFtMulti_t array prior to calling this function.
252 248
   cmFtRC_t        cmFtReaderMultiData(   cmFtFileH_t h, const cmFtMulti_t* multiArray, unsigned multiCnt, cmReal_t* outV, unsigned outN ); 
253 249
 
254
-  /// Report summary information for the specified feature.
250
+  // Report summary information for the specified feature.
255 251
   cmFtRC_t        cmFtReaderReport(  cmFtFileH_t h, unsigned featId );
256 252
 
257
-  /// Identical to cmFtReaderReport() except the feature file is identified from a file name rather than an open cmFtFileH_t.
253
+  // Identical to cmFtReaderReport() except the feature file is identified from a file name rather than an open cmFtFileH_t.
258 254
   cmFtRC_t        cmFtReaderReportFn(  cmFtH_t h, const cmChar_t* fn, unsigned featId );
259 255
 
260
-  /// Report feature data for the specified set of feature frames.
256
+  // Report feature data for the specified set of feature frames.
261 257
   cmFtRC_t        cmFtReaderReportFeature( cmFtFileH_t h, unsigned featId, unsigned frmIdx, unsigned frmCnt );
262 258
 
263
-  /// Write a feature into a binary file.  
264
-  /// Set 'frmCnt' to the cmInvalidCnt to include all frames past frmIdx.
265
-  /// The first three unsigned values in the output file
266
-  /// contain the row count, maximum column count, and the count of bytes in each data element (4=float,8=double). 
267
-  /// Each row of the file begins with the count of elements in the row and is followed by a data array.
259
+  // Write a feature into a binary file.  
260
+  // Set 'frmCnt' to the cmInvalidCnt to include all frames past frmIdx.
261
+  // The first three unsigned values in the output file
262
+  // contain the row count, maximum column count, and the count of bytes in each data element (4=float,8=double). 
263
+  // Each row of the file begins with the count of elements in the row and is followed by a data array.
268 264
   cmFtRC_t        cmFtReaderToBinary( cmFtFileH_t h, unsigned featId, unsigned frmIdx, unsigned frmCnt, const cmChar_t* outFn ); 
269 265
 
270
-  /// Identical to cmFtReaderToBinary() except it takes a feature file name instead of a file handle.
266
+  // Identical to cmFtReaderToBinary() except it takes a feature file name instead of a file handle.
271 267
   cmFtRC_t        cmFtReaderToBinaryFn( cmFtH_t h, const cmChar_t* fn, unsigned featId, unsigned frmIdx, unsigned frmCnt, const cmChar_t* outFn ); 
272 268
 
273
-  ///@}
269
+  //)
274 270
   
275 271
 #ifdef __cplusplus
276 272
 }

+ 1
- 0
cmFile.c Voir le fichier

@@ -1,3 +1,4 @@
1
+
1 2
 #include "cmPrefix.h"
2 3
 #include "cmGlobal.h"
3 4
 #include "cmRpt.h"

+ 7
- 8
cmFile.h Voir le fichier

@@ -1,9 +1,3 @@
1
-//{
2
-//( 
3
-// File abstraction class which slightly extends the C standard file handling routines
4
-// to cm style error handling.
5
-//)
6
-//
7 1
 #ifndef cmFile_h
8 2
 #define cmFile_h
9 3
 
@@ -11,7 +5,13 @@
11 5
 extern "C" {
12 6
 #endif
13 7
 
14
-  //(
8
+  //( { file_desc: "File abstraction class." kw:[file system base]}
9
+  // 
10
+  // The cmFile API extends the C standard file handling routines
11
+  // with cm style error handling. All cm file input and output occurs
12
+  // through this interface."
13
+  //
14
+  
15 15
   enum
16 16
   {
17 17
     kOkFileRC = cmOkRC,
@@ -244,7 +244,6 @@ extern "C" {
244 244
   cmFileRC_t cmFileSetRC( cmFileH_t h, cmFileRC_t rc );
245 245
   
246 246
   //)
247
-  //}
248 247
 
249 248
 #ifdef __cplusplus
250 249
 }

+ 2
- 4
cmFileSys.h Voir le fichier

@@ -1,6 +1,5 @@
1
-//{
2
-//(
3
-// A collection of file system utility functions.
1
+
2
+//( { file_desc:"A collection of file system utility functions." kw:[system file]}
4 3
 //
5 4
 // Note that cmFileSysInitialize() creates an internal cmLHeapH_t based
6 5
 // heap manager from which it allocates memory for some returned objects.
@@ -242,7 +241,6 @@ extern "C" {
242 241
   cmFsRC_t    cmFileSysTest( cmCtx_t* ctx );  
243 242
 
244 243
   //)
245
-  //}
246 244
 
247 245
 #ifdef __cplusplus
248 246
 }

+ 37
- 36
cmFloatTypes.h Voir le fichier

@@ -1,16 +1,3 @@
1
-/// \file cmFloatTypes.h
2
-/// \brief Declare the types cmReal_t and cmSample_t and define some useful limits.
3
-///
4
-/// For signal processing functions the cm library uses the types cmSample_t to indicate an audio
5
-/// sample value and cmReal_t to specify a general purpose floating point value. The library
6
-/// is designed in such a way that the actual type, float or double, for these two types may
7
-/// be set at compilation time. Set the preprocessor variable CM_FLOAT_SMP to 1 to indicate 
8
-/// that cmSample_t will be of type 'float' otherwise it will be of type 'double'. 
9
-/// Set the preprocessor variable CM_FLOAT_REAL to 1 to indicate 
10
-/// that cmSample_t will be of type 'float' otherwise it will be of type 'double'. 
11
-/// By default cmSample_t is float nad cmReal_t is double.
12
-///
13
-
14 1
 #ifndef cmFloatTypes_h
15 2
 #define cmFloatTypes_h
16 3
 
@@ -19,6 +6,18 @@
19 6
 extern "C" {
20 7
 #endif
21 8
 
9
+  //( { file_desc:"Declare the types cmReal_t and cmSample_t and define some useful limits." kw:[base]}
10
+  //
11
+  // For signal processing functions the cm library uses the types cmSample_t to indicate an audio
12
+  // sample value and cmReal_t to specify a general purpose floating point value. The library
13
+  // is designed in such a way that the actual type, float or double, for these two types may
14
+  // be set at compilation time. Set the preprocessor variable CM_FLOAT_SMP to 1 to indicate 
15
+  // that cmSample_t will be of type 'float' otherwise it will be of type 'double'. 
16
+  // Set the preprocessor variable CM_FLOAT_REAL to 1 to indicate 
17
+  // that cmSample_t will be of type 'float' otherwise it will be of type 'double'. 
18
+  // By default cmSample_t is float nad cmReal_t is double.
19
+  //
20
+
22 21
   //-----------------------------------------------------------------
23 22
 #ifndef CM_FLOAT_SMP
24 23
 #define CM_FLOAT_SMP 1
@@ -26,27 +25,27 @@ extern "C" {
26 25
 
27 26
 #if CM_FLOAT_SMP == 1
28 27
 
29
-  typedef float          cmSample_t;  ///< cmSample_t is a float
30
-  typedef float _Complex cmComplexS_t;///< cmComplexS_t is single precision.
28
+  typedef float          cmSample_t;  // cmSample_t is a float
29
+  typedef float _Complex cmComplexS_t;// cmComplexS_t is single precision.
31 30
 
32
-#define cmSample_EPSILON FLT_EPSILON  ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
33
-#define cmSample_MAX     FLT_MAX      ///< Maximum representable number (1E+37).
34
-#define cmSample_MIN     FLT_MIN      ///< Minimum representable number (1E-37).
31
+#define cmSample_EPSILON FLT_EPSILON  // Minimum increment between 1.0 and the next greaterv value. (1E-5)
32
+#define cmSample_MAX     FLT_MAX      // Maximum representable number (1E+37).
33
+#define cmSample_MIN     FLT_MIN      // Minimum representable number (1E-37).
35 34
 
36 35
 #else
37 36
 
38
-  typedef  double          cmSample_t;   ///< cmSample_t is a double
39
-  typedef  double _Complex cmComplexS_t; ///< cmComplexS_t is doulbe precision.
37
+  typedef  double          cmSample_t;   // cmSample_t is a double
38
+  typedef  double _Complex cmComplexS_t; // cmComplexS_t is doulbe precision.
40 39
 
41
-#define cmSample_EPSILON DBL_EPSILON    ///< Minimum increment between 1.0 and the next greaterv value. (1E-9)
42
-#define cmSample_MAX     DBL_MAX        ///< Maximum representable number (1E+37).
43
-#define cmSample_MIN     DBL_MIN        ///< Minimum representable number (1E-37).
40
+#define cmSample_EPSILON DBL_EPSILON    // Minimum increment between 1.0 and the next greaterv value. (1E-9)
41
+#define cmSample_MAX     DBL_MAX        // Maximum representable number (1E+37).
42
+#define cmSample_MIN     DBL_MIN        // Minimum representable number (1E-37).
44 43
 
45 44
 #endif
46 45
 
47
-//-----------------------------------------------------------------
48
-//-----------------------------------------------------------------
49
-//-----------------------------------------------------------------
46
+  //-----------------------------------------------------------------
47
+  //-----------------------------------------------------------------
48
+  //-----------------------------------------------------------------
50 49
 
51 50
 #ifndef CM_FLOAT_REAL
52 51
 #define CM_FLOAT_REAL 0
@@ -54,25 +53,27 @@ extern "C" {
54 53
 
55 54
 #if CM_FLOAT_REAL == 1
56 55
 
57
-  typedef float          cmReal_t;      ///< cmReal_t is a float
58
-  typedef float _Complex cmComplexR_t;  ///< cmComplexR_t is single precision.
56
+  typedef float          cmReal_t;      // cmReal_t is a float
57
+  typedef float _Complex cmComplexR_t;  // cmComplexR_t is single precision.
59 58
 
60
-#define cmReal_EPSILON FLT_EPSILON      ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
61
-#define cmReal_MAX     FLT_MAX          ///< Maximum representable number (1E+37).
62
-#define cmReal_MIN     FLT_MIN          ///< Minimum representable number (1E-37).
59
+#define cmReal_EPSILON FLT_EPSILON      // Minimum increment between 1.0 and the next greaterv value. (1E-5)
60
+#define cmReal_MAX     FLT_MAX          // Maximum representable number (1E+37).
61
+#define cmReal_MIN     FLT_MIN          // Minimum representable number (1E-37).
63 62
 
64 63
 #else
65 64
 
66
-  typedef  double          cmReal_t;      ///< cmReal_t is a double.
67
-  typedef  double _Complex cmComplexR_t;  ///< cmComplexR_t is double precision.
65
+  typedef  double          cmReal_t;      // cmReal_t is a double.
66
+  typedef  double _Complex cmComplexR_t;  // cmComplexR_t is double precision.
68 67
 
69
-#define cmReal_EPSILON DBL_EPSILON  ///< Minimum increment between 1.0 and the next greaterv value (1E-9).
70
-#define cmReal_MAX     DBL_MAX      ///< Maximum representable number (1E+37).
71
-#define cmReal_MIN     DBL_MIN      ///< Minimum representable number (1E-37).
68
+#define cmReal_EPSILON DBL_EPSILON  // Minimum increment between 1.0 and the next greaterv value (1E-9).
69
+#define cmReal_MAX     DBL_MAX      // Maximum representable number (1E+37).
70
+#define cmReal_MIN     DBL_MIN      // Minimum representable number (1E-37).
72 71
 
73 72
 
74 73
 #endif
75 74
 
75
+  //)
76
+  
76 77
 #ifdef __cplusplus
77 78
 }
78 79
 #endif

+ 3
- 3
cmFrameFile.c Voir le fichier

@@ -1031,7 +1031,7 @@ cmFfRC_t cmFrameFileFrameCreate( cmFrameFileH_t h, unsigned frameType, unsigned
1031 1031
   p->frame.f.mtxCnt       = 0;
1032 1032
   p->frame.f.streamId     = streamId;
1033 1033
   p->frame.f.flags        = flags;
1034
-  p->frame.f.time.seconds = 0;
1034
+  p->frame.f.tm.seconds = 0;
1035 1035
 
1036 1036
   return rc;
1037 1037
 }
@@ -1327,10 +1327,10 @@ cmFfRC_t cmFrameFileFrameNext( cmFrameFileH_t h, unsigned keyFrameTypeId, unsign
1327 1327
     return rc;
1328 1328
 
1329 1329
   if( cmIsFlag(p->frame.f.flags,kSampleIdxTimeFl) )
1330
-    p->frame.f.time.sampleIdx = sampleIdx;
1330
+    p->frame.f.tm.sampleIdx = sampleIdx;
1331 1331
 
1332 1332
   if( cmIsFlag(p->frame.f.flags,kSecondsTimeFl) )
1333
-    p->frame.f.time.seconds = seconds;
1333
+    p->frame.f.tm.seconds = seconds;
1334 1334
 
1335 1335
   
1336 1336
   return rc;

+ 10
- 7
cmFrameFile.h Voir le fichier

@@ -1,16 +1,17 @@
1 1
 #ifndef cmFrameFile_h
2 2
 #define cmFrameFile_h
3 3
 
4
-/*
5
-  file  -> cmFfFile_t frame*
6
-  frame -> cmFfFrame_t mtx*
7
-  mtx   -> cmFfMtx_t data*   
8
- */
9
-
10 4
 #ifdef __cplusplus
11 5
 extern "C" {
12 6
 #endif
13 7
 
8
+  //( { file_desc:"File reader and writer for time series data as used by cmFeatFile" kw:[file audio]}
9
+  //
10
+  // file  -> cmFfFile_t frame*
11
+  // frame -> cmFfFrame_t mtx*
12
+  // mtx   -> cmFfMtx_t data*   
13
+  //
14
+
14 15
 
15 16
   enum
16 17
   {
@@ -139,7 +140,7 @@ extern "C" {
139 140
     {
140 141
       unsigned sampleIdx;
141 142
       double   seconds;
142
-    } time;
143
+    } tm;
143 144
     
144 145
   } cmFfFrame_t;
145 146
 
@@ -353,6 +354,8 @@ extern "C" {
353 354
 #define kRealFmtId              kDoubleFmtId
354 355
 #endif
355 356
 
357
+  //)
358
+  
356 359
 #ifdef __cplusplus
357 360
 }
358 361
 #endif

+ 6
- 8
cmGlobal.h Voir le fichier

@@ -1,15 +1,14 @@
1
-//{
2
-//(
3
-// cmGlobal.h contains the global macros, header files, and 
4
-//  typedefs availale to all other cm modules. 
1
+
2
+
3
+#ifndef cmGlobal_h
4
+#define cmGlobal_h
5
+
6
+//( { file_desc:"This is the globally included prefix file for all 'cm' files." kw:[base] }
5 7
 //
6 8
 // All operating system dependencies should be resolved in this file via 
7 9
 // testing for OS_LINUX, OS_OSX, or OS_W32.
8 10
 //)
9 11
 
10
-#ifndef cmGlobal_h
11
-#define cmGlobal_h
12
-
13 12
 //(
14 13
 #include "config.h" // created by 'configure'
15 14
 #include <stdio.h>
@@ -150,6 +149,5 @@ extern "C" {
150 149
 #endif
151 150
 
152 151
 //)
153
-//}
154 152
 
155 153
 #endif

+ 94
- 82
cmGnuPlot.h Voir le fichier

@@ -1,85 +1,91 @@
1 1
 #ifndef cmGnuPlot_h
2 2
 #define cmGnuPlot_h
3 3
 
4
-enum
5
-{
6
-  kOkPlRC,
7
-  kSignalFailedPlRC,
8
-  kPipeFailedPlRC,
9
-  kForkFailedPlRC,
10
-  kExecFailedPlRC,
11
-  kPipeCloseFailedPlRC,
12
-  kPlotNotFoundPlRC,
13
-  kNoCurPlotPlRC,
14
-  kPlotDataFileFailPlRC,
15
-  kFopenFailedPlRC,
16
-  kFcloseFailedPlRC
17
-};
18
-
19
-enum
20
-{
21
-  kInvalidPlotPtId    = 0x000,
22
-  kPlusPlotPtId       = 0x001,
23
-  kXPlotPtId          = 0x002,
24
-  kAsteriskPlotPtId   = 0x003,
25
-  kSquarePlotPtId     = 0x004,
26
-  kFillSquarePlotPtId = 0x005,
27
-  kCirclePlotPtId     = 0x006,
28
-  kFillCirclePlotPtId = 0x007,
29
-  kTriPlotPtId        = 0x008,
30
-  kFillTriPlotPtId    = 0x009,
31
-  kInvTriPlotPtId     = 0x00a,
32
-  kInvFillTriPlotPtId = 0x00b,
33
-  kDiamondPlotPtId    = 0x00c,
34
-  kFillDiamonPlotPtId = 0x00d,
35
-  kPlotPtMask         = 0x00f,
36
-};
37
-
38
-enum
39
-{
40
-  kInvalidPlotLineId   = 0x000,  // -2 after translation
41
-  kSolidPlotLineId     = 0x010,  // -1 after translation
42
-  kDashPlotLineId      = 0x020,  //  0 after translation
43
-  kPlotLineMask        = 0x0f0,
44
-  kPlotLineShift       = 4
45
-};
46
-
47
-enum 
48
-{
49
-  kImpulsePlotFl       = 0x100
50
-};
51
-
52
-/// Set terminal to NULL to use the default terminal.
53
-cmRC_t cmPlotInitialize( const char* terminalStr );
54
-
55
-// Combines initializaion and setup in a single call.
56
-cmRC_t cmPlotInitialize2( const char* terminalStr, const char* title, unsigned rowCnt, unsigned colCnt );
57
-
58
-cmRC_t cmPlotFinalize();
59
-
60
-/// Setup the plot page
61
-cmRC_t cmPlotSetup( const char* title, unsigned rowCnt, unsigned colCnt );
62
-
63
-/// Select sub-plot to apply subsequent commands to
64
-cmRC_t cmPlotSelectSubPlot( unsigned ri, unsigned ci );
65
-
66
-/// Clear the current current subplot 
67
-cmRC_t cmPlotClear();
68
-
69
-/// Set the labels on the current sub-plot
70
-cmRC_t cmPlotSetLabels( const char* title, const char* xLabelStr, const char* yLabelStr, const char* zLabelStr ); 
71
-
72
-/// Set the default ranges for the x, y and z axes. To leave the ranges at their current values set the min and max to -1.
73
-/// The range values are used to form data sets when data is not explicitely given.
74
-cmRC_t cmPlotSetRange( double xMin, double xMax, double yMin, double yMax, double zMin, double zMax ); 
75
-
76
-/// If x or y is given as NULL then the values will be taken from the range settings xMin:xMax or yMin:yMax.
77
-/// Use the gnuplot command:'test' to see the valid lineType and pointType values for a given terminal
78
-/// Color string may be any of the predefined color labels: show palette colornames or and rgb value: e.g. #FF00FF
79
-cmRC_t cmPlotLineF( const char* legendStr, const float*  x, const float*  y, const float*  z, unsigned n, const char* colorStr, unsigned styleFlags );
80
-cmRC_t cmPlotLineD( const char* legendStr, const double* x, const double* y, const double* z, unsigned n, const char* colorStr, unsigned styleFlags );
81
-
82
-cmRC_t cmPlotLineMD( const double* x, const double* y, const double* z, unsigned rn, unsigned cn, unsigned styleFlags );
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+  //( { file_desc:"Interface to GNU Plot." kw:[plot]}
9
+  
10
+  enum
11
+  {
12
+    kOkPlRC,
13
+    kSignalFailedPlRC,
14
+    kPipeFailedPlRC,
15
+    kForkFailedPlRC,
16
+    kExecFailedPlRC,
17
+    kPipeCloseFailedPlRC,
18
+    kPlotNotFoundPlRC,
19
+    kNoCurPlotPlRC,
20
+    kPlotDataFileFailPlRC,
21
+    kFopenFailedPlRC,
22
+    kFcloseFailedPlRC
23
+  };
24
+
25
+  enum
26
+  {
27
+    kInvalidPlotPtId    = 0x000,
28
+    kPlusPlotPtId       = 0x001,
29
+    kXPlotPtId          = 0x002,
30
+    kAsteriskPlotPtId   = 0x003,
31
+    kSquarePlotPtId     = 0x004,
32
+    kFillSquarePlotPtId = 0x005,
33
+    kCirclePlotPtId     = 0x006,
34
+    kFillCirclePlotPtId = 0x007,
35
+    kTriPlotPtId        = 0x008,
36
+    kFillTriPlotPtId    = 0x009,
37
+    kInvTriPlotPtId     = 0x00a,
38
+    kInvFillTriPlotPtId = 0x00b,
39
+    kDiamondPlotPtId    = 0x00c,
40
+    kFillDiamonPlotPtId = 0x00d,
41
+    kPlotPtMask         = 0x00f,
42
+  };
43
+
44
+  enum
45
+  {
46
+    kInvalidPlotLineId   = 0x000,  // -2 after translation
47
+    kSolidPlotLineId     = 0x010,  // -1 after translation
48
+    kDashPlotLineId      = 0x020,  //  0 after translation
49
+    kPlotLineMask        = 0x0f0,
50
+    kPlotLineShift       = 4
51
+  };
52
+
53
+  enum 
54
+  {
55
+    kImpulsePlotFl       = 0x100
56
+  };
57
+
58
+  /// Set terminal to NULL to use the default terminal.
59
+  cmRC_t cmPlotInitialize( const char* terminalStr );
60
+
61
+  // Combines initializaion and setup in a single call.
62
+  cmRC_t cmPlotInitialize2( const char* terminalStr, const char* title, unsigned rowCnt, unsigned colCnt );
63
+
64
+  cmRC_t cmPlotFinalize();
65
+
66
+  /// Setup the plot page
67
+  cmRC_t cmPlotSetup( const char* title, unsigned rowCnt, unsigned colCnt );
68
+
69
+  /// Select sub-plot to apply subsequent commands to
70
+  cmRC_t cmPlotSelectSubPlot( unsigned ri, unsigned ci );
71
+
72
+  /// Clear the current current subplot 
73
+  cmRC_t cmPlotClear();
74
+
75
+  /// Set the labels on the current sub-plot
76
+  cmRC_t cmPlotSetLabels( const char* title, const char* xLabelStr, const char* yLabelStr, const char* zLabelStr ); 
77
+
78
+  /// Set the default ranges for the x, y and z axes. To leave the ranges at their current values set the min and max to -1.
79
+  /// The range values are used to form data sets when data is not explicitely given.
80
+  cmRC_t cmPlotSetRange( double xMin, double xMax, double yMin, double yMax, double zMin, double zMax ); 
81
+
82
+  /// If x or y is given as NULL then the values will be taken from the range settings xMin:xMax or yMin:yMax.
83
+  /// Use the gnuplot command:'test' to see the valid lineType and pointType values for a given terminal
84
+  /// Color string may be any of the predefined color labels: show palette colornames or and rgb value: e.g. #FF00FF
85
+  cmRC_t cmPlotLineF( const char* legendStr, const float*  x, const float*  y, const float*  z, unsigned n, const char* colorStr, unsigned styleFlags );
86
+  cmRC_t cmPlotLineD( const char* legendStr, const double* x, const double* y, const double* z, unsigned n, const char* colorStr, unsigned styleFlags );
87
+
88
+  cmRC_t cmPlotLineMD( const double* x, const double* y, const double* z, unsigned rn, unsigned cn, unsigned styleFlags );
83 89
 
84 90
 
85 91
 #if CM_FLOAT_SMP == 1
@@ -95,8 +101,14 @@ cmRC_t cmPlotLineMD( const double* x, const double* y, const double* z, unsigned
95 101
 #endif
96 102
 
97 103
 
98
-cmRC_t cmPlotDraw();
99
-cmRC_t cmPlotPrint( bool printDataFl );
100
-cmRC_t cmPlotDrawAndPrint( bool printDataFl );
104
+  cmRC_t cmPlotDraw();
105
+  cmRC_t cmPlotPrint( bool printDataFl );
106
+  cmRC_t cmPlotDrawAndPrint( bool printDataFl );
107
+
108
+  //)
109
+  
110
+#ifdef __cplusplus
111
+}
112
+#endif
101 113
 
102 114
 #endif

+ 2
- 0
cmGr.h Voir le fichier

@@ -5,6 +5,7 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Low level device independent API for descibing interactive graphics objects." kw:[plot] }
8 9
   enum 
9 10
   {
10 11
     kAliceBlueGrId            = 0xf0f8ff,
@@ -867,6 +868,7 @@ extern "C" {
867 868
 
868 869
   void     cmGrReport( cmGrH_t h, cmRpt_t* rpt );
869 870
 
871
+  //)
870 872
   
871 873
 #ifdef __cplusplus
872 874
 }

+ 4
- 1
cmGrDevCtx.h Voir le fichier

@@ -4,7 +4,8 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
-
7
+  //( { file_desc:"Device independent graphics context object used by cmGr." kw:[plot]}
8
+  
8 9
   enum
9 10
   {
10 11
     kOkGrDcRC = cmOkRC,
@@ -195,6 +196,8 @@ extern "C" {
195 196
   // Is any of the rectangle visible in this drawing context.
196 197
   bool            cmGrDcRectIsVisible(  cmGrDcH_t h, const cmGrPExt_t* r );
197 198
 
199
+  //)
200
+  
198 201
 #ifdef __cplusplus
199 202
 }
200 203
 #endif

+ 15
- 2
cmGrPage.h Voir le fichier

@@ -4,6 +4,8 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
+
8
+  //( { file_desc:"Device independent plotting window with one or more plot views." kw:[plot]}
7 9
   
8 10
   enum
9 11
   {
@@ -74,7 +76,11 @@ extern "C" {
74 76
   const cmChar_t*  cmGrPageLabelFuncLabel(    cmGrPgH_t h, unsigned id );
75 77
   void*            cmGrPageLabelFuncArg(      cmGrPgH_t h, unsigned id );
76 78
 
77
-
79
+  //----------------------------------------------------------------------------
80
+  //)
81
+  //( { label:cmGrView file_desc:"Device independent plotting view." kw:[plot]}
82
+  //
83
+  
78 84
   // Get a view handle from the view index.
79 85
   cmGrVwH_t cmGrPageViewHandle( cmGrPgH_t h,  unsigned vwIdx );
80 86
 
@@ -132,9 +138,14 @@ extern "C" {
132 138
     kSelH_VwId
133 139
   } cmGrViewValueId_t;
134 140
   const cmChar_t* cmGrViewValue( cmGrVwH_t h, cmGrViewValueId_t id, cmChar_t* buf, unsigned bufCharCnt );
135
-
141
+  
136 142
   // Get an axis handle.
137 143
   cmGrAxH_t     cmGrViewAxisHandle(    cmGrVwH_t h,  cmGrAxisIdx_t axisIdx  );
144
+
145
+  //----------------------------------------------------------------------------
146
+  //)  
147
+  //( { label:cmGrAxis file_desc:"Device independent plotting axis." kw:[plot]}
148
+  //
138 149
   
139 150
   bool            cmGrAxisIsValid(            cmGrAxH_t h );
140 151
   // kHashMarkGrFl | kHashLabelGrFl
@@ -161,6 +172,8 @@ extern "C" {
161 172
   // or cmGrPageLabelFuncIndexToId().
162 173
   void            cmGrAxisSetLabelFunc(      cmGrAxH_t h, unsigned pgLabelFuncId );
163 174
 
175
+  //)
176
+  
164 177
 #ifdef __cplusplus
165 178
 }
166 179
 #endif

+ 3
- 0
cmGrPlot.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Device indenpendent, multi-axis, interactive, plotting system based on cmGrPage, cmGrAxis and cmGr." kw:[plot]}
9
+  
8 10
   enum
9 11
   {
10 12
     kOkGrPlRC,
@@ -229,6 +231,7 @@ extern "C" {
229 231
   // Set the default object callback and arg.
230 232
   void         cmGrPlotSetCb( cmGrPlH_t h, cmGrPlotCbFunc_t func, void* arg );
231 233
 
234
+  //)
232 235
 
233 236
 #ifdef __cplusplus
234 237
 }

+ 4
- 1
cmGrPlotAudio.h Voir le fichier

@@ -6,12 +6,15 @@
6 6
 extern "C" {
7 7
 #endif
8 8
 
9
-
9
+  //( { file_desc:"Override a cmGrPlotObj to make an efficient audio plot object." kw:[plot audio]}
10
+  
10 11
   cmGrPlRC_t  cmGrPlotAudioFileObjCreate(
11 12
     cmGrPlObjH_t oH,
12 13
     cmAfmFileH_t afH,
13 14
     unsigned     audioChIdx );
14 15
 
16
+  //)
17
+  
15 18
 #ifdef __cplusplus
16 19
 }
17 20
 #endif

+ 4
- 0
cmHashTbl.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Hash table for storing arbitary data blobs." kw:[container]}
9
+  
8 10
   enum
9 11
   {
10 12
     kOkHtRC,
@@ -60,6 +62,8 @@ extern "C" {
60 62
 
61 63
   cmHtRC_t cmHashTblTest( cmCtx_t* ctx );
62 64
 
65
+  //)
66
+  
63 67
 #ifdef __cplusplus
64 68
 }
65 69
 #endif

+ 2
- 3
cmJson.h Voir le fichier

@@ -5,8 +5,8 @@
5 5
 #ifdef __cplusplus
6 6
 extern "C" {
7 7
 #endif
8
-  //{
9
-  //(
8
+  
9
+  //( { file_desc: "JSON reader and writer" kw:[file] }
10 10
   //
11 11
   //  Limitations:
12 12
   //
@@ -501,7 +501,6 @@ extern "C" {
501 501
   cmJsRC_t      cmJsonTest( const char* fn, cmCtx_t* ctx );
502 502
 
503 503
   //)
504
-  //}
505 504
 
506 505
 #ifdef __cplusplus
507 506
 }

+ 62
- 55
cmKeyboard.h Voir le fichier

@@ -1,66 +1,73 @@
1 1
 #ifndef cmKeyboard_h
2 2
 #define cmKeyboard_h
3 3
 
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
4 7
 
5
-enum
6
-{
7
-  kInvalidKId,
8
-  kAsciiKId,
9
-  kLeftArrowKId,
10
-  kRightArrowKId,
11
-  kUpArrowKId,
12
-  kDownArrowKId,
13
-  kHomeKId,
14
-  kEndKId,
15
-  kPgUpKId,
16
-  kPgDownKId,
17
-  kInsertKId,
18
-  kDeleteKId,
8
+  //( { file_desc:"Query and get keypresses directly from the console." kw:[system] }
19 9
   
20
-};
21
-
22
-
23
-
24
-
10
+  enum
11
+  {
12
+    kInvalidKId,
13
+    kAsciiKId,
14
+    kLeftArrowKId,
15
+    kRightArrowKId,
16
+    kUpArrowKId,
17
+    kDownArrowKId,
18
+    kHomeKId,
19
+    kEndKId,
20
+    kPgUpKId,
21
+    kPgDownKId,
22
+    kInsertKId,
23
+    kDeleteKId,
24
+  
25
+  };
25 26
 
26
-typedef struct
27
-{
28
-  unsigned code;
29
-  char     ch;
30
-  bool     ctlFl;
31
-  bool     altFl;
32
-} cmKbRecd;
27
+  typedef struct
28
+  {
29
+    unsigned code;
30
+    char     ch;
31
+    bool     ctlFl;
32
+    bool     altFl;
33
+  } cmKbRecd;
33 34
 
34
-// Set 'p' to NULL if the value of the key is not required.
35
-void cmKeyPress( cmKbRecd* p );
35
+  // Set 'p' to NULL if the value of the key is not required.
36
+  void cmKeyPress( cmKbRecd* p );
36 37
 
37 38
 
38
-// Return non-zero if a key is waiting to be read otherwise return 0.
39
-// Use getchar() to pick up the key.
40
-// 
41
-// Example:
42
-// while( 1 )
43
-// {
44
-//    if( cmIsKeyWaiting() == 0 )
45
-//       usleep(20000);
46
-//    else
47
-//    {
48
-//      char c = getchar();
49
-//      switch(c)
50
-//      {
51
-//        ....
52
-//      } 
53
-//    }
54
-//
55
-// }
56
-//
57
-// TODO: Note that this function turns off line-buffering on stdin.
58
-// It should be changed to a three function sequence.
59
-// bool org_state =  cmSetStdinLineBuffering(false);
60
-// ....
61
-// cmIsKeyWaiting()
62
-// ....
63
-// cmSetStdinLineBuffering(org_state)
64
-int cmIsKeyWaiting();
39
+  // Return non-zero if a key is waiting to be read otherwise return 0.
40
+  // Use getchar() to pick up the key.
41
+  // 
42
+  // Example:
43
+  // while( 1 )
44
+  // {
45
+  //    if( cmIsKeyWaiting() == 0 )
46
+  //       usleep(20000);
47
+  //    else
48
+  //    {
49
+  //      char c = getchar();
50
+  //      switch(c)
51
+  //      {
52
+  //        ....
53
+  //      } 
54
+  //    }
55
+  //
56
+  // }
57
+  //
58
+  // TODO: Note that this function turns off line-buffering on stdin.
59
+  // It should be changed to a three function sequence.
60
+  // bool org_state =  cmSetStdinLineBuffering(false);
61
+  // ....
62
+  // cmIsKeyWaiting()
63
+  // ....
64
+  // cmSetStdinLineBuffering(org_state)
65
+  int cmIsKeyWaiting();
65 66
 
67
+  //)
68
+  
69
+#ifdef __cplusplus
70
+  extern "C" {
71
+#endif
72
+  
66 73
 #endif

+ 5
- 2
cmLex.c Voir le fichier

@@ -238,7 +238,8 @@ unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cm
238 238
 {
239 239
   unsigned i = 0;
240 240
   bool signFl = false;
241
-
241
+  unsigned digitCnt = 0;
242
+  
242 243
   for(; i<cn; ++i)
243 244
   {
244 245
     if( i==0 && cp[i]=='-' )
@@ -249,6 +250,8 @@ unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cm
249 250
 
250 251
     if( !isdigit(cp[i]) )
251 252
       break;
253
+
254
+    ++digitCnt;
252 255
   }
253 256
 
254 257
   // BUG BUG BUG
@@ -262,7 +265,7 @@ unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cm
262 265
   // containing a decimal point as reals. 
263 266
 
264 267
   // if no integer was found
265
-  if( (signFl && i==0) || i==0 )
268
+  if( digitCnt==0)
266 269
     return 0;
267 270
 
268 271
 

+ 1
- 5
cmLex.h Voir le fichier

@@ -1,11 +1,8 @@
1 1
 #ifndef cmLex_h
2 2
 #define cmLex_h
3 3
 
4
-//{
5
-//(
6
-//)
7 4
 
8
-//(
5
+//( { file_desc:"User configurable lexer for tokenizing text files." kw:[text]}
9 6
 
10 7
 
11 8
 // Predefined Lexer Id's
@@ -158,6 +155,5 @@ const cmChar_t* cmLexRcToMsg( unsigned rc );
158 155
 void cmLexTest( cmRpt_t* rpt );
159 156
 
160 157
 //)
161
-//}
162 158
 
163 159
 #endif

+ 3
- 1
cmLib.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Manage shared-libraries and query them for known symbols." kw:[system]}
9
+  
8 10
   enum
9 11
   {
10 12
     kOkLibRC = cmOkRC,
@@ -54,7 +56,7 @@ extern "C" {
54 56
   // Return the libraries file name.
55 57
   const cmChar_t* cmLibName( cmLibH_t h, unsigned libId );
56 58
   
57
-  
59
+  //)
58 60
 
59 61
 #ifdef __cplusplus
60 62
 }

+ 1
- 1
cmLinkedHeap.c Voir le fichier

@@ -141,7 +141,7 @@ bool     _cmLHeapFree(    cmLHeap_t* lhp, void* dataPtr )
141 141
     lbp->nextPtr = (char*)allocPtr; // ... then make it the space to alloc
142 142
   else           
143 143
     lbp->freeCnt += *allocPtr; // ... otherwise increase the free count
144
-  //(freeCnt tracks unused space that is not at the end of the block and therefore cannot be reused.)
144
+  // freeCnt tracks unused space that is not at the end of the block and therefore cannot be reused.
145 145
 
146 146
   // if all the space for this block has been freed then the
147 147
   // next space to allocate must be at the base

+ 11
- 2
cmLinkedHeap.h Voir le fichier

@@ -5,8 +5,18 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  //{
8
+  //( { file_desc:"Implements a block based memory heap manager." kw:[base]}
9
+  //
10
+  // There are two advantages to using this memory manager over the cmMallocDebug
11
+  // manager. It alleviates memory fragmentation by pre-allocating large blocks of memory
12
+  // which are then used to fullfill many small memory requests. Second it can
13
+  // act as a garbage collector by releasing all the memory it is managing at once.
14
+  // This can reduce code complexity by eliminating for a class instance to release internally
15
+  // allocated objects.
16
+  //)
17
+
9 18
   //(
19
+  
10 20
   typedef cmHandle_t cmLHeapH_t;
11 21
   
12 22
   extern cmLHeapH_t cmLHeapNullHandle;
@@ -84,7 +94,6 @@ extern "C" {
84 94
 #endif
85 95
 
86 96
   //)
87
-  //}
88 97
 
89 98
 #ifdef __cplusplus
90 99
 }

+ 4
- 0
cmMain.c Voir le fichier

@@ -1,3 +1,5 @@
1
+//( { file_desc:"Template 'main.c' for 'libcm' based program"  kw:[demo]}
2
+
1 3
 #include "cmGlobal.h"
2 4
 #include "cmRpt.h"
3 5
 #include "cmMem.h"
@@ -31,3 +33,5 @@ int main(int argc, char* argv[] )
31 33
   cmMdFinalize();
32 34
   return 0;
33 35
 }
36
+
37
+//)

+ 10
- 14
cmMallocDebug.h Voir le fichier

@@ -1,6 +1,11 @@
1
-//{ { label:cmMd }
2
-//(
3
-// Implements an extended memory allocation and tracking manager.
1
+#ifndef cmMallocDebug_h
2
+#define cmMallocDebug_h
3
+
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+//( { file_desc:"Implements an extended memory allocation and tracking manager." kw:[base] }
4 9
 //
5 10
 // cmMallocDebug is a wrapper to cmMem.h for calls to malloc() and free().
6 11
 // Most of the cmMdXXX() calls are directly associated with same named 
@@ -8,15 +13,8 @@
8 13
 // cmMm object where malloc() and free() are the callback functions 
9 14
 // provided to cmMmInitialize().
10 15
 // 
11
-//)
12
-
13
-#ifndef cmMallocDebug_h
14
-#define cmMallocDebug_h
15
-
16
-#ifdef __cplusplus
17
-extern "C" {
18
-#endif
19
-  //(
16
+//
17
+  
20 18
   // Initialize the malloc debug manager. guardByteCnt, alignByteeCnt, flags, and rpt
21 19
   // are used to initialize an internal cmMm object.  See cmMm for their semantics.
22 20
   cmMmRC_t  cmMdInitialize( unsigned guardByteCnt, unsigned alignByteCnt, unsigned flags, cmRpt_t* rptPtr );
@@ -165,6 +163,4 @@ extern "C" {
165 163
 #endif
166 164
 
167 165
 
168
-//}
169
-
170 166
 #endif

+ 127
- 115
cmMath.h Voir le fichier

@@ -1,120 +1,132 @@
1 1
 #ifndef cmMath_h
2 2
 #define cmMath_h
3 3
 
4
-double   cmX80ToDouble( unsigned char s[10] );
5
-void     cmDoubleToX80( double v, unsigned char s[10] );
6
-
7
-bool     cmIsPowerOfTwo(   unsigned i );
8
-unsigned cmNextPowerOfTwo( unsigned i );
9
-unsigned cmNearPowerOfTwo( unsigned i );
10
-
11
-bool     cmIsOddU(    unsigned v );
12
-bool     cmIsEvenU(   unsigned v );
13
-unsigned cmNextOddU(  unsigned v );
14
-unsigned cmPrevOddU(  unsigned v );
15
-unsigned cmNextEvenU( unsigned v );
16
-unsigned cmPrevEvenU( unsigned v );
17
-
18
-/// Increment or decrement 'idx' by 'delta' always wrapping the result into the range
19
-/// 0 to (maxN-1).
20
-/// 'idx': initial value 
21
-/// 'delta':  incremental amount
22
-/// 'maxN' - 1 : maximum return value.
23
-unsigned cmModIncr(int idx, int delta, int maxN );
24
-
25
-// modified bessel function of first kind, order 0
26
-// ref: orfandis appendix B io.m
27
-double   cmBessel0( double x );
28
-
29
-
30
-//=================================================================
31
-// The following elliptic-related function approximations come from
32
-// Parks & Burrus, Digital Filter Design, Appendix program 9, pp. 317-326
33
-// which in turn draws directly on other sources
34
-
35
-// calculate complete elliptic integral (quarter period) K
36
-// given *complimentary* modulus kc
37
-cmReal_t cmEllipK( cmReal_t kc );
38
-
39
-// calculate elliptic modulus k
40
-// given ratio of complete elliptic integrals r = K/K'
41
-// (solves the "degree equation" for fixed N = K*K1'/K'K1)
42
-cmReal_t cmEllipDeg( cmReal_t r );
43
-
44
-// calculate arc elliptic tangent u (elliptic integral of the 1st kind)
45
-// given argument x = sc(u,k) and *complimentary* modulus kc
46
-cmReal_t cmEllipArcSc( cmReal_t x, cmReal_t kc );
47
-
48
-// calculate Jacobi elliptic functions sn, cn, and dn
49
-// given argument u and *complimentary* modulus kc
50
-cmRC_t   cmEllipJ( cmReal_t u, cmReal_t kc, cmReal_t* sn, cmReal_t* cn, cmReal_t* dn );
51
-
52
-
53
-//=================================================================
54
-// bilinear transform
55
-// z = (2*sr + s)/(2*sr - s)
56
-cmRC_t cmBlt( unsigned n, cmReal_t sr, cmReal_t* rp, cmReal_t* ip );
57
-
58
-
59
-//=================================================================
60
-// Pitch conversion
61
-unsigned cmHzToMidi( double hz );
62
-float    cmMidiToHz( unsigned midi );
63
-
64
-//=================================================================
65
-// Floating point byte swapping
66
-unsigned           cmFfSwapFloatToUInt( float v );
67
-float              cmFfSwapUIntToFloat( unsigned v );
68
-unsigned long long cmFfSwapDoubleToULLong( double v );
69
-double             cmFfSwapULLongToDouble( unsigned long long v );
70
-
71
-//=================================================================
72
-int      cmRandInt( int min, int max );
73
-unsigned cmRandUInt( unsigned min, unsigned max );
74
-float    cmRandFloat( float min, float max );
75
-double   cmRandDouble( double min, double max );
76
-
77
-//=================================================================
78
-bool cmIsCloseD( double   x0, double   x1, double eps );
79
-bool cmIsCloseF( float    x0, float    x1, double eps );
80
-bool cmIsCloseI( int      x0, int      x1, double eps );
81
-bool cmIsCloseU( unsigned x0, unsigned x1, double eps );
82
-
83
-//=================================================================
84
-// Run a length 'lfsrN' linear feedback shift register (LFSR) for 'yN' iterations to
85
-// produce a length 'yN' bit string in yV[yN].
86
-// 'lfsrN' count of bits in the shift register range: 2<= lfsrN <= 32.
87
-// 'tapMask' is a bit mask which gives the tap indexes positions for the LFSR. 
88
-// The least significant bit corresponds to the maximum delay tap position.  
89
-// The min tap position is therefore denoted by the tap mask bit location 1 << (lfsrN-1).
90
-// A minimum of two taps must exist.
91
-// 'seed' sets the initial delay state.
92
-// 'yV[yN]' is the the output vector
93
-// 'yN' is count of elements in yV.
94
-// The function resturn kOkAtRC on success or kInvalidArgsRCRC if any arguments are invalid.
95
-// /sa cmLFSR_Test.
96
-void   cmLFSR( unsigned lfsrN, unsigned tapMask, unsigned seed, unsigned* yV, unsigned yN );
97
-
98
-// Example and test code for cmLFSR() 
99
-bool cmLFSR_Test();
100
-
101
-
102
-// Generate a set of 'goldN' Gold codes using the Maximum Length Sequences (MLS) generated
103
-// by a length 'lfsrN' linear feedback shift register.
104
-// 'err' is an error object to be set if the the function fails.
105
-// 'lfsrN' is the length of the Linear Feedback Shift Registers (LFSR) used to generate the MLS.
106
-// 'poly_coeff0' tap mask for the first LFSR.
107
-// 'coeff1' tap mask the the second LFSR.
108
-// 'goldN' is the count of Gold codes to generate. 
109
-// 'yM[mlsN', goldN] is a column major output matrix where each column contains a Gold code.
110
-// 'mlsN' is the length of the maximum length sequence for each Gold code which can be
111
-// calculated as mlsN = (1 << a->lfsrN) - 1.
112
-// Note that values of 'lfsrN' and the 'poly_coeffx' must be carefully selected such that
113
-// they will produce a MLS.  For example to generate a MLS with length 31 set 'lfsrN' to 5 and
114
-// then select poly_coeff from two different elements of the set {0x12 0x14 0x17 0x1B 0x1D 0x1E}.
115
-// See http://www.ece.cmu.edu/~koopman/lfsr/index.html for a complete set of MSL polynomial
116
-// coefficients for given LFSR lengths.
117
-// Returns false if insufficient balanced pairs exist.
118
-bool   cmGenGoldCodes( unsigned lfsrN, unsigned poly_coeff0, unsigned poly_coeff1, unsigned goldN, int* yM, unsigned mlsN  );
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+  //( { file_desc:"Math utility functions" kw:[math] }
9
+  
10
+  double   cmX80ToDouble( unsigned char s[10] );
11
+  void     cmDoubleToX80( double v, unsigned char s[10] );
12
+
13
+  bool     cmIsPowerOfTwo(   unsigned i );
14
+  unsigned cmNextPowerOfTwo( unsigned i );
15
+  unsigned cmNearPowerOfTwo( unsigned i );
16
+
17
+  bool     cmIsOddU(    unsigned v );
18
+  bool     cmIsEvenU(   unsigned v );
19
+  unsigned cmNextOddU(  unsigned v );
20
+  unsigned cmPrevOddU(  unsigned v );
21
+  unsigned cmNextEvenU( unsigned v );
22
+  unsigned cmPrevEvenU( unsigned v );
23
+
24
+  /// Increment or decrement 'idx' by 'delta' always wrapping the result into the range
25
+  /// 0 to (maxN-1).
26
+  /// 'idx': initial value 
27
+  /// 'delta':  incremental amount
28
+  /// 'maxN' - 1 : maximum return value.
29
+  unsigned cmModIncr(int idx, int delta, int maxN );
30
+
31
+  // modified bessel function of first kind, order 0
32
+  // ref: orfandis appendix B io.m
33
+  double   cmBessel0( double x );
34
+
35
+
36
+  //=================================================================
37
+  // The following elliptic-related function approximations come from
38
+  // Parks & Burrus, Digital Filter Design, Appendix program 9, pp. 317-326
39
+  // which in turn draws directly on other sources
40
+
41
+  // calculate complete elliptic integral (quarter period) K
42
+  // given *complimentary* modulus kc
43
+  cmReal_t cmEllipK( cmReal_t kc );
44
+
45
+  // calculate elliptic modulus k
46
+  // given ratio of complete elliptic integrals r = K/K'
47
+  // (solves the "degree equation" for fixed N = K*K1'/K'K1)
48
+  cmReal_t cmEllipDeg( cmReal_t r );
49
+
50
+  // calculate arc elliptic tangent u (elliptic integral of the 1st kind)
51
+  // given argument x = sc(u,k) and *complimentary* modulus kc
52
+  cmReal_t cmEllipArcSc( cmReal_t x, cmReal_t kc );
53
+
54
+  // calculate Jacobi elliptic functions sn, cn, and dn
55
+  // given argument u and *complimentary* modulus kc
56
+  cmRC_t   cmEllipJ( cmReal_t u, cmReal_t kc, cmReal_t* sn, cmReal_t* cn, cmReal_t* dn );
57
+
58
+
59
+  //=================================================================
60
+  // bilinear transform
61
+  // z = (2*sr + s)/(2*sr - s)
62
+  cmRC_t cmBlt( unsigned n, cmReal_t sr, cmReal_t* rp, cmReal_t* ip );
63
+
64
+
65
+  //=================================================================
66
+  // Pitch conversion
67
+  unsigned cmHzToMidi( double hz );
68
+  float    cmMidiToHz( unsigned midi );
69
+
70
+  //=================================================================
71
+  // Floating point byte swapping
72
+  unsigned           cmFfSwapFloatToUInt( float v );
73
+  float              cmFfSwapUIntToFloat( unsigned v );
74
+  unsigned long long cmFfSwapDoubleToULLong( double v );
75
+  double             cmFfSwapULLongToDouble( unsigned long long v );
76
+
77
+  //=================================================================
78
+  int      cmRandInt( int min, int max );
79
+  unsigned cmRandUInt( unsigned min, unsigned max );
80
+  float    cmRandFloat( float min, float max );
81
+  double   cmRandDouble( double min, double max );
82
+
83
+  //=================================================================
84
+  bool cmIsCloseD( double   x0, double   x1, double eps );
85
+  bool cmIsCloseF( float    x0, float    x1, double eps );
86
+  bool cmIsCloseI( int      x0, int      x1, double eps );
87
+  bool cmIsCloseU( unsigned x0, unsigned x1, double eps );
88
+
89
+  //=================================================================
90
+  // Run a length 'lfsrN' linear feedback shift register (LFSR) for 'yN' iterations to
91
+  // produce a length 'yN' bit string in yV[yN].
92
+  // 'lfsrN' count of bits in the shift register range: 2<= lfsrN <= 32.
93
+  // 'tapMask' is a bit mask which gives the tap indexes positions for the LFSR. 
94
+  // The least significant bit corresponds to the maximum delay tap position.  
95
+  // The min tap position is therefore denoted by the tap mask bit location 1 << (lfsrN-1).
96
+  // A minimum of two taps must exist.
97
+  // 'seed' sets the initial delay state.
98
+  // 'yV[yN]' is the the output vector
99
+  // 'yN' is count of elements in yV.
100
+  // The function resturn kOkAtRC on success or kInvalidArgsRCRC if any arguments are invalid.
101
+  // /sa cmLFSR_Test.
102
+  void   cmLFSR( unsigned lfsrN, unsigned tapMask, unsigned seed, unsigned* yV, unsigned yN );
103
+
104
+  // Example and test code for cmLFSR() 
105
+  bool cmLFSR_Test();
106
+
107
+
108
+  // Generate a set of 'goldN' Gold codes using the Maximum Length Sequences (MLS) generated
109
+  // by a length 'lfsrN' linear feedback shift register.
110
+  // 'err' is an error object to be set if the the function fails.
111
+  // 'lfsrN' is the length of the Linear Feedback Shift Registers (LFSR) used to generate the MLS.
112
+  // 'poly_coeff0' tap mask for the first LFSR.
113
+  // 'coeff1' tap mask the the second LFSR.
114
+  // 'goldN' is the count of Gold codes to generate. 
115
+  // 'yM[mlsN', goldN] is a column major output matrix where each column contains a Gold code.
116
+  // 'mlsN' is the length of the maximum length sequence for each Gold code which can be
117
+  // calculated as mlsN = (1 << a->lfsrN) - 1.
118
+  // Note that values of 'lfsrN' and the 'poly_coeffx' must be carefully selected such that
119
+  // they will produce a MLS.  For example to generate a MLS with length 31 set 'lfsrN' to 5 and
120
+  // then select poly_coeff from two different elements of the set {0x12 0x14 0x17 0x1B 0x1D 0x1E}.
121
+  // See http://www.ece.cmu.edu/~koopman/lfsr/index.html for a complete set of MSL polynomial
122
+  // coefficients for given LFSR lengths.
123
+  // Returns false if insufficient balanced pairs exist.
124
+  bool   cmGenGoldCodes( unsigned lfsrN, unsigned poly_coeff0, unsigned poly_coeff1, unsigned goldN, int* yM, unsigned mlsN  );
125
+
126
+  //)
127
+  
128
+#ifdef __cplusplus
129
+}
130
+#endif
119 131
 
120 132
 #endif

+ 8
- 6
cmMem.h Voir le fichier

@@ -1,6 +1,4 @@
1
-//{
2
-//(
3
-// The cmMem class implements a memory allocation manager interface.
1
+//( { file_desc: "Implements a memory allocation manager interface." kw:[ base ]}
4 2
 //
5 3
 //
6 4
 // Using cmMem allows memory leaks and some instances of memory corruption 
@@ -19,13 +17,16 @@
19 17
 // 1. A client memory manager creates and configures a cmMm object via cmMmInitialize().
20 18
 // As part of the configuration the client gives callback functions which implement
21 19
 // actual memory allocation and release.  In practice this means the callback probably
22
-// call malloc() or free(). 
20
+// call malloc() or free().
21
+//
23 22
 // 2. At some point later when the client needs to allocate a block of memory it calls
24 23
 // cmMmAllocate() with the size of the requested block.  cmMm translates this request
25 24
 // into a call to the client provided memory allocation callback to get a block of raw
26 25
 // memory which is slightly larger than the request block.
26
+//
27 27
 // 3. Given the raw memory block cmMm conditions it in the following ways and returns
28 28
 // it to the client.
29
+//
29 30
 // * The base of the blocks data area is shifted such that it is has an arbitrary 
30 31
 // address aligned according to the value set by the alignByteCnt parameter to cmMmInitialize().
31 32
 // Address aligment is sometimes required by routines which make use of the the SIMD
@@ -54,9 +55,11 @@
54 55
 // writes to freed memory areas.  When deferred release is enabled the freeFunc() is not called
55 56
 // on any blocks until cmMmFinalize().  If the program continually allocates memory over the 
56 57
 // life of the program this may mean that the program will eventually exhaust physical memory.
58
+//
57 59
 // 2. If tracking is enabled (kTrackMmFl) then the block pointer is looked up in the internal database.
58 60
 // If the pointer is not found then a kMissingRecdRC is returned indicating an attempt to release
59
-// a non-allocated block.  
61
+// a non-allocated block.
62
+//
60 63
 // 3. If tracking is enabled (kTrackMmFl) then the block is marked as released in the 
61 64
 // internal tracking database. At the end of the program all blocks should be marked for release
62 65
 // otherwise they are considered leaks.  
@@ -223,7 +226,6 @@ extern "C" {
223 226
   cmMmRC_t cmMmCheckAllGuards( cmMmH_t h );
224 227
 
225 228
   //)
226
-  //}
227 229
 #ifdef __cplusplus
228 230
 }
229 231
 #endif

+ 4
- 0
cmMidi.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"MIDI utility constants and functions." kw:[midi]}
9
+  
8 10
   enum
9 11
   {
10 12
     kMidiChCnt           = 16,
@@ -154,6 +156,8 @@ extern "C" {
154 156
   // of this range will be returned as kInvalidMidiPitch.   
155 157
   cmMidiByte_t    cmSciPitchToMidi( const char* sciPitchStr );
156 158
 
159
+  //)
160
+  
157 161
 #ifdef __cplusplus
158 162
 }
159 163
 #endif

+ 118
- 105
cmMidiFile.c Voir le fichier

@@ -246,7 +246,7 @@ cmMfRC_t _cmMidiFileReadChannelMsg( _cmMidiFile_t* mfp, cmMidiByte_t* rsPtr, cmM
246 246
   tmp->byteCnt = sizeof(cmMidiChMsg_t);
247 247
   tmp->status  = statusCh & 0xf0;
248 248
   p->ch        = statusCh & 0x0f;
249
-  p->durTicks  = 0;
249
+  p->durMicros = 0;
250 250
 
251 251
   unsigned byteN = cmMidiStatusToByteCount(tmp->status);
252 252
   
@@ -416,8 +416,6 @@ cmMfRC_t _cmMidiFileReadHdr( _cmMidiFile_t* mfp )
416 416
 
417 417
 int _cmMidiFileSortFunc( const void *p0, const void* p1 )
418 418
 {  
419
-  //printf("%i %i\n",(*(cmMidiTrackMsg_t**)p0)->dticks,(*(cmMidiTrackMsg_t**)p1)->dticks);
420
-
421 419
   if( (*(cmMidiTrackMsg_t**)p0)->atick == (*(cmMidiTrackMsg_t**)p1)->atick )
422 420
     return 0;
423 421
 
@@ -526,12 +524,20 @@ cmMfRC_t cmMidiFileOpen( const char* fn, cmMidiFileH_t* hPtr, cmCtx_t* ctx )
526 524
   // store a pointer to every trk msg in msgV[] 
527 525
   // and convert tick to absolute tick
528 526
   mfp->nextUid = 0;
527
+
528
+  double microsPerQN  = 60000000/120; // default tempo;
529
+  double microsPerTick;
530
+  
529 531
   unsigned i = 0;
530 532
   for(trkIdx=0; trkIdx<mfp->trkN; ++trkIdx)
531 533
   {
532 534
     unsigned        tick = 0;
533 535
     cmMidiTrackMsg_t* tmp  = mfp->trkV[ trkIdx ].base;
534 536
 
537
+    
538
+    microsPerTick = microsPerQN / mfp->ticksPerQN;
539
+  
540
+    
535 541
     while( tmp != NULL )
536 542
     {
537 543
       assert( i < mfp->msgN);
@@ -540,6 +546,14 @@ cmMfRC_t cmMidiFileOpen( const char* fn, cmMidiFileH_t* hPtr, cmCtx_t* ctx )
540 546
       tmp->atick     = tick;
541 547
       tmp->uid       = mfp->nextUid++; // assign the msg uid
542 548
       mfp->msgV[i]   = tmp;
549
+
550
+      // track tempo changes
551
+      if( tmp->status == kMetaStId && tmp->metaId == kTempoMdId )
552
+        microsPerTick = tmp->u.iVal / mfp->ticksPerQN;
553
+
554
+      // convert dtick to microseconds
555
+      tmp->dmicro = round(tmp->dtick * microsPerTick);
556
+      
543 557
       tmp            = tmp->link;
544 558
       ++i;
545 559
     }  
@@ -548,6 +562,31 @@ cmMfRC_t cmMidiFileOpen( const char* fn, cmMidiFileH_t* hPtr, cmCtx_t* ctx )
548 562
   // sort msgV[] in ascending order on atick
549 563
   qsort( mfp->msgV, mfp->msgN, sizeof(cmMidiTrackMsg_t*), _cmMidiFileSortFunc );
550 564
 
565
+  // set the amicro field of each midi message to the
566
+  // absolute time offset in microseconds
567
+  unsigned mi;
568
+  unsigned amicro = 0;
569
+  microsPerTick = microsPerQN / mfp->ticksPerQN;
570
+
571
+  for(mi=0; mi<mfp->msgN; ++mi)
572
+  {
573
+    cmMidiTrackMsg_t* mp = mfp->msgV[mi];
574
+
575
+    // track tempo changes
576
+    if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
577
+      microsPerTick = mp->u.iVal / mfp->ticksPerQN;
578
+
579
+    unsigned dtick = 0;
580
+    if( mi > 0 )
581
+    {
582
+      assert( mp->atick >= mfp->msgV[mi-1]->atick );
583
+      dtick = mp->atick -  mfp->msgV[mi-1]->atick;
584
+    }
585
+    
586
+    amicro += round(microsPerTick*dtick);
587
+    mp->amicro = amicro;
588
+  }
589
+  
551 590
   //for(i=0; i<25; ++i)
552 591
   //  printf("%i 0x%x 0x%x\n",mfp->msgV[i]->tick,mfp->msgV[i]->status,mfp->msgV[i]->metaId);
553 592
 
@@ -1054,15 +1093,25 @@ unsigned  cmMidiFileSeekUsecs( cmMidiFileH_t h, unsigned offsUSecs, unsigned* ms
1054 1093
   for(mi=0; mi<p->msgN; ++mi)
1055 1094
   {
1056 1095
     const cmMidiTrackMsg_t* mp = p->msgV[mi];
1057
-
1096
+    /*
1058 1097
     if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
1059 1098
       microsPerTick = mp->u.iVal / p->ticksPerQN;
1060 1099
 
1061
-    accUSecs += mp->dtick * microsPerTick ;
1100
+    unsigned dtick = 0;
1101
+    if( mi > 0 )
1102
+    {
1103
+      assert( mp->atick >= p->msgV[mi-1]->atick )
1104
+      dtick = mp->atick - p->msgV[mi-1]->atick;
1105
+    }
1106
+    
1107
+    accUSecs += dtick * microsPerTick ;
1062 1108
 
1063 1109
     if( accUSecs >= offsUSecs )
1064 1110
       break;
1111
+    */
1065 1112
 
1113
+    if( mp->amicro >= offsUSecs )
1114
+      break;
1066 1115
   }
1067 1116
   
1068 1117
   if( mi == p->msgN )
@@ -1080,92 +1129,17 @@ unsigned  cmMidiFileSeekUsecs( cmMidiFileH_t h, unsigned offsUSecs, unsigned* ms
1080 1129
 double  cmMidiFileDurSecs( cmMidiFileH_t h )
1081 1130
 {
1082 1131
   _cmMidiFile_t* mfp           = _cmMidiFileHandleToPtr(h);
1083
-  unsigned       mi;
1084
-  double         durSecs       = 0;
1085
-  double         r             = 1.0; //1000.0/(1000-.8);
1086
-  double         microsPerQN   = r*60000000.0/120.0;
1087
-  double         microsPerTick = microsPerQN / mfp->ticksPerQN;
1088
-
1089
-  for(mi=0; mi<mfp->msgN; ++mi)
1090
-  {
1091
-    cmMidiTrackMsg_t* mp = mfp->msgV[mi];
1092
-
1093
-    if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
1094
-      microsPerTick = r*mp->u.iVal / mfp->ticksPerQN;
1095
-
1096
-    // update the accumulated seconds
1097
-    durSecs += (mp->dtick * microsPerTick) / 1000000.0;
1098
-
1099
-  }
1100
-
1101
-  return durSecs;
1102
-}
1103
-
1104
-void cmMidiFileTickToMicros( cmMidiFileH_t h )
1105
-{
1106
-  _cmMidiFile_t* p;
1107
-
1108
-  if((p = _cmMidiFileHandleToPtr(h)) == NULL )
1109
-    return;
1110
-
1111
-  if( p->msgN == 0 )
1112
-    return;
1113
-
1114
-  unsigned mi;
1115
-  double r             = 1.0; //1000.0/(1000-.8);
1116
-  double microsPerQN   = r*60000000/120; // default tempo
1117
-  double microsPerTick = microsPerQN / p->ticksPerQN;
1118
-
1119
-  for(mi=0; mi<p->msgN; ++mi)
1120
-  {
1121
-    cmMidiTrackMsg_t* mp = p->msgV[mi];
1122
-
1123
-    if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
1124
-      microsPerTick = r*mp->u.iVal / p->ticksPerQN;
1125
-
1126
-    mp->dtick = round(microsPerTick*mp->dtick);
1127
-  }
1128
-  
1129
-}
1130
-
1131
-void cmMidiFileTickToSamples( cmMidiFileH_t h, double srate, bool absFl )
1132
-{
1133
-  _cmMidiFile_t* p;
1134 1132
 
1135
-  if((p = _cmMidiFileHandleToPtr(h)) == NULL )
1136
-    return;
1137
-
1138
-  if( p->msgN == 0 )
1139
-    return;
1140
-
1141
-  unsigned mi;
1142
-  double r             = 1.0; //1000.0/(1000-.8);
1143
-  double microsPerQN   = r*60000000/120; // default tempo
1144
-  double microsPerTick = microsPerQN / p->ticksPerQN;
1145
-  double absSmp = 0;
1146
-
1147
-  for(mi=0; mi<p->msgN; ++mi)
1148
-  {
1149
-    cmMidiTrackMsg_t* mp = p->msgV[mi];
1150
-
1151
-    if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
1152
-      microsPerTick = r*mp->u.iVal / p->ticksPerQN;
1153
-
1154
-    double delta = microsPerTick*mp->dtick*srate/1000000.0;
1155
-
1156
-    absSmp += delta;
1157
-
1158
-    mp->dtick  = round(absFl ? absSmp : delta);
1159
-
1160
-  }
1133
+  if( mfp->msgN == 0 )
1134
+    return 0;
1161 1135
   
1136
+  return mfp->msgV[ mfp->msgN-1 ]->amicro / 1000000.0;
1162 1137
 }
1163 1138
 
1164
-
1165 1139
 typedef struct _cmMidiVoice_str
1166 1140
 {
1167 1141
   const  cmMidiTrackMsg_t*  mp;
1168
-  unsigned                  durTicks;
1142
+  unsigned                  durMicros;
1169 1143
   bool                      sustainFl;
1170 1144
   struct _cmMidiVoice_str*  link;
1171 1145
 } _cmMidiVoice_t;
@@ -1178,7 +1152,7 @@ void _cmMidFileCalcNoteDurationReleaseNote( _cmMidiVoice_t** listPtrPtr, _cmMidi
1178 1152
   // store the duration of the note into the track msg 
1179 1153
   // assoc'd with the note-on msg
1180 1154
   cmMidiChMsg_t* cmp = (cmMidiChMsg_t*)vp->mp->u.chMsgPtr; // cast away const
1181
-  cmp->durTicks = vp->durTicks;
1155
+  cmp->durMicros = vp->durMicros;
1182 1156
 
1183 1157
   _cmMidiVoice_t* np = vp->link;
1184 1158
 
@@ -1226,13 +1200,20 @@ void cmMidiFileCalcNoteDurations( cmMidiFileH_t h )
1226 1200
   {
1227 1201
     cmMidiTrackMsg_t* mp    = p->msgV[mi];
1228 1202
 
1203
+    unsigned d_amicro = 0;
1204
+    if( mi > 0 )
1205
+    {
1206
+      assert(    mp->amicro >= p->msgV[mi-1]->amicro );
1207
+      d_amicro = mp->amicro -  p->msgV[mi-1]->amicro;
1208
+    }
1209
+    
1229 1210
     // update the duration of the sounding notes
1230 1211
     for(vp = list; vp!=NULL; vp=vp->link)
1231
-      vp->durTicks += mp->dtick;    
1212
+      vp->durMicros += d_amicro;    
1232 1213
 
1233 1214
     // update the sustain pedal duration
1234 1215
     if( sustainPedalDownMsg != NULL )
1235
-      ((cmMidiChMsg_t*)(sustainPedalDownMsg->u.chMsgPtr))->durTicks += mp->dtick;  // cast away const
1216
+      ((cmMidiChMsg_t*)(sustainPedalDownMsg->u.chMsgPtr))->durMicros += d_amicro;  // cast away const
1236 1217
 
1237 1218
     //
1238 1219
     // If this is sustain pedal msg
@@ -1257,7 +1238,7 @@ void cmMidiFileCalcNoteDurations( cmMidiFileH_t h )
1257 1238
         else
1258 1239
         {
1259 1240
           sustainPedalDownMsg = mp;
1260
-          ((cmMidiChMsg_t*)(sustainPedalDownMsg->u.chMsgPtr))->durTicks = 0;  // cast away const
1241
+          ((cmMidiChMsg_t*)(sustainPedalDownMsg->u.chMsgPtr))->durMicros = 0;  // cast away const
1261 1242
         }
1262 1243
 
1263 1244
         _cmMidiFileCalcNoteDurationsAllocVoice( &list, mp, true );
@@ -1389,16 +1370,51 @@ cmMidiTrackMsg_t*     cmMidiFilePackTrackMsg( const cmMidiTrackMsg_t* m, void* b
1389 1370
   return (cmMidiTrackMsg_t*)buf;
1390 1371
 }
1391 1372
 
1392
-
1393
-
1394
-void cmMidiFilePrint( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt )
1373
+void _cmMidiFilePrintHdr( const _cmMidiFile_t* mfp, cmRpt_t* rpt )
1395 1374
 {
1396
-  const _cmMidiFile_t* mfp = _cmMidiFileHandleToPtr(h);
1397
-
1398 1375
   if( mfp->fn != NULL )
1399 1376
     cmRptPrintf(rpt,"%s ",mfp->fn);
1400 1377
 
1401 1378
   cmRptPrintf(rpt,"fmt:%i ticksPerQN:%i tracks:%i\n",mfp->fmtId,mfp->ticksPerQN,mfp->trkN);
1379
+}
1380
+
1381
+void _cmMidiFilePrintMsg( cmRpt_t* rpt, const cmMidiTrackMsg_t* tmp )
1382
+{
1383
+  cmRptPrintf(rpt,"%8i %8i %8i %8i : ",   tmp->dtick, tmp->dmicro, tmp->atick, tmp->amicro );
1384
+
1385
+  if( tmp->status == kMetaStId )
1386
+    cmRptPrintf(rpt,"%s ", cmMidiMetaStatusToLabel(tmp->metaId)); 
1387
+  else
1388
+  {
1389
+    cmRptPrintf(rpt,"%4s %3i %3i %3i", cmMidiStatusToLabel(tmp->status),tmp->u.chMsgPtr->ch,tmp->u.chMsgPtr->d0,tmp->u.chMsgPtr->d1);
1390
+    
1391
+  }
1392
+  
1393
+  cmRptPrintf(rpt,"\n");
1394
+}
1395
+
1396
+void cmMidiFilePrintMsgs( cmMidiFileH_t h, cmRpt_t* rpt )
1397
+{
1398
+  const _cmMidiFile_t* p = _cmMidiFileHandleToPtr(h);
1399
+  unsigned mi;
1400
+  
1401
+  _cmMidiFilePrintHdr(p,rpt);
1402
+
1403
+  for(mi=0; mi<p->msgN; ++mi)
1404
+  {
1405
+    cmMidiTrackMsg_t* mp = p->msgV[mi];
1406
+
1407
+    if( mp != NULL )
1408
+      _cmMidiFilePrintMsg(rpt,mp);
1409
+  }
1410
+  
1411
+}
1412
+
1413
+void cmMidiFilePrintTracks( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt )
1414
+{
1415
+  const _cmMidiFile_t* mfp = _cmMidiFileHandleToPtr(h);
1416
+
1417
+  _cmMidiFilePrintHdr(mfp,rpt);
1402 1418
 
1403 1419
   int i = trkIdx == cmInvalidIdx ? 0         : trkIdx;
1404 1420
   int n = trkIdx == cmInvalidIdx ? mfp->trkN : trkIdx+1;
@@ -1410,17 +1426,7 @@ void cmMidiFilePrint( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt )
1410 1426
     cmMidiTrackMsg_t* tmp = mfp->trkV[i].base;
1411 1427
     while( tmp != NULL )
1412 1428
     {
1413
-      cmRptPrintf(rpt,"%5i ", tmp->dtick );
1414
-
1415
-      if( tmp->status == kMetaStId )
1416
-        cmRptPrintf(rpt,"%s ", cmMidiMetaStatusToLabel(tmp->metaId)); 
1417
-      else
1418
-      {
1419
-        cmRptPrintf(rpt,"%4s %3i %3i %3i", cmMidiStatusToLabel(tmp->status),tmp->u.chMsgPtr->ch,tmp->u.chMsgPtr->d0,tmp->u.chMsgPtr->d1);
1420
-        
1421
-      }
1422
-
1423
-      cmRptPrintf(rpt,"\n");
1429
+      _cmMidiFilePrintMsg(rpt,tmp);
1424 1430
       tmp = tmp->link;
1425 1431
     }
1426 1432
   }  
@@ -1475,7 +1481,14 @@ void cmMidiFileTest( const char* fn, cmCtx_t* ctx )
1475 1481
     return;
1476 1482
   }
1477 1483
 
1478
-  if(1)
1484
+  if( 1 )
1485
+  {
1486
+    //cmMidiFileTickToMicros( h );
1487
+    //cmMidiFileTickToSamples(h,96000,false);
1488
+    cmMidiFilePrintMsgs(h,&ctx->rpt);
1489
+  }
1490
+
1491
+  if( 0 )
1479 1492
   {
1480 1493
     //cmMidiFilePrint(h,cmMidiFileTrackCount(h)-1,&ctx->rpt);
1481 1494
     //cmMidiFilePrint(h,cmInvalidIdx,&ctx->rpt);

+ 13
- 14
cmMidiFile.h Voir le fichier

@@ -5,6 +5,7 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"MIDI file reader and writer." kw:[midi file]}  
8 9
   // MIDI file timing:
9 10
   // Messages in the MIDI file are time tagged with a delta offset in 'ticks'
10 11
   // from the previous message in the same track.
@@ -22,9 +23,9 @@ extern "C" {
22 23
   //
23 24
   // As part of the file reading process, the status byte of note-on messages 
24 25
   // with velocity=0 are is changed to a note-off message. See _cmMidiFileReadChannelMsg().
25
-
26
-
27
-
26
+  //)
27
+  
28
+  //(
28 29
   typedef cmHandle_t cmMidiFileH_t;
29 30
   typedef unsigned   cmMfRC_t;
30 31
 
@@ -56,15 +57,17 @@ extern "C" {
56 57
     cmMidiByte_t ch;
57 58
     cmMidiByte_t d0;
58 59
     cmMidiByte_t d1;
59
-    unsigned     durTicks; // note duration calc'd by cmMidiFileCalcNoteDurations();
60
+    unsigned     durMicros;  // note duration in microseconds (corrected for tempo changes)
60 61
   } cmMidiChMsg_t;
61 62
 
62 63
 
63 64
   typedef struct cmMidiTrackMsg_str
64 65
   {
65 66
     unsigned                   uid;     // uid's are unique among all msg's in the file
66
-    unsigned                   dtick;   // delta ticks
67
-    unsigned                   atick;   // accumulated ticks
67
+    unsigned                   dtick;   // delta ticks between events on this track
68
+    unsigned                   dmicro;  // delta microseconds between events on this track adjusted for tempo changes
69
+    unsigned                   atick;   // global (all tracks interleaved) accumulated ticks
70
+    unsigned                   amicro;  // global (all tracks interleaved) accumulated microseconds adjusted for tempo changes
68 71
     cmMidiByte_t               status;  // ch msg's have the channel value removed (it is stored in u.chMsgPtr->ch)
69 72
     cmMidiByte_t               metaId;  //
70 73
     unsigned short             trkIdx;  //  
@@ -152,13 +155,6 @@ extern "C" {
152 155
 
153 156
   double                cmMidiFileDurSecs( cmMidiFileH_t h );
154 157
 
155
-  // Convert the track message 'dtick' field to delta-microseconds.
156
-  void                  cmMidiFileTickToMicros( cmMidiFileH_t h );
157
-
158
-  // Convert the track message 'dtick' field to samples.
159
-  // If the absFl is set then the delta times are converted to absolute time.
160
-  void                  cmMidiFileTickToSamples( cmMidiFileH_t h, double srate, bool absFl );
161
-
162 158
   // Calculate Note Duration 
163 159
   void                  cmMidiFileCalcNoteDurations( cmMidiFileH_t h );
164 160
 
@@ -171,10 +167,13 @@ extern "C" {
171 167
   cmMidiTrackMsg_t*     cmMidiFilePackTrackMsg( const cmMidiTrackMsg_t* m, void* buf, unsigned bufByteCnt );
172 168
   unsigned              cmMidiFilePackTrackMsgBufByteCount( const cmMidiTrackMsg_t* m );
173 169
 
174
-  void                  cmMidiFilePrint( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt );
170
+  void                  cmMidiFilePrintMsgs( cmMidiFileH_t h, cmRpt_t* rpt );
171
+  void                  cmMidiFilePrintTrack( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt );
175 172
   bool                  cmMidiFileIsNull( cmMidiFileH_t h );
176 173
   void                  cmMidiFileTest( const char* fn, cmCtx_t* ctx );
177 174
 
175
+  //)
176
+  
178 177
 #ifdef __cplusplus
179 178
 }
180 179
 #endif

+ 7
- 14
cmMidiFilePlay.c Voir le fichier

@@ -148,9 +148,6 @@ cmMfpRC_t cmMfpLoadHandle( cmMfpH_t h, cmMidiFileH_t mfH )
148 148
   p->mtime      = 0;
149 149
   p->closeFileFl= false;
150 150
 
151
-  //if( p->msgIdx > 0 )
152
-  //  p->mtime = p->msgV[0]->tick * p->microsPerTick;
153
-
154 151
   return kOkMfpRC;
155 152
 }
156 153
 
@@ -213,35 +210,31 @@ cmMfpRC_t cmMfpClock(  cmMfpH_t h, unsigned dusecs )
213 210
   // sent and the end of the time window for this mfpClock() cycle
214 211
   p->etime += dusecs;
215 212
 
216
-  //printf("init e:%i d:%i\n",p->etime, p->mtime);
217
-
218 213
   // if the elapsed time (etime) since the last msg is greater or equal
219 214
   // to the delta time to the next msg (mtime)
220 215
   while( p->etime >= p->mtime )
221 216
   {      
222
-    //printf("e:%i d:%i\n",p->etime, p->mtime);
223 217
 
224
-    if( mp->status == kMetaStId && mp->metaId == kTempoMdId )
225
-      _cmMfpUpdateMicrosPerTick(p,mp->u.iVal );
226
-    
227
-    
218
+    // send the current message
228 219
     p->cbFunc( p->userCbPtr, p->mtime, mp );
229
-      
220
+
221
+    unsigned amicro = mp->amicro;
222
+    
230 223
     ++(p->msgIdx);
231 224
 
232 225
     if( p->msgIdx >= p->msgN )
233 226
       break;
234 227
 
235 228
     // get the next msg to send
236
-    mp        = p->msgV[p->msgIdx];
229
+    mp   = p->msgV[p->msgIdx];
230
+
237 231
 
238 232
     // we probably went past the actual mtime - so update etime
239 233
     // with the delta usecs from the msg just sent and the current time
240 234
     p->etime -= p->mtime;
241 235
 
242 236
     // calc the delta usecs from the message just sent to the next msg to send
243
-    //p->mtime  = (mp->tick - p->msgV[p->msgIdx-1]->tick) * p->microsPerTick;
244
-    p->mtime  = mp->dtick * p->microsPerTick;
237
+    p->mtime  = mp->amicro - amicro;
245 238
 
246 239
   }
247 240
 

+ 41
- 37
cmMidiFilePlay.h Voir le fichier

@@ -5,53 +5,57 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-typedef cmHandle_t cmMfpH_t;
9
-typedef cmRC_t     cmMfpRC_t;
10
-
11
-typedef void (*cmMfpCallback_t)( void* userCbPtr, unsigned dmicros, const cmMidiTrackMsg_t* msgPtr );
12
-
13
-enum
14
-{
15
-  kOkMfpRC = cmOkRC,            // 0
16
-  kInvalidHandleMfpRC,          // 1
17
-  kFileOpenFailMfpRC,           // 2 
18
-  kInvalidFileMfpRC,            // 3
19
-  kMemAllocFailMfpRC,           // 4
20
-  kSmpteTickNotImpleMfpRC,      // 5
21
-  kEndOfFileMfpRC,              // 6
22
-  kSmpteTickNotImplMfpRC        // 7
8
+  //( { file_desc:"Device indepenent MIDI file player." kw:[midi]}
23 9
   
24
-};
10
+  typedef cmHandle_t cmMfpH_t;
11
+  typedef cmRC_t     cmMfpRC_t;
12
+
13
+  typedef void (*cmMfpCallback_t)( void* userCbPtr, unsigned dmicros, const cmMidiTrackMsg_t* msgPtr );
14
+
15
+  enum
16
+  {
17
+    kOkMfpRC = cmOkRC,            // 0
18
+    kInvalidHandleMfpRC,          // 1
19
+    kFileOpenFailMfpRC,           // 2 
20
+    kInvalidFileMfpRC,            // 3
21
+    kMemAllocFailMfpRC,           // 4
22
+    kSmpteTickNotImpleMfpRC,      // 5
23
+    kEndOfFileMfpRC,              // 6
24
+    kSmpteTickNotImplMfpRC        // 7
25
+  
26
+  };
25 27
 
26
-extern cmMfpH_t cmMfpNullHandle;
28
+  extern cmMfpH_t cmMfpNullHandle;
27 29
 
28
-cmMfpRC_t cmMfpCreate(     cmMfpH_t* hp, cmMfpCallback_t cbFunc, void* userCbPtr, cmCtx_t* ctx );
29
-cmMfpRC_t cmMfpDestroy(    cmMfpH_t* hp );
30
-bool      cmMfpIsValid(    cmMfpH_t h );
30
+  cmMfpRC_t cmMfpCreate(     cmMfpH_t* hp, cmMfpCallback_t cbFunc, void* userCbPtr, cmCtx_t* ctx );
31
+  cmMfpRC_t cmMfpDestroy(    cmMfpH_t* hp );
32
+  bool      cmMfpIsValid(    cmMfpH_t h );
31 33
 
32
-// Load a MIDI file into the player. This MIDI file will be automatically
33
-// closed when a new file is loaded at a later time or the MIDI file player handle is destroyed.
34
-cmMfpRC_t cmMfpLoadFile(   cmMfpH_t h, const char* fn );
34
+  // Load a MIDI file into the player. This MIDI file will be automatically
35
+  // closed when a new file is loaded at a later time or the MIDI file player handle is destroyed.
36
+  cmMfpRC_t cmMfpLoadFile(   cmMfpH_t h, const char* fn );
35 37
 
36
-// Load a MIDI file into the player using a file owned by the host.
37
-// This file will NOT be closed when a new file is loaded at a later time
38
-// or the MIDI file player handle is destroyed.
39
-cmMfpRC_t cmMfpLoadHandle( cmMfpH_t h, cmMidiFileH_t mfH );
38
+  // Load a MIDI file into the player using a file owned by the host.
39
+  // This file will NOT be closed when a new file is loaded at a later time
40
+  // or the MIDI file player handle is destroyed.
41
+  cmMfpRC_t cmMfpLoadHandle( cmMfpH_t h, cmMidiFileH_t mfH );
40 42
 
41
-// Reset the play position of the player to an offset in microseconds from 
42
-// the beginning of the file.  If there are no message at or after 'offsMicrosecs'
43
-// then the function will return kEndOfFileMfpRC.
44
-cmMfpRC_t cmMfpSeek(       cmMfpH_t h, unsigned offsMicrosecs );
43
+  // Reset the play position of the player to an offset in microseconds from 
44
+  // the beginning of the file.  If there are no message at or after 'offsMicrosecs'
45
+  // then the function will return kEndOfFileMfpRC.
46
+  cmMfpRC_t cmMfpSeek(       cmMfpH_t h, unsigned offsMicrosecs );
45 47
 
46
-// This is the driving clock call for the player. 'deltaMicroSecs' is the
47
-// elapsed time in microseconds since the last call to this function.
48
-// Call to 'cbFunc', as set in by cmMfpCreate() occur from this function.
49
-cmMfpRC_t cmMfpClock(      cmMfpH_t h, unsigned deltaMicroSecs );
48
+  // This is the driving clock call for the player. 'deltaMicroSecs' is the
49
+  // elapsed time in microseconds since the last call to this function.
50
+  // Call to 'cbFunc', as set in by cmMfpCreate() occur from this function.
51
+  cmMfpRC_t cmMfpClock(      cmMfpH_t h, unsigned deltaMicroSecs );
50 52
 
51
-cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx );
53
+  cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx );
52 54
 
53
-cmRC_t cmMfpTest2( const char* midiFn, const char* audioFn, cmCtx_t* ctx );
55
+  cmRC_t cmMfpTest2( const char* midiFn, const char* audioFn, cmCtx_t* ctx );
54 56
 
57
+  //)
58
+  
55 59
 #ifdef __cplusplus
56 60
 }
57 61
 #endif

+ 9
- 2
cmMidiPort.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //(  { file_desc:"Device independent MIDI port related code." kw:[midi]}
9
+
8 10
   typedef unsigned cmMpRC_t;
9 11
 
10 12
   // Flags used to identify input and output ports on MIDI devices
@@ -30,7 +32,9 @@ extern "C" {
30 32
   };
31 33
 
32 34
   typedef void (*cmMpCallback_t)( const cmMidiPacket_t* pktArray, unsigned pktCnt );
33
-
35
+  
36
+  //)
37
+  //(  { label:cmMpParser file_desc:"MIDI event parser converts raw MIDI events into cmMidiPacket_t messages." kw:[midi]}
34 38
 
35 39
   //===============================================================================================
36 40
   // MIDI Parser
@@ -62,6 +66,8 @@ extern "C" {
62 66
   // Returns true if the parser uses the given callback.
63 67
   bool          cmMpParserHasCallback(     cmMpParserH_t h, cmMpCallback_t cbFunc, void* cbDataPtr );
64 68
 
69
+  //)
70
+  //(  { label:cmMidiPort file_desc:"Device independent MIDI port." kw:[midi]}
65 71
 
66 72
   //===============================================================================================
67 73
   // MIDI Device Interface
@@ -92,7 +98,8 @@ extern "C" {
92 98
   void        cmMpReport( cmRpt_t* rpt );
93 99
 
94 100
   void cmMpTest( cmCtx_t* ctx );
95
-
101
+  //)
102
+  
96 103
 #ifdef __cplusplus
97 104
 }
98 105
 #endif

+ 3
- 0
cmMsgProtocol.h Voir le fichier

@@ -7,6 +7,7 @@
7 7
 extern "C" {
8 8
 #endif
9 9
 
10
+  //( { file_desc:"Global constants and data structures for transmiting messages between threads and network nodes.", kw:[real_time]}
10 11
   #define cmAudDspSys_FILENAME "aud_dsp.js"
11 12
 
12 13
 
@@ -134,6 +135,8 @@ extern "C" {
134 135
   cmMsgRC_t cmMsgPeekInstId(     const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
135 136
   cmMsgRC_t cmMsgPeekInstVarId(  const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
136 137
 
138
+  //)
139
+  
137 140
 #ifdef __cplusplus
138 141
 }
139 142
 #endif

+ 1
- 1
cmPgmOpts.c Voir le fichier

@@ -1250,7 +1250,7 @@ void cmPgmOptPrintHelp( cmPgmOptH_t h, cmRpt_t* rpt )
1250 1250
       reqLabel = reqStr;
1251 1251
 
1252 1252
     if( mstr != NULL )
1253
-      cmRptPrintf(rpt,"Enumerated group: %s %s",mstr->mstrStr==NULL ? "" : mstr->mstrStr, cmIsFlag(mstr->cflags,kReqPoFl) ? reqStr : "" );
1253
+      cmRptPrintf(rpt,"Enumerated group: %s %s\n",mstr->mstrStr==NULL ? "" : mstr->mstrStr, cmIsFlag(mstr->cflags,kReqPoFl) ? reqStr : "" );
1254 1254
    
1255 1255
     cmRptPrintf(rpt,"%s-%c --%s %s %s",indentStr,r->charId,r->wordId,valueTypeLabel,reqLabel);
1256 1256
 

+ 2
- 3
cmPgmOpts.h Voir le fichier

@@ -1,8 +1,8 @@
1 1
 #ifndef cmPgmOpts_h
2 2
 #define cmPgmOpts_h
3 3
 
4
-//{
5
-//(
4
+//( { file_desc:"Command line argument description and parsing API." kw:[base]}
5
+//
6 6
 // Command line program option syntax:
7 7
 //
8 8
 //
@@ -206,7 +206,6 @@ extern "C" {
206 206
   void cmPgmOptPrintParms(   cmPgmOptH_t h, cmRpt_t* rpt );
207 207
 
208 208
   //)
209
-  //}
210 209
 
211 210
 #ifdef __cplusplus
212 211
 }

+ 4
- 1
cmPrefs.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Manage persistent application preferences." kw:[base] }
9
+  
8 10
   typedef unsigned cmPrRC_t;
9 11
   typedef cmHandle_t cmPrH_t;
10 12
 
@@ -188,7 +190,8 @@ extern "C" {
188 190
 
189 191
   void cmPrefsTest( cmCtx_t* ctx, const char* ifn, const char* ofn );
190 192
     
191
-
193
+  //)
194
+  
192 195
 #ifdef __cplusplus
193 196
 }
194 197
 #endif

+ 112
- 134
cmProc.h Voir le fichier

@@ -5,7 +5,10 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  //------------------------------------------------------------------------------------------------------------
8
+  //( { file_desc:"Processor Library 1" kw:[proclib]}
9
+  //)
10
+
11
+  //( { label:cmAudioFileRd file_desc:"Audio file reader based on cmAudioFile" kw:[proc] }
9 12
   typedef struct
10 13
   {
11 14
     cmObj             obj;
@@ -23,28 +26,30 @@ extern "C" {
23 26
     cmMtxFile*        mfp;
24 27
   } cmAudioFileRd;
25 28
 
26
-  /// set p to NULL to dynamically allocate the object
27
-  /// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
28
-  /// If fn is valid then chIdx must also be valid.
29
-  /// Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead().
30
-  /// Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file.
29
+  // set p to NULL to dynamically allocate the object
30
+  // fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
31
+  // If fn is valid then chIdx must also be valid.
32
+  // Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead().
33
+  // Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file.
31 34
   cmAudioFileRd*     cmAudioFileRdAlloc( cmCtx* c, cmAudioFileRd* p, unsigned procSmpCnt, const char* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );
32 35
   cmRC_t             cmAudioFileRdFree(  cmAudioFileRd** p );
33 36
   cmRC_t             cmAudioFileRdOpen(  cmAudioFileRd* p, unsigned procSmpCnt,  const cmChar_t* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx ); 
34 37
   cmRC_t             cmAudioFileRdClose( cmAudioFileRd* p );  
35 38
 
36 39
 
37
-  /// Returns cmEofRC if the end of file is encountered.
40
+  // Returns cmEofRC if the end of file is encountered.
38 41
   cmRC_t             cmAudioFileRdRead(  cmAudioFileRd* p );
39 42
   cmRC_t             cmAudioFileRdSeek(  cmAudioFileRd* p, unsigned frmIdx );
40 43
 
41
-  /// Find the overall minimum, maximum, and mean sample values without changing the current file location.
44
+  // Find the overall minimum, maximum, and mean sample values without changing the current file location.
42 45
   cmRC_t             cmAudioFileRdMinMaxMean( cmAudioFileRd* p, unsigned chIdx, cmSample_t* minPtr, cmSample_t* maxPtr, cmSample_t* meanPtr );
43 46
 
47
+  //)
44 48
 
49
+  //( { label:cmShiftBuf file_desc:"Audio shift buffer processor" kw:[proc] }
45 50
   //------------------------------------------------------------------------------------------------------------
46
-  /// The buffer is intended to synchronize sample block rates between processes and to provide an overlapped 
47
-  /// input buffer.
51
+  // The buffer is intended to synchronize sample block rates between processes and to provide an overlapped 
52
+  // input buffer.
48 53
   typedef struct cmShiftBuf_str
49 54
   {
50 55
     cmObj       obj;
@@ -61,89 +66,36 @@ extern "C" {
61 66
 
62 67
 
63 68
 
64
-  /// Set p to NULL to dynamically allocate the object.  hopSmpCnt must be  <= wndSmpCnt.
69
+  // Set p to NULL to dynamically allocate the object.  hopSmpCnt must be  <= wndSmpCnt.
65 70
   cmShiftBuf*       cmShiftBufAlloc( cmCtx* c, cmShiftBuf* p, unsigned procSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt );
66 71
   cmRC_t            cmShiftBufFree(  cmShiftBuf** p );
67 72
   cmRC_t            cmShiftBufInit(  cmShiftBuf* p, unsigned procSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt );
68 73
   cmRC_t            cmShiftBufFinal( cmShiftBuf* p );
69 74
 
70
-  /// Returns true if a new hop is ready to be read otherwise returns false.
71
-  /// In general cmShiftBufExec() should be called in a loop until it returns false. 
72
-  /// Note that 'sp' and 'sn' are ignored except for the first call after the function returns false.
73
-  /// This means that when called in a loop 'sp' and 'sn' are only used on the first time through the loop.
74
-  /// When procSmpCnt is less than hopSmpCnt the loop will only execute when at least wndSmpCnt 
75
-  /// new samples have been buffered.
76
-  /// When procSmpCnt is greater than hopSmpCnt the loop will execute multiple times until less 
75
+  // Returns true if a new hop is ready to be read otherwise returns false.
76
+  // In general cmShiftBufExec() should be called in a loop until it returns false. 
77
+  // Note that 'sp' and 'sn' are ignored except for the first call after the function returns false.
78
+  // This means that when called in a loop 'sp' and 'sn' are only used on the first time through the loop.
79
+  // When procSmpCnt is less than hopSmpCnt the loop will only execute when at least wndSmpCnt 
80
+  // new samples have been buffered.
81
+  // When procSmpCnt is greater than hopSmpCnt the loop will execute multiple times until less 
77 82
   //  than wndSmpCnt new samples are available.
78
-  /// Note that 'sn' must always be less than or equal to procSmpCnt.
79
-  ///
80
-  /// Example:
81
-  /// while( fill(sp,sn) )                      // fill sp[] with sn samples
82
-  /// {
83
-  ///    // shift by hopSmpCnt samples on all passes - insert new samples on first pass
84
-  ///    while( cmShiftBufExec(p,sp,sn) )       
85
-  ///       proc(p->outV,p->outN);              // process p->outV[wndSmpCnt]
86
-  /// }
83
+  // Note that 'sn' must always be less than or equal to procSmpCnt.
84
+  //
85
+  // Example:
86
+  // while( fill(sp,sn) )                      // fill sp[] with sn samples
87
+  // {
88
+  //    // shift by hopSmpCnt samples on all passes - insert new samples on first pass
89
+  //    while( cmShiftBufExec(p,sp,sn) )       
90
+  //       proc(p->outV,p->outN);              // process p->outV[wndSmpCnt]
91
+  // }
87 92
   bool              cmShiftBufExec(  cmShiftBuf* p, const cmSample_t* sp, unsigned sn );
88 93
 
89 94
   void              cmShiftBufTest( cmCtx* c );
90
-
91
-
92 95
   //------------------------------------------------------------------------------------------------------------
93
-  /*
94
-  typedef struct
95
-  {
96
-    cmComplexS_t*   complexV;
97
-    cmSample_t*     outV;
98
-    cmFftPlanS_t     plan;
99
-  } cmIFftObjS;
100
-
101
-  typedef struct
102
-  {
103
-    cmComplexR_t*   complexV;
104
-    cmReal_t*       outV;
105
-    cmFftPlanR_t    plan;
106
-  } cmIFftObjR;
107
-
108
-  typedef struct
109
-  {
110
-    cmObj           obj;
111
-    unsigned        binCnt;
112
-    unsigned        outN;
113
-
114
-    union 
115
-    {
116
-      cmIFftObjS sr;
117
-      cmIFftObjR rr;
118
-    }u;
119
-  
120
-  } cmIFft;
121
-
122
-  cmIFft*  cmIFftAllocS( cmCtx* c, cmIFft* p, unsigned binCnt );
123
-  cmIFft*  cmIFftAllocR( cmCtx* c, cmIFft* p, unsigned binCnt );
124
-
125
-  cmRC_t   cmIFftFreeS(  cmIFft** pp );
126
-  cmRC_t   cmIFftFreeR(  cmIFft** pp );
127
-
128
-  cmRC_t   cmIFftInitS(  cmIFft* p, unsigned binCnt );
129
-  cmRC_t   cmIFftInitR(  cmIFft* p, unsigned binCnt );
130
-
131
-  cmRC_t   cmIFftFinalS( cmIFft* p );
132
-  cmRC_t   cmIFftFinalR( cmIFft* p );
96
+  //)
133 97
 
134
-  // x must contain 'binCnt' elements.
135
-  cmRC_t   cmIFftExecS(     cmIFft* p, cmComplexS_t* x );
136
-  cmRC_t   cmIFftExecR(     cmIFft* p, cmComplexR_t* x );
137
-
138
-  cmRC_t   cmIFftExecPolarS( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV ); 
139
-  cmRC_t   cmIFftExecPolarR( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV ); 
140
-
141
-  cmRC_t   cmIFftExecRectS(  cmIFft* p, const cmReal_t* rV,   const cmReal_t* iV );
142
-  cmRC_t   cmIFftExecPolarR( cmIFft* p, const cmReal_t* magV, const cmReal_t* phsV ); 
143
-
144
-  void cmIFftTest( cmRpt_t* rptFuncPtr );
145
-  */
146
-  //------------------------------------------------------------------------------------------------------------
98
+  //( { label:cmWindowFunc file_desc:"Fourier Transform window function generator." kw:[proc]}
147 99
 
148 100
   enum
149 101
   {
@@ -174,8 +126,8 @@ extern "C" {
174 126
     cmMtxFile*  mfp;
175 127
   } cmWndFunc;
176 128
 
177
-  /// Set p to NULL to dynamically allocate the object
178
-  /// if wndId is set to a valid value this function will internally call cmWndFuncInit()
129
+  // Set p to NULL to dynamically allocate the object
130
+  // if wndId is set to a valid value this function will internally call cmWndFuncInit()
179 131
   cmWndFunc*  cmWndFuncAlloc( cmCtx* c, cmWndFunc* p, unsigned wndId, unsigned wndSmpCnt, double kaierSideLobeRejectDb );
180 132
   cmRC_t      cmWndFuncFree(  cmWndFunc** pp );
181 133
   cmRC_t      cmWndFuncInit(  cmWndFunc* p, unsigned wndId, unsigned wndSmpCnt, double kaiserSideLobeRejectDb );
@@ -184,9 +136,11 @@ extern "C" {
184 136
 
185 137
 
186 138
   void cmWndFuncTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
187
-
188 139
   //------------------------------------------------------------------------------------------------------------
189
-  /// Spectral frame delay. A circular buffer for spectral (or other fixed length) vectors.
140
+  //)
141
+
142
+  //( { label:cmSpecDelay file_desc:"Spectral frame delay. A circular buffer for spectral (or other fixed length) vectors." kw:[proc]}
143
+  
190 144
   typedef struct
191 145
   {
192 146
     cmObj       obj;
@@ -197,24 +151,25 @@ extern "C" {
197 151
   } cmSpecDelay;
198 152
 
199 153
 
200
-  /// Set p to NULL to dynamically allocate the object.
201
-  /// Allocate a spectral frame delay capable of delaying for 'maxDelayCnt' hops and 
202
-  /// where each vector contains 'binCnt' elements.
154
+  // Set p to NULL to dynamically allocate the object.
155
+  // Allocate a spectral frame delay capable of delaying for 'maxDelayCnt' hops and 
156
+  // where each vector contains 'binCnt' elements.
203 157
   cmSpecDelay*      cmSpecDelayAlloc( cmCtx* c, cmSpecDelay* p, unsigned maxDelayCnt, unsigned binCnt );
204 158
   cmRC_t            cmSpecDelayFree(  cmSpecDelay** p );
205 159
 
206 160
   cmRC_t            cmSpecDelayInit( cmSpecDelay* p, unsigned maxDelayCnt, unsigned binCnt );
207 161
   cmRC_t            cmSpecDelayFinal(cmSpecDelay* p );
208 162
 
209
-  /// Give an input vector to the delay. 'sn' must <= binCnt
163
+  // Give an input vector to the delay. 'sn' must <= binCnt
210 164
   cmRC_t            cmSpecDelayExec(  cmSpecDelay* p, const cmSample_t* sp, unsigned sn );
211 165
 
212
-  /// Get a pointer to a delayed vector. 'delayCnt' indicates the length of the delay in hops.
213
-  /// (e.g. 1 is the previous hop, 2 is two hops previous, ... )
166
+  // Get a pointer to a delayed vector. 'delayCnt' indicates the length of the delay in hops.
167
+  // (e.g. 1 is the previous hop, 2 is two hops previous, ... )
214 168
   const cmSample_t* cmSpecDelayOutPtr(cmSpecDelay* p, unsigned delayCnt );
215
-
216
-
217 169
   //------------------------------------------------------------------------------------------------------------
170
+  //)
171
+  
172
+  //( { label:cmFilter file_desc:"General purpose, LTI, Octave compatible, filter." kw:[proc] }
218 173
   typedef struct cmFilter_str
219 174
   {
220 175
     cmObj     obj;
@@ -257,9 +212,10 @@ extern "C" {
257 212
 
258 213
   void      cmFilterTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
259 214
   void      cmFilterFilterTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
260
-
261
-
262 215
   //------------------------------------------------------------------------------------------------------------
216
+  //)
217
+
218
+  //( { label:cmComplexDetect file_desc:"Complex domain onset detection function." kw:[proc] }
263 219
   typedef struct
264 220
   {
265 221
     cmObj        obj;
@@ -271,14 +227,16 @@ extern "C" {
271 227
     //unsigned     cdfSpRegId;
272 228
   } cmComplexDetect;
273 229
 
274
-  /// Set p to NULL to dynamically allocate the object.
230
+  // Set p to NULL to dynamically allocate the object.
275 231
   cmComplexDetect* cmComplexDetectAlloc(cmCtx* c, cmComplexDetect* p, unsigned binCnt );
276 232
   cmRC_t           cmComplexDetectFree( cmComplexDetect** pp);
277 233
   cmRC_t           cmComplexDetectInit( cmComplexDetect* p, unsigned binCnt );
278 234
   cmRC_t           cmComplexDetectFinal(cmComplexDetect* p);
279 235
   cmRC_t           cmComplexDetectExec( cmComplexDetect* p, const cmSample_t* magV, const cmSample_t* phsV, unsigned binCnt  );
280
-
281 236
   //------------------------------------------------------------------------------------------------------------
237
+  //)
238
+
239
+  //( { label:cmComplexOnset file_desc:"Complex onset detection function" kw:[proc]}
282 240
   typedef struct
283 241
   {
284 242
     cmObj        obj;
@@ -298,8 +256,10 @@ extern "C" {
298 256
   cmRC_t          cmComplexOnsetFinal( cmComplexOnset* p);
299 257
   cmRC_t          cmComplexOnsetExec(  cmComplexOnset* p, cmSample_t cdf );
300 258
   cmRC_t          cmComplexOnsetCalc(  cmComplexOnset* p );
301
-
302 259
   //------------------------------------------------------------------------------------------------------------
260
+  //)
261
+
262
+  //( { label:cmMfcc file_desc:"Mel Frequency Cepstral Coefficient (MFCC) measurement function." kw:[proc] }
303 263
   typedef struct
304 264
   {
305 265
     cmObj       obj;
@@ -321,8 +281,10 @@ extern "C" {
321 281
   cmRC_t  cmMfccExecPower(      cmMfcc* p, const cmReal_t* magPowV, unsigned binCnt );
322 282
   cmRC_t  cmMfccExecAmplitude(  cmMfcc* p, const cmReal_t* magAmpV, unsigned binCnt );
323 283
   void    cmMfccTest();
324
-
325 284
   //------------------------------------------------------------------------------------------------------------
285
+  //)
286
+
287
+  //( { label:cmSones file_desc:"Sones measurement function." kw:[proc] }
326 288
   typedef struct
327 289
   {
328 290
     cmObj       obj;
@@ -350,8 +312,10 @@ extern "C" {
350 312
   cmRC_t   cmSonesExec(  cmSones*  p, const cmReal_t* magPowV, unsigned binCnt ); 
351 313
 
352 314
   void     cmSonesTest();
353
-
354 315
   //------------------------------------------------------------------------------------------------------------
316
+  //)
317
+
318
+  //( { label: cmAudioOffsetScale file_desc:"Audio signal pre-processing normalizer." kw:[proc] }
355 319
   typedef struct
356 320
   {
357 321
     cmObj             obj;
@@ -371,15 +335,15 @@ extern "C" {
371 335
   } cmAudioOffsetScale;
372 336
 
373 337
 
374
-  /// This processor adds an offset to an audio signal and scales into dB (SPL) using one of two techniques
375
-  /// 1) Measures the effective sound pressure (via RMS) and then scales the signal to the reference dB (SPL) 
376
-  ///    In this case dBref is commonly set to 70. See Timony, 2004, Implementing Loudness Models in Matlab.
377
-  /// 
378
-  /// 2) treats the dBref as the maximum dB (SPL) and scales the signal by this amount without regard
379
-  ///    measured signal level.  In this case dBref is commonly set to 96 (max. dB (SPL) value for 16 bits)
380
-  ///    and rmsWndSecs is ignored.
381
-  ///
382
-  /// Note that setting rmsWndSecs to zero has the effect of using procSmpCnt as the window length.
338
+  // This processor adds an offset to an audio signal and scales into dB (SPL) using one of two techniques
339
+  // 1) Measures the effective sound pressure (via RMS) and then scales the signal to the reference dB (SPL) 
340
+  //    In this case dBref is commonly set to 70. See Timony, 2004, Implementing Loudness Models in Matlab.
341
+  // 
342
+  // 2) treats the dBref as the maximum dB (SPL) and scales the signal by this amount without regard
343
+  //    measured signal level.  In this case dBref is commonly set to 96 (max. dB (SPL) value for 16 bits)
344
+  //    and rmsWndSecs is ignored.
345
+  //
346
+  // Note that setting rmsWndSecs to zero has the effect of using procSmpCnt as the window length.
383 347
 
384 348
   enum { kNoAudioScaleFl=0x01, kRmsAudioScaleFl=0x02, kFixedAudioScaleFl=0x04 };
385 349
 
@@ -388,8 +352,10 @@ extern "C" {
388 352
   cmRC_t        cmAudioOffsetScaleInit(  cmAudioOffsetScale* p, unsigned procSmpCnt, double srate, cmSample_t offset, double rmsWndSecs, double dBref, unsigned flags );
389 353
   cmRC_t        cmAudioOffsetScaleFinal( cmAudioOffsetScale* p );
390 354
   cmRC_t        cmAudioOffsetScaleExec(  cmAudioOffsetScale* p, const cmSample_t* sp, unsigned sn );
391
-
392 355
   //------------------------------------------------------------------------------------------------------------
356
+  //)
357
+
358
+  //( { label:cmSpecMeas file_desc:"Measure a signals RMS, High-Frequency Content, Spectral Centroid, and Spectral Spread." kw:[proc]}
393 359
   typedef struct
394 360
   {
395 361
     cmObj      obj;
@@ -422,10 +388,10 @@ extern "C" {
422 388
     unsigned ssSpRegId;
423 389
   } cmSpecMeas;
424 390
 
425
-  /// Set wndFrmCnt to the number of spectral frames to take the measurement over.
426
-  /// Setting wndFrmCnt to 1 has the effect of calculating the value on the current frame only.
427
-  /// Set flags = kWholeSigSpecMeasFl to ignore wndFrmCnt and calculate the result on the entire signal.
428
-  /// In effect this treats the entire signal as the length of the measurement window.
391
+  // Set wndFrmCnt to the number of spectral frames to take the measurement over.
392
+  // Setting wndFrmCnt to 1 has the effect of calculating the value on the current frame only.
393
+  // Set flags = kWholeSigSpecMeasFl to ignore wndFrmCnt and calculate the result on the entire signal.
394
+  // In effect this treats the entire signal as the length of the measurement window.
429 395
   enum { kWholeSigSpecMeasFl=0x00, kUseWndSpecMeasFl=0x01 };
430 396
 
431 397
   cmSpecMeas* cmSpecMeasAlloc( cmCtx* c, cmSpecMeas* p, double srate, unsigned binCnt, unsigned wndFrmCnt, unsigned flags );
@@ -433,8 +399,10 @@ extern "C" {
433 399
   cmRC_t      cmSpecMeasInit(  cmSpecMeas* p, double srate, unsigned binCnt, unsigned wndFrmCnt, unsigned flags );
434 400
   cmRC_t      cmSpecMeasFinal( cmSpecMeas* p );
435 401
   cmRC_t      cmSpecMeasExec(  cmSpecMeas* p, const cmReal_t* magPowV, unsigned binCnt ); 
436
-
437 402
   //------------------------------------------------------------------------------------------------------------
403
+  //)
404
+
405
+  //( { label:cmSigMeas file_desc:"Measure a time domain signals zero crossing rate." kw:[proc]}
438 406
   typedef struct
439 407
   {
440 408
     cmObj       obj;
@@ -456,8 +424,10 @@ extern "C" {
456 424
   cmRC_t     cmSigMeasInit(  cmSigMeas* p, double srate, unsigned procSmpCnt, unsigned measSmpCnt );
457 425
   cmRC_t     cmSigMeasFinal( cmSigMeas* p );
458 426
   cmRC_t     cmSigMeasExec(  cmSigMeas* p, const cmSample_t* sigV, unsigned smpCnt );
459
-
460 427
   //------------------------------------------------------------------------------------------------------------
428
+  //)
429
+
430
+  //( { label:cmSRC file_desc:"Sample rate converter" kw:[proc] }
461 431
   typedef struct
462 432
   {
463 433
     cmObj        obj;
@@ -476,7 +446,7 @@ extern "C" {
476 446
 
477 447
   } cmSRC;
478 448
 
479
-  /// The srate paramater is the sample rate of the source signal provided via cmSRCExec()
449
+  // The srate paramater is the sample rate of the source signal provided via cmSRCExec()
480 450
   cmSRC* cmSRCAlloc( cmCtx* c, cmSRC* p, double srate, unsigned procSmpCnt, unsigned upFact, unsigned dnFact );
481 451
   cmRC_t cmSRCFree(  cmSRC** pp );
482 452
   cmRC_t cmSRCInit(  cmSRC* p, double srate, unsigned procSmpCnt, unsigned upFact, unsigned dnFact );
@@ -484,8 +454,10 @@ extern "C" {
484 454
   cmRC_t cmSRCExec(  cmSRC* p, const cmSample_t* sp, unsigned sn );
485 455
 
486 456
   void   cmSRCTest();
487
-
488 457
   //------------------------------------------------------------------------------------------------------------
458
+  //)
459
+
460
+  //( { label:cmConstQ file_desc:"Contant-Q transform." kw:[proc] }
489 461
   typedef struct
490 462
   {
491 463
     cmObj           obj;
@@ -510,9 +482,10 @@ extern "C" {
510 482
   cmRC_t    cmConstQInit(  cmConstQ* p, double srate, unsigned minMidiPitch, unsigned maxMidiPitch, unsigned binsPerOctave, double thresh );
511 483
   cmRC_t    cmConstQFinal( cmConstQ* p );
512 484
   cmRC_t    cmConstQExec(  cmConstQ* p, const cmComplexR_t* ftV, unsigned binCnt );
513
-
514
-
515 485
   //------------------------------------------------------------------------------------------------------------
486
+  //)
487
+  
488
+  //( { label:cmTuneHpcp file_desc:"Generate a tuned chromagram." kw:[proc]}
516 489
   typedef struct
517 490
   {
518 491
     cmObj     obj;
@@ -545,10 +518,10 @@ extern "C" {
545 518
   cmRC_t         cmTunedHpcpFinal( cmHpcp* p );
546 519
   cmRC_t         cmTunedHpcpExec(  cmHpcp* p, const cmComplexR_t* constQBinPtr, unsigned constQBinCnt );
547 520
   cmRC_t         cmTunedHpcpTuneAndFilter( cmHpcp* p);
548
-
549
-
550
-  //------------------------------------------------------------------------------------------------------------
551 521
   //------------------------------------------------------------------------------------------------------------
522
+  //)
523
+
524
+  //( { label:cmBeatHist file_desc:"Generate a beat candidate histogram." kw:[proc]}
552 525
 
553 526
   struct cmFftRR_str;
554 527
   struct cmIFftRR_str;
@@ -579,9 +552,11 @@ extern "C" {
579 552
   cmRC_t      cmBeatHistFinal( cmBeatHist* p );
580 553
   cmRC_t      cmBeatHistExec(  cmBeatHist* p, cmSample_t df );
581 554
   cmRC_t      cmBeatHistCalc(  cmBeatHist* p );
582
-
583 555
   //------------------------------------------------------------------------------------------------------------
584
-  // Gaussian Mixture Model containing N Gaussian PDF's each of dimension D
556
+  //)
557
+
558
+  //( { label:cmGmm file_desc"Gaussian Mixture Model containing N Gaussian PDF's each of dimension D." kw:[proc model]}
559
+  
585 560
   typedef struct
586 561
   {
587 562
     cmObj     obj;
@@ -639,9 +614,11 @@ extern "C" {
639 614
   void     cmGmmPrint( cmGmm_t* p, bool detailsFl );
640 615
 
641 616
   void     cmGmmTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
642
-
643 617
   //------------------------------------------------------------------------------------------------------------
644
-  // Continuous Hidden Markov Model
618
+  //)
619
+  
620
+  //( { label:cmChmm file_desc:"Continuous Hidden Markov Model" kw:[proc model]}
621
+  
645 622
   typedef struct
646 623
   {
647 624
     cmObj       obj;
@@ -652,9 +629,7 @@ extern "C" {
652 629
     cmReal_t*   aM;       // aM[ N x N] transition probability mtx
653 630
     cmGmm_t**   bV;       // bV[ N ] observation probability mtx (array of pointers to GMM's) 
654 631
     cmReal_t*   bM;       // bM[ N,T]  state-observation probability matrix 
655
-
656 632
     cmMtxFile* mfp;
657
-
658 633
   } cmChmm_t;
659 634
 
660 635
   // Continuous HMM consisting of stateN states where the observations 
@@ -706,10 +681,11 @@ extern "C" {
706 681
   void      cmChmmPrint(    cmChmm_t* p );
707 682
 
708 683
   void      cmChmmTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH  );
684
+  //------------------------------------------------------------------------------------------------------------
685
+  //)
709 686
 
710 687
 
711
-  //------------------------------------------------------------------------------------------------------------
712
-  // Chord recognizer
688
+  //( { label:cmChord file_desc:"HMM based chord recognizer." kw:[proc]}
713 689
 
714 690
   typedef struct 
715 691
   {
@@ -739,14 +715,16 @@ extern "C" {
739 715
     cmReal_t  cdtsVar;      
740 716
 
741 717
   } cmChord;
742
-
718
+  
743 719
   cmChord*   cmChordAlloc( cmCtx* c, cmChord*  p, const cmReal_t* chromaM, unsigned T );
744 720
   cmRC_t     cmChordFree(  cmChord** p );
745 721
   cmRC_t     cmChordInit(  cmChord*  p, const cmReal_t* chromaM, unsigned T );
746 722
   cmRC_t     cmChordFinal( cmChord*  p );
747 723
 
748 724
   void       cmChordTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH ); 
749
-
725
+  //------------------------------------------------------------------------------------------------------------
726
+  //)
727
+  
750 728
 #ifdef __cplusplus
751 729
 }
752 730
 #endif

+ 20
- 3
cmProc2.c Voir le fichier

@@ -5950,7 +5950,8 @@ cmSpecDist_t* cmSpecDistAlloc( cmCtx* ctx,cmSpecDist_t* ap, unsigned procSmpCnt,
5950 5950
 
5951 5951
   //p->iSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5952 5952
   //p->oSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5953
-
5953
+  p->statVa     = cmVectArrayAlloc(ctx,kDoubleVaFl);
5954
+  
5954 5955
   if( procSmpCnt != 0 )
5955 5956
   {
5956 5957
     if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
@@ -5971,6 +5972,7 @@ cmRC_t cmSpecDistFree( cmSpecDist_t** pp )
5971 5972
   cmSpecDistFinal(p);
5972 5973
   //cmVectArrayFree(&p->iSpecVa);
5973 5974
   //cmVectArrayFree(&p->oSpecVa);
5975
+  cmVectArrayFree(&p->statVa);
5974 5976
   cmMemPtrFree(&p->hzV);
5975 5977
   cmMemPtrFree(&p->iSpecM);
5976 5978
   cmMemPtrFree(&p->oSpecM);
@@ -6095,7 +6097,8 @@ cmRC_t cmSpecDistFinal(cmSpecDist_t* p )
6095 6097
 
6096 6098
   //cmVectArrayWrite(p->iSpecVa, "/home/kevin/temp/frqtrk/iSpec.va");
6097 6099
   //cmVectArrayWrite(p->oSpecVa, "/home/kevin/temp/expand/oSpec.va");
6098
-
6100
+  //cmVectArrayWrite(p->statVa, "/Users/kevin/temp/kc/state.va");
6101
+  
6099 6102
   cmPvAnlFree(&p->pva);
6100 6103
   cmPvSynFree(&p->pvs);
6101 6104
   //cmFrqTrkFree(&p->ft);
@@ -6111,6 +6114,7 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
6111 6114
   // octave> -abs(abs(X1m+thresh)-(X1m+thresh)) - thresh
6112 6115
   // octave> ans = -64  -62  -60  -60
6113 6116
 
6117
+  /*
6114 6118
   unsigned i=0;
6115 6119
   for(i=0; i<binCnt; ++i)
6116 6120
   {
@@ -6123,7 +6127,13 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
6123 6127
       X1m[i] -= 2*d;
6124 6128
 
6125 6129
   }
6130
+  */
6126 6131
 
6132
+  unsigned i=0;
6133
+  for(i=0; i>binCnt; ++i)
6134
+  {
6135
+    X1m[i] = -fabs(fabs(X1m[i]-thresh) - (X1m[i]-thresh)) - thresh;
6136
+  }
6127 6137
 
6128 6138
 }
6129 6139
 
@@ -6322,6 +6332,8 @@ cmRC_t  cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
6322 6332
       cmVOR_MeanM2(p->iSpecV, p->iSpecM, p->hN, p->pva->binCnt, 0, cmMin(p->fi+1,p->hN));
6323 6333
     }
6324 6334
 
6335
+    cmVOR_PowVS(X1m,p->pva->binCnt,2.0);
6336
+
6325 6337
     cmVOR_AmplToDbVV(X1m, p->pva->binCnt, p->pva->magV, -1000.0 );
6326 6338
     //cmVOR_AmplToDbVV(X1m, p->pva->binCnt, X1m, -1000.0 );
6327 6339
 
@@ -6369,7 +6381,6 @@ cmRC_t  cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
6369 6381
 
6370 6382
     cmVOR_DbToAmplVV(X1m, p->pva->binCnt, X1m );
6371 6383
 
6372
-
6373 6384
     // run and apply the tracker/supressor
6374 6385
     //cmFrqTrkExec(p->ft, X1m, p->pva->phsV, NULL ); 
6375 6386
     //cmVOR_MultVV(X1m, p->pva->binCnt,p->ft->aV );
@@ -6393,6 +6404,12 @@ cmRC_t  cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
6393 6404
       p->ogain *= a0;
6394 6405
     }
6395 6406
 
6407
+    double g = u0/u1;
6408
+    p->ogain0 = g + (p->ogain0 * .98);
6409
+
6410
+    //double v[] = { u0, u1, p->ogain, p->ogain0 };
6411
+    //cmVectArrayAppendD(p->statVa,v,sizeof(v)/sizeof(v[0]));
6412
+
6396 6413
     cmVOR_MultVS(X1m,p->pva->binCnt,cmMin(4.0,p->ogain));
6397 6414
 
6398 6415
 

+ 99
- 31
cmProc2.h Voir le fichier

@@ -5,7 +5,11 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  //------------------------------------------------------------------------------------------------------------
8
+  //( { file_desc:"Processor Library 2" kw:[proclib]}
9
+  //)
10
+
11
+  //( { label:cmArray file_desc:"Expandable array designed to work easily with the cmProcObj model" kw:[proc]}
12
+  
9 13
   // cmArray is an expandable array designed to work easily with the alloc/init/final/free model
10 14
   // used by this library.  The arrays can be safely used by using the cmArrayAllocXXX macros 
11 15
   // with static cmArray member fields during object allocation. cmArrayResizeXXX macros are then
@@ -53,8 +57,10 @@ extern "C" {
53 57
 #define cmArrayPtr(     type, p )            (type*)(p)->ptr
54 58
 #define cmArrayCount(   p )                  (p)->eleCnt
55 59
 
56
-
57 60
   //------------------------------------------------------------------------------------------------------------
61
+  //)
62
+  //( { label:cmAudioFileWr file_desc:"Audio file writer" kw:[proc]}
63
+    
58 64
   typedef struct
59 65
   {
60 66
     cmObj         obj;
@@ -72,8 +78,10 @@ extern "C" {
72 78
   cmRC_t             cmAudioFileWrFinal( cmAudioFileWr* p );
73 79
   cmRC_t             cmAudioFileWrExec(  cmAudioFileWr* p, unsigned chIdx, const cmSample_t* sp, unsigned sn );
74 80
   void               cmAudioFileWrTest();
75
-
76 81
   //------------------------------------------------------------------------------------------------------------
82
+  //)
83
+  
84
+  //( { label:cmMatrixBuf file_desc:"Store and recall real values in matrix form." kw:[proc]}
77 85
   typedef struct
78 86
   {
79 87
     cmObj      obj;
@@ -98,6 +106,9 @@ extern "C" {
98 106
 
99 107
 
100 108
   //------------------------------------------------------------------------------------------------------------
109
+  //)
110
+
111
+  //( { label:cmSigGen file_desc:"Generate periodic and noise signals." kw:[proc]}
101 112
 
102 113
   enum
103 114
   {
@@ -139,6 +150,9 @@ extern "C" {
139 150
   cmRC_t    cmSigGenExec(  cmSigGen*  p );
140 151
 
141 152
   //------------------------------------------------------------------------------------------------------------
153
+  //)
154
+  
155
+  //( { label:cmDelay file_desc:"Fixed length audio delay." kw:[proc]}
142 156
   typedef struct
143 157
   {
144 158
     cmObj*      obj;
@@ -160,8 +174,10 @@ extern "C" {
160 174
   cmRC_t            cmDelayAdvance( cmDelay* p, unsigned sn );
161 175
   cmRC_t            cmDelayExec(    cmDelay* p, const cmSample_t* sp, unsigned sn, bool bypassFl );
162 176
   void              cmDelayTest();
163
-
164 177
   //------------------------------------------------------------------------------------------------------------
178
+  //)
179
+  
180
+  //( { label:cmFIR file_desc:"Finite impulse response filter." kw:[proc]}
165 181
   typedef struct
166 182
   {
167 183
     cmObj       obj;
@@ -192,10 +208,11 @@ extern "C" {
192 208
   cmRC_t cmFIRExec(       cmFIR* p, const cmSample_t* sp, unsigned sn );
193 209
   void   cmFIRTest0( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
194 210
   void   cmFIRTest1( cmCtx* ctx );
195
-  
196
-  //------------------------------------------------------------------------------------------------------------
197
-  // Apply a generic function to a windowed signal with a one sample hop size.
198 211
 
212
+  //------------------------------------------------------------------------------------------------------------
213
+  //)
214
+  
215
+  //( { label:cmFuncFilter file_desc:"Apply a generic function to a windowed signal with a one sample hop size.." kw:[proc]}
199 216
   typedef cmSample_t (*cmFuncFiltPtr_t)( const cmSample_t* sp, unsigned sn, void* userPtr );
200 217
 
201 218
   typedef struct
@@ -217,8 +234,10 @@ extern "C" {
217 234
   cmRC_t        cmFuncFilterFinal( cmFuncFilter* p );
218 235
   cmRC_t        cmFuncFilterExec(  cmFuncFilter* p, const cmSample_t* sp, unsigned sn );
219 236
   void          cmFuncFilterTest();
220
-
221 237
   //------------------------------------------------------------------------------------------------------------
238
+  //)
239
+  
240
+  //( { label:cmDhmm file_desc:"Discrete observation HMM" kw:[proc]}
222 241
   typedef struct
223 242
   {
224 243
     cmObj           obj;
@@ -245,6 +264,9 @@ extern "C" {
245 264
   void    cmDhmmTest();
246 265
 
247 266
   //------------------------------------------------------------------------------------------------------------
267
+  //)
268
+  
269
+  //( { label:cmConvolve file_desc:"Convolve a signal with an impulse response." kw:[proc]}
248 270
   typedef struct
249 271
   {
250 272
     cmObj     obj;
@@ -285,6 +307,9 @@ extern "C" {
285 307
   cmRC_t      cmConvolveTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
286 308
 
287 309
   //------------------------------------------------------------------------------------------------------------
310
+  //)
311
+
312
+  //( { label:cmBfcc file_desc:"Generate Bark Frequency Cepstral Coefficients from STFT frames." kw:[proc]}
288 313
   typedef struct
289 314
   {
290 315
     cmObj     obj; 
@@ -304,6 +329,8 @@ extern "C" {
304 329
   void    cmBfccTest( cmRpt_t* rpt, cmLHeapH_t lhH, cmSymTblH_t stH );
305 330
 
306 331
   //------------------------------------------------------------------------------------------------------------
332
+  //)
333
+  //( { label:cmCepstrum file_desc:"Generate Cepstral Coefficients from STFT frames." kw:[proc]}
307 334
   typedef struct
308 335
   {
309 336
     cmObj     obj; 
@@ -324,7 +351,10 @@ extern "C" {
324 351
   cmRC_t  cmCepsFinal( cmCeps* p );
325 352
   cmRC_t  cmCepsExec(  cmCeps* p, const cmReal_t* magV, const cmReal_t* phsV, unsigned binCnt );
326 353
 
354
+  //------------------------------------------------------------------------------------------------------------
355
+  //)
327 356
 
357
+  //( { label:cmOla file_desc:"Generate a signal from an via overlap-add." kw:[proc]}
328 358
   //------------------------------------------------------------------------------------------------------------
329 359
   typedef struct
330 360
   {
@@ -355,9 +385,10 @@ extern "C" {
355 385
   cmRC_t cmOlaExecS( cmOla* p, const cmSample_t* xV, unsigned xN );
356 386
   cmRC_t cmOlaExecR( cmOla* p, const cmReal_t*   xV, unsigned xN );
357 387
   const cmSample_t* cmOlaExecOut(cmOla* p );
388
+  //------------------------------------------------------------------------------------------------------------
389
+  //)
358 390
 
359
-
360
-
391
+  //( { label:cmPhsToFrq file_desc:"Given STFT phase spectrum frames return the instantaneous frequency." kw:[proc]}
361 392
   //------------------------------------------------------------------------------------------------------------
362 393
 
363 394
   typedef struct
@@ -380,9 +411,11 @@ extern "C" {
380 411
   cmRC_t  cmPhsToFrqFinal(cmPhsToFrq*  p );
381 412
   cmRC_t  cmPhsToFrqExec( cmPhsToFrq*  p, const cmReal_t* phsV );
382 413
  
383
-
384 414
   //------------------------------------------------------------------------------------------------------------
385
-
415
+  //)
416
+  
417
+  //( { label:cmPvAnl file_desc:"Perform the phase-vocoder analysis stage." kw:[proc]}
418
+ 
386 419
   enum 
387 420
   {
388 421
     kNoCalcHzPvaFl = 0x00,
@@ -420,6 +453,8 @@ extern "C" {
420 453
   bool     cmPvAnlExec( cmPvAnl* p, const cmSample_t* x, unsigned xN );
421 454
 
422 455
   //------------------------------------------------------------------------------------------------------------
456
+  //)
457
+  //( { label:cmPvSyn file_desc:"Perform the phase-vocoder synthesis stage." kw:[proc]}
423 458
 
424 459
   typedef struct
425 460
   {
@@ -451,11 +486,10 @@ extern "C" {
451 486
   cmRC_t     cmPvSynExec( cmPvSyn* p, const cmReal_t* magV, const cmReal_t* phsV );
452 487
   const cmSample_t* cmPvSynExecOut(cmPvSyn* p );
453 488
 
454
-
455
-
456 489
   //------------------------------------------------------------------------------------------------------------
457
-
458
-
490
+  //)
491
+  
492
+  //( { label:cmMidiSynth file_desc:"Synthesis independent MIDI synthesizer control structure." kw:[proc]}
459 493
   // callback selector values
460 494
   enum
461 495
   {
@@ -532,8 +566,10 @@ extern "C" {
532 566
   cmRC_t       cmMidiSynthOnMidi(cmMidiSynth* p, const cmMidiPacket_t* pktArray, unsigned pktCnt );
533 567
   cmRC_t       cmMidiSynthExec(  cmMidiSynth* p, cmSample_t** outChArray, unsigned outChCnt );
534 568
 
535
-
536 569
   //------------------------------------------------------------------------------------------------------------
570
+  //)
571
+
572
+  //( { label:cmWtVoice file_desc:"Wavetable oscillator implementation for use with cmMidiSyn." kw:[proc]}
537 573
 
538 574
   // state id's
539 575
   enum
@@ -568,6 +604,8 @@ extern "C" {
568 604
 
569 605
 
570 606
   //------------------------------------------------------------------------------------------------------------
607
+  //)
608
+  //( { label:cmWtVoiceBank file_desc:"A bank of cmWtVoice oscillator for use with cmMidiSynth." kw:[proc]}
571 609
 
572 610
   typedef struct
573 611
   {
@@ -596,8 +634,9 @@ extern "C" {
596 634
   int        cmWtVoiceBankExec( cmWtVoiceBank* p, struct cmMidiVoice_str* voicePtr, unsigned sel, cmSample_t* chArray[], unsigned chCnt );
597 635
 
598 636
 
599
-
600 637
   //------------------------------------------------------------------------------------------------------------
638
+  //)
639
+  //( { label:cmAudioFileBuf file_desc:"Generate a signal by caching all or part of an audio file." kw:[proc]}
601 640
 
602 641
   typedef struct
603 642
   {
@@ -620,8 +659,10 @@ extern "C" {
620 659
   // If less than outN samples are available then the remaining samples are set to 0.  
621 660
   unsigned        cmAudioFileBufExec( cmAudioFileBuf* p, unsigned smpIdx, cmSample_t* outV, unsigned outN, bool sumIntoOutFl );
622 661
 
623
-
624 662
   //------------------------------------------------------------------------------------------------------------
663
+  //)
664
+
665
+  //( { label:cmMDelay file_desc:"Multi-tap audio delay with feedback." kw:[proc]} 
625 666
   // Multi-delay.  Each of the taps of this delay operates as a independent delay with feedback.
626 667
   
627 668
   // Delay line specification.
@@ -657,6 +698,9 @@ extern "C" {
657 698
   void      cmMDelayReport( cmMDelay* p, cmRpt_t* rpt );
658 699
 
659 700
   //------------------------------------------------------------------------------------------------------------
701
+  //)
702
+  
703
+  //( { label:cmAudioSegPlayer file_desc:"Buffer and playback an arbitrary number of audio signals." kw:[proc]}
660 704
   enum
661 705
   {
662 706
     kEnableAspFl  = 0x01,
@@ -696,9 +740,9 @@ extern "C" {
696 740
   cmRC_t            cmAudioSegPlayerEnable( cmAudioSegPlayer* p, unsigned id, bool enableFl, unsigned outSmpIdx );
697 741
   cmRC_t            cmAudioSegPlayerReset(  cmAudioSegPlayer* p );
698 742
   cmRC_t            cmAudioSegPlayerExec(   cmAudioSegPlayer* p, cmSample_t** outChPtr, unsigned chCnt, unsigned outSmpCnt );
699
-
700
-
701 743
   //------------------------------------------------------------------------------------------------------------
744
+  //)
745
+
702 746
   /*
703 747
   cmReal_t (*cmCluster0DistFunc_t)( void* userPtr, const cmReal_t* v0, const cmReal_t* v1, unsigned binCnt );
704 748
 
@@ -729,7 +773,7 @@ extern "C" {
729 773
   cmRC_t           cmCluster0Exec(  cmCluster0* p, const cmReal_t* v, unsigned vn );
730 774
   */
731 775
 
732
-  //------------------------------------------------------------------------------------------------------------
776
+  //( { label:cmNmf file_desc:"Non-negative matrix factorization implementation." kw:[proc]}
733 777
   typedef struct
734 778
   {
735 779
     cmObj     obj;
@@ -770,8 +814,10 @@ extern "C" {
770 814
   // 
771 815
   cmRC_t   cmNmfExec( cmNmf_t* p, const cmReal_t* v, unsigned cn );
772 816
 
773
-
774 817
   //------------------------------------------------------------------------------------------------------------
818
+  //)
819
+
820
+  //( { label:cmVectArray file_desc:"Store and recall arrays of arbitrary length numeric vectors." kw:[proc]}
775 821
   // cmVectArray buffers row vectors of arbitrary length in  memory.
776 822
   // The buffers may then be access using the cmVectArrayGetXXX() functions.
777 823
   // The entire contents of the file may be written to a file using atVectArrayWrite().
@@ -943,7 +989,10 @@ extern "C" {
943 989
   cmRC_t   cmVectArrayFormVectColU( cmVectArray_t* p, unsigned groupIdx, unsigned groupCnt, unsigned colIdx, unsigned** vRef, unsigned* vnRef );
944 990
   cmRC_t   cmVectArrayTest( cmCtx* ctx, const char* fn, bool genFl );  
945 991
 
946
-  //-----------------------------------------------------------------------------------------------------------------------
992
+  //------------------------------------------------------------------------------------------------------------
993
+  //)
994
+
995
+  //( { label:cmWhFilt file_desc:"Spectral whitening filter." kw:[proc]}  
947 996
   // Spectral whitening filter.
948 997
   // Based on: Klapuri, A., 2006: Multiple fundamental frequency estimation by summing
949 998
   //  harmonic amplitudes.
@@ -967,6 +1016,9 @@ extern "C" {
967 1016
   cmRC_t    cmWhFiltExec( cmWhFilt* p, const cmReal_t* xV, cmReal_t* yV, unsigned xyN );
968 1017
 
969 1018
   //-----------------------------------------------------------------------------------------------------------------------
1019
+  //)
1020
+  
1021
+  //( { label:cmFrqTrk file_desc:"Track sinusoids from STFT frame data." kw:[proc]}  
970 1022
   typedef enum
971 1023
   {
972 1024
     kNoStateFrqTrkId,
@@ -1089,8 +1141,10 @@ extern "C" {
1089 1141
   cmRC_t    cmFrqTrkExec( cmFrqTrk* p, const cmReal_t* magV, const cmReal_t* phsV, const cmReal_t* hzV );
1090 1142
   void      cmFrqTrkPrint( cmFrqTrk* p );
1091 1143
 
1092
-  //------------------------------------------------------------------------------------------------------------
1093
-
1144
+  //-----------------------------------------------------------------------------------------------------------------------
1145
+  //)
1146
+  
1147
+  //( { label:cmFbCtl file_desc:"Perform acoustic feedback control by attenuating loud sinusoid signals." kw:[proc]}  
1094 1148
   typedef struct
1095 1149
   {
1096 1150
     double   srate;
@@ -1122,7 +1176,10 @@ extern "C" {
1122 1176
   cmRC_t     cmFbCtlFinal(cmFbCtl_t* p );
1123 1177
   cmRC_t     cmFbCtlExec( cmFbCtl_t* p, const cmReal_t* xV );
1124 1178
 
1125
-  //-----------------------------------------------------------------------------------------------------------------------
1179
+  //------------------------------------------------------------------------------------------------------------
1180
+  //)
1181
+  
1182
+  //( { label:cmExpander file_desc:"Expander implementation for audio dynamics processing." kw:[proc]}    
1126 1183
 
1127 1184
   typedef struct
1128 1185
   {
@@ -1148,7 +1205,11 @@ extern "C" {
1148 1205
   cmRC_t      cmExpanderFinal( cmExpander* p );
1149 1206
   cmRC_t      cmExpanderExec( cmExpander* p, cmSample_t* x, cmSample_t* y, unsigned xyN );
1150 1207
   cmRC_t      cmExpanderExecD( cmExpander* p, double* x, double* y, unsigned xyN );
1208
+
1151 1209
   //-----------------------------------------------------------------------------------------------------------------------
1210
+  //)
1211
+
1212
+  //( { label:cmExpanderBank file_desc:"Bank of audio dynamics expanders based on cmExpander." kw:[proc]}    
1152 1213
   typedef struct
1153 1214
   {
1154 1215
     cmObj obj;
@@ -1166,8 +1227,10 @@ extern "C" {
1166 1227
   cmRC_t      cmExpanderBankExec(  cmExpanderBank* p, cmSample_t* x, unsigned bandN );
1167 1228
   cmRC_t      cmExpanderBankExecD(  cmExpanderBank* p, double* x, unsigned bandN );
1168 1229
   
1169
-
1170
-  //------------------------------------------------------------------------------------------------------------
1230
+  //-----------------------------------------------------------------------------------------------------------------------
1231
+  //)
1232
+  
1233
+  //( { label:cmSpecDist file_desc:"Spectral distortion algorithm based on non-linear transform." kw:[proc]}    
1171 1234
 
1172 1235
   enum
1173 1236
   {
@@ -1224,6 +1287,7 @@ extern "C" {
1224 1287
     cmReal_t  aeUnit;
1225 1288
 
1226 1289
     cmReal_t ogain;
1290
+    cmReal_t ogain0;
1227 1291
 
1228 1292
     unsigned phaseModIndex;
1229 1293
 
@@ -1236,6 +1300,7 @@ extern "C" {
1236 1300
     cmReal_t*      oSpecM;      // oSpecMtx[hN binN]
1237 1301
     cmReal_t*      oSpecV;      // mean of rows of oSpecM
1238 1302
     cmVectArray_t* oSpecVa;
1303
+    cmVectArray_t* statVa;
1239 1304
 
1240 1305
   } cmSpecDist_t;
1241 1306
 
@@ -1246,8 +1311,11 @@ extern "C" {
1246 1311
   cmRC_t            cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn );
1247 1312
   const cmSample_t* cmSpecDistOut(  cmSpecDist_t* p );
1248 1313
 
1249
-
1250 1314
   //------------------------------------------------------------------------------------------------------------
1315
+  //)
1316
+  
1317
+  //( { label:cmBinMtxFile file_desc:"Write a binary matrix which can be read by readBinFile.m." kw:[proc]}
1318
+  
1251 1319
   // Write a binary matrix file in the format acceppted by the octave function readBinFile.m
1252 1320
 
1253 1321
   typedef struct cmBinMtxFile_str
@@ -1289,7 +1357,7 @@ extern "C" {
1289 1357
   // Use cmBinMtxFileSize() to determine the buffer size prior to calling this function.
1290 1358
   // colCntV[colCnt] is optional.
1291 1359
   cmRC_t cmBinMtxFileRead( cmCtx_t* ctx, const cmChar_t* fn, unsigned rowCnt, unsigned colCnt, unsigned eleByteCnt, void* buf, unsigned* colCntV );
1292
-
1360
+  //)
1293 1361
 
1294 1362
 
1295 1363
 

+ 79
- 29
cmProc3.h Voir le fichier

@@ -4,6 +4,10 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
+  //( { file_desc:"Processor Library 3" kw:[proclib]}
8
+  //)
9
+  
10
+  //( { label:cmPitchShift file_desc:"Time-domain pitch shifter based on sample rate conversion." kw:[proc]}    
7 11
 
8 12
   typedef struct
9 13
   {
@@ -45,7 +49,9 @@ extern "C" {
45 49
   cmRC_t        cmPitchShiftFinal(cmPitchShift* p );
46 50
   cmRC_t        cmPitchShiftExec( cmPitchShift* p, const cmSample_t* x, cmSample_t* y, unsigned n, double shiftRatio, bool bypassFl );
47 51
 
48
-  //=======================================================================================================================
52
+  //------------------------------------------------------------------------------------------------------------
53
+  //)
54
+  //( { label:cmLoopRecord file_desc:"Audio interactive loop recorder." kw:[proc]}    
49 55
 
50 56
   typedef struct
51 57
   {
@@ -90,7 +96,9 @@ extern "C" {
90 96
   cmRC_t        cmLoopRecordExec( cmLoopRecord* p, const cmSample_t* x, cmSample_t* y, unsigned xn, bool bypassFl, bool recdFl, bool playFl, double ratio, double pgain, double rgain );
91 97
 
92 98
 
93
-  //=======================================================================================================================
99
+  //------------------------------------------------------------------------------------------------------------
100
+  //)
101
+  //( { label:cmGateDetector file_desc:"Detect when a signal onsets and offsets." kw:[proc]}    
94 102
   typedef struct
95 103
   {
96 104
     cmObj       obj;
@@ -115,8 +123,9 @@ extern "C" {
115 123
   cmRC_t       cmGateDetectFinal(cmGateDetect* p );
116 124
   cmRC_t       cmGateDetectExec( cmGateDetect* p, const cmSample_t* x, unsigned xn );
117 125
   
118
-
119
-  //=======================================================================================================================
126
+  //------------------------------------------------------------------------------------------------------------
127
+  //)
128
+  //( { label:cmGateDetector2 file_desc:"Improved gate detector to detect when a signal onsets and offsets." kw:[proc]}    
120 129
   typedef struct
121 130
   {
122 131
     unsigned medCnt;       // length of the median filter
@@ -164,14 +173,17 @@ extern "C" {
164 173
 
165 174
 
166 175
   cmGateDetect2* cmGateDetectAlloc2( cmCtx* c, cmGateDetect2* p, unsigned procSmpCnt, const cmGateDetectParams* args );
167
-  cmRC_t       cmGateDetectFree2( cmGateDetect2** p );
168
-  cmRC_t       cmGateDetectInit2( cmGateDetect2* p, unsigned procSmpCnt, const cmGateDetectParams* args );
169
-  cmRC_t       cmGateDetectFinal2(cmGateDetect2* p );
170
-  cmRC_t       cmGateDetectExec2( cmGateDetect2* p, const cmSample_t* x, unsigned xn );
171
-  void       cmGateDetectSetOnThreshDb2( cmGateDetect2* p, cmReal_t db );
172
-  void       cmGateDetectSetOffThreshDb2( cmGateDetect2* p, cmReal_t db );
176
+  cmRC_t         cmGateDetectFree2( cmGateDetect2** p );
177
+  cmRC_t         cmGateDetectInit2( cmGateDetect2* p, unsigned procSmpCnt, const cmGateDetectParams* args );
178
+  cmRC_t         cmGateDetectFinal2(cmGateDetect2* p );
179
+  cmRC_t         cmGateDetectExec2( cmGateDetect2* p, const cmSample_t* x, unsigned xn );
180
+  void           cmGateDetectSetOnThreshDb2( cmGateDetect2* p, cmReal_t db );
181
+  void           cmGateDetectSetOffThreshDb2( cmGateDetect2* p, cmReal_t db );
173 182
 
174
-  //=======================================================================================================================
183
+  //------------------------------------------------------------------------------------------------------------
184
+  //)
185
+
186
+  //( { label:cmAutoGain file_desc:"Automatically balance a set of audio signals by adjusting their level." kw:[proc fluxo]}    
175 187
   
176 188
   //
177 189
   // Calculate a set of automatic gain adjustments for a set of audio channels.
@@ -230,7 +242,10 @@ extern "C" {
230 242
 
231 243
   void        cmAutoGainPrint( cmAutoGain* p, cmRpt_t* rpt );
232 244
 
233
-  //=======================================================================================================================
245
+  //------------------------------------------------------------------------------------------------------------
246
+  //)
247
+  
248
+  //( { label:cmChCfg file_desc:"Configure a 'fluxo' pickup channel." kw:[proc fluxo]}
234 249
   typedef struct
235 250
   {
236 251
     unsigned        ch;
@@ -261,8 +276,11 @@ extern "C" {
261 276
   void     cmChCfgPrint( cmChCfg* p, cmRpt_t* rpt );
262 277
   unsigned cmChCfgChannelCount( cmCtx_t* ctx, const cmChar_t* fn, unsigned* nsChCntPtr );
263 278
   unsigned cmChCfgChannelIndex( cmCtx_t* ctx, const cmChar_t* fn, unsigned chIdx );
279
+  
280
+  //------------------------------------------------------------------------------------------------------------
281
+  //)
264 282
 
265
-  //=======================================================================================================================
283
+  //( { label:cmChordDetector file_desc:"Chord detector based on evaluating signals from cmGateDetector2." kw:[proc]}    
266 284
 
267 285
   typedef struct 
268 286
   {
@@ -293,7 +311,10 @@ extern "C" {
293 311
   cmRC_t         cmChordDetectExec(  cmChordDetect* p, unsigned procSmpCnt, const bool* gateV, const cmReal_t* rmsV, unsigned chCnt );
294 312
   cmRC_t         cmChordDetectSetSpanMs( cmChordDetect* p, cmReal_t maxTimeSpanMs );
295 313
 
296
-  //=======================================================================================================================
314
+  //------------------------------------------------------------------------------------------------------------
315
+  //)
316
+
317
+  //( { label:cmXfader file_desc:"Audio cross fade controller." kw:[proc]}    
297 318
   // This object is not really a cross-fader.  It is really just a multichannel
298 319
   // fader - which just calculates the fade gain but does not actually apply it
299 320
   // to the audio signal - unless you use cmXfaderExecAudio()
@@ -335,7 +356,10 @@ extern "C" {
335 356
   void      cmXfaderAllOff( cmXfader* p );
336 357
   void      cmXfaderJumpToDestinationGain( cmXfader* p ); // jump to dest. gain based on gate state
337 358
 
338
-  //=======================================================================================================================
359
+  //------------------------------------------------------------------------------------------------------------
360
+  //)
361
+
362
+  //( { label:cmFader file_desc:"Fade in/out an audio signal based on the state of a gate control signal." kw:[proc]}      
339 363
   // This fader object accepts a gate signal. When the gate is high it increments
340 364
   // the gain until it reaches 1.0. When the gate is low it decrements the gain
341 365
   // until it reaches 0.0.  The fade time is the lenght of time the gain will take
@@ -355,7 +379,10 @@ extern "C" {
355 379
   cmRC_t    cmFaderExec(  cmFader* p, unsigned procSmpCnt, bool gateFl, bool mixFl, const cmSample_t* x, cmSample_t* y );
356 380
   void      cmFaderSetFadeTime( cmFader* p, cmReal_t fadeTimeMs );
357 381
 
358
-  //=======================================================================================================================
382
+  //------------------------------------------------------------------------------------------------------------
383
+  //)
384
+
385
+  //( { label:cmCombFilt file_desc:"Comb and Inverse Comb filter algorithm with a variable fractional delay." kw:[proc]}      
359 386
   struct cmIDelay_str;
360 387
   typedef struct
361 388
   {
@@ -384,7 +411,10 @@ extern "C" {
384 411
   void        cmCombFiltSetAlpha( cmCombFilt* p, cmReal_t alpha );
385 412
   cmRC_t      cmCombFiltSetHz( cmCombFilt* p, cmReal_t hz );
386 413
 
387
-  //=======================================================================================================================
414
+  //------------------------------------------------------------------------------------------------------------
415
+  //)
416
+
417
+  //( { label:cmDcFilt file_desc:"DC Filter algorithm." kw:[proc]}      
388 418
 
389 419
   typedef struct
390 420
   {
@@ -402,9 +432,10 @@ extern "C" {
402 432
   cmRC_t    cmDcFiltFinal( cmDcFilt* p );
403 433
   cmRC_t    cmDcFiltExec(  cmDcFilt* p, const cmSample_t* x, cmSample_t* y, unsigned n );
404 434
 
405
-  //=======================================================================================================================
406
-  
407
-  // interpolating delay - used by the comb filter
435
+  //------------------------------------------------------------------------------------------------------------
436
+  //)
437
+
438
+  //( { label:cmIDelay file_desc:"Variable interpolating fractional audio delay line." kw:[proc]}      
408 439
   
409 440
   typedef struct cmIDelay_str
410 441
   {
@@ -429,7 +460,10 @@ extern "C" {
429 460
   cmRC_t    cmIDelaySetTapMs( cmIDelay* p, unsigned tapIdx, cmReal_t tapMs );
430 461
   
431 462
   
432
-  //=======================================================================================================================
463
+  //------------------------------------------------------------------------------------------------------------
464
+  //)
465
+
466
+  //( { label:cmGroupSel file_desc:"Assign channel to dynamic groups under gate control." kw:[proc]}      
433 467
   
434 468
   // This object sequentially assigns channels to groups when their gates go high.
435 469
   // 'chsPerGroup' channels will be assigned to each group.  No channel will be
@@ -481,7 +515,10 @@ extern "C" {
481 515
   // and groups that will be removed on the next cycle have their 'releaseFl' set.
482 516
   cmRC_t      cmGroupSelExec( cmGroupSel* p );
483 517
   
484
-  //=======================================================================================================================
518
+  //------------------------------------------------------------------------------------------------------------
519
+  //)
520
+
521
+  //( { label:cmAudioNofM file_desc:"Route N of M possible input channels to N output channels under gate control." kw:[proc]}      
485 522
   
486 523
   // Route N of M input channels to N output channels.
487 524
   // The N channels are selected from the first N gates to go high.
@@ -526,7 +563,10 @@ extern "C" {
526 563
   cmRC_t       cmAudioNofMSetFadeMs( cmAudioNofM* p, cmReal_t fadeTimeMs );
527 564
 
528 565
 
529
-  //=======================================================================================================================
566
+  //------------------------------------------------------------------------------------------------------------
567
+  //)
568
+
569
+  //( { label:cmAdsr file_desc:"ADSR audio evelope generator." kw:[proc]}      
530 570
 
531 571
   enum { kDlyAdsrId, kAtkAdsrId, kDcyAdsrId, kSusAdsrId, kRlsAdsrId, kDoneAdsrId };
532 572
 
@@ -546,9 +586,6 @@ extern "C" {
546 586
     cmReal_t susLevel;
547 587
     int      rlsSmp;
548 588
 
549
-
550
-
551
-
552 589
     unsigned state;             // current state
553 590
     int      durSmp;            // time in current state
554 591
     cmReal_t level;             // current level 
@@ -575,7 +612,10 @@ extern "C" {
575 612
   void      cmAdsrSetLevel( cmAdsr* p, cmReal_t level, unsigned id );
576 613
   void      cmAdsrReport( cmAdsr* p, cmRpt_t* rpt );
577 614
 
578
-  //=======================================================================================================================
615
+  //------------------------------------------------------------------------------------------------------------
616
+  //)
617
+
618
+  //( { label:cmCompressor file_desc:"Audio dynamics compressor algorithm." kw:[proc]}      
579 619
   enum { kAtkCompId, kRlsCompId };
580 620
 
581 621
   typedef struct
@@ -616,7 +656,11 @@ extern "C" {
616 656
   void    cmCompressorSetThreshDb(  cmCompressor* p, cmReal_t thresh );
617 657
   void    cmCompressorSetRmsWndMs( cmCompressor* p, cmReal_t ms );
618 658
 
619
-  //=======================================================================================================================
659
+  
660
+  //------------------------------------------------------------------------------------------------------------
661
+  //)
662
+
663
+  //( { label:cmBiQuad file_desc:"General purpose Biquad filter algorithm." kw:[proc]}      
620 664
 
621 665
   // BiQuad Audio Eq's based on Robert Bristow-Johnson's recipes.
622 666
   // http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
@@ -660,7 +704,10 @@ extern "C" {
660 704
   void        cmBiQuadEqSet( cmBiQuadEq* p, unsigned mode, cmReal_t f0Hz, cmReal_t Q, cmReal_t gainDb );
661 705
 
662 706
 
663
-  //=======================================================================================================================
707
+  //------------------------------------------------------------------------------------------------------------
708
+  //)
709
+
710
+  //( { label:cmDistDs file_desc:"Guitar style distortion effect." kw:[proc]}      
664 711
   typedef struct
665 712
   {
666 713
     cmObj      obj;
@@ -686,7 +733,10 @@ extern "C" {
686 733
   cmRC_t    cmDistDsInit( cmDistDs* p, cmReal_t srate, cmReal_t inGain, cmReal_t downSrate, cmReal_t bits, bool rectFl, bool fullFl, cmReal_t clipDb, cmReal_t outGain, bool bypassFl );
687 734
   cmRC_t    cmDistDsFinal( cmDistDs* p );
688 735
   cmRC_t    cmDistDsExec(  cmDistDs* p, const cmSample_t* x, cmSample_t* y, unsigned n );
736
+  //------------------------------------------------------------------------------------------------------------
737
+  //)
689 738
 
739
+  
690 740
   //=======================================================================================================================
691 741
   /*
692 742
   typedef struct

+ 7
- 0
cmProc4.c Voir le fichier

@@ -2693,6 +2693,7 @@ typedef struct
2693 2693
 
2694 2694
 _cmScModTypeMap_t _cmScModTypeArray[] =
2695 2695
 {
2696
+  { kDeclModTId,    0, "decl" },
2696 2697
   { kSetModTId,     1, "set" },
2697 2698
   { kLineModTId,    2, "line" },
2698 2699
   { kSetLineModTId, 3, "sline" },
@@ -3164,6 +3165,7 @@ cmRC_t _cmScModActivate(cmScModulator* p, cmScModEntry_t* ep )
3164 3165
 
3165 3166
   switch( ep->typeId )
3166 3167
   {
3168
+    case kDeclModTId:
3167 3169
     case kSetModTId:
3168 3170
       break;
3169 3171
 
@@ -3220,6 +3222,11 @@ bool  _cmScModExec( cmScModulator* p, cmScModVar_t* vp )
3220 3222
 
3221 3223
   switch( vp->entry->typeId )
3222 3224
   {
3225
+    case kDeclModTId:
3226
+      sendFl = false;
3227
+      fl     = true;
3228
+      break;
3229
+      
3223 3230
     case kSetModTId:
3224 3231
       {
3225 3232
         if((rc = _cmScModGetParam(p,&vp->entry->beg,&vp->value)) != cmOkRC )

+ 27
- 12
cmProc4.h Voir le fichier

@@ -5,11 +5,12 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Processor Library 4" kw:[proclib]}
9
+  //)
8 10
 
9
-  //=======================================================================================================================  
10
-  //
11
-  // Simplified string alignment function based on Levenshtein edit distance.
12
-  //
11
+  
12
+  //( { label:cmEditDist file_desc:"Simplified string alignment function based on Levenshtein edit distance." kw:[proc] } 
13
+  
13 14
   enum { kEdMinIdx, kEdSubIdx, kEdDelIdx, kEdInsIdx, kEdCnt };
14 15
 
15 16
   typedef struct
@@ -87,7 +88,10 @@ extern "C" {
87 88
   // Main test function.
88 89
   void ed_main();
89 90
 
90
-  //=======================================================================================================================
91
+  //------------------------------------------------------------------------------------------------------------
92
+  //)
93
+
94
+  //( { label:cmScoreMatch file_desc:"Event oriented local score matching algorithm based on edit distance." kw:[proc] } 
91 95
   enum 
92 96
   { 
93 97
     kSmMinIdx, // 
@@ -200,9 +204,10 @@ extern "C" {
200 204
   // necessarily an error.
201 205
   cmRC_t     cmScMatchExec(  cmScMatch* p, unsigned locIdx, unsigned locN, const cmScMatchMidi_t* midiV, unsigned midiN, double min_cost );
202 206
 
203
-  //=======================================================================================================================
204
-
207
+  //------------------------------------------------------------------------------------------------------------
208
+  //)
205 209
 
210
+  //( { label:cmScoreMatcher file_desc:"MIDI score following algorithm based cmScoreMatch." kw:[proc] } 
206 211
   typedef struct
207 212
   {
208 213
     unsigned locIdx;    // index into cmScMatch_t.loc[]
@@ -246,8 +251,6 @@ extern "C" {
246 251
     bool                 printFl;
247 252
   } cmScMatcher;
248 253
 
249
-
250
-
251 254
   cmScMatcher* cmScMatcherAlloc( 
252 255
     cmCtx*          c,        // Program context.
253 256
     cmScMatcher*    p,        // Existing cmScMatcher to reallocate or NULL to allocate a new cmScMatcher.
@@ -310,7 +313,10 @@ extern "C" {
310 313
 
311 314
   void cmScMatcherPrint( cmScMatcher* p );
312 315
 
313
-  //=======================================================================================================================
316
+  //------------------------------------------------------------------------------------------------------------
317
+  //)
318
+
319
+  //( { label:cmScMeas file_desc:"Measure and report some differences between the score and the performance." kw:[proc] } 
314 320
 
315 321
   typedef struct
316 322
   {
@@ -391,7 +397,10 @@ extern "C" {
391 397
   // notes in each marker region and the score. 
392 398
   void       cmScAlignScanMarkers(  cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH );
393 399
 
394
-  //=======================================================================================================================
400
+  //------------------------------------------------------------------------------------------------------------
401
+  //)
402
+
403
+  //( { label:cmScMod file_desc:"Store and recall parameter information under score follower control." kw:[proc] } 
395 404
   /*
396 405
     Syntax: <loc> <mod> <var> <type>   <params>
397 406
     <loc> - score location
@@ -421,6 +430,7 @@ extern "C" {
421 430
   enum
422 431
   {
423 432
     kInvalidModTId,
433
+    kDeclModTId,     // declare a variable but do not associate a value with it (allows a variable to be connected to w/o sending a value) 
424 434
     kSetModTId,      // set variable to parray[0] at scLocIdx
425 435
     kLineModTId,     // linear ramp variable to parray[0] over parray[1] seconds
426 436
     kSetLineModTId,  // set variable to parray[0] and ramp to parray[1] over parray[2] seconds
@@ -522,7 +532,10 @@ extern "C" {
522 532
   cmRC_t         cmScModulatorExec(  cmScModulator* p, unsigned scLocIdx );
523 533
   cmRC_t         cmScModulatorDump(  cmScModulator* p );
524 534
 
525
-  //=======================================================================================================================
535
+  //------------------------------------------------------------------------------------------------------------
536
+  //)
537
+
538
+  //( { label:cmRecdPlay file_desc:"Record fragments of audio, store them,and play them back at a later time." kw:[proc] } 
526 539
   //
527 540
   // Record fragments of audio, store them, and play them back at a later time.
528 541
   //
@@ -593,7 +606,9 @@ extern "C" {
593 606
   cmRC_t         cmRecdPlayBeginFade(   cmRecdPlay* p, unsigned labelSymId, double fadeDbPerSec );
594 607
 
595 608
   cmRC_t         cmRecdPlayExec(        cmRecdPlay* p, const cmSample_t** iChs, cmSample_t** oChs, unsigned chCnt, unsigned smpCnt );
609
+  //)
596 610
 
611
+  
597 612
 #ifdef __cplusplus
598 613
 }
599 614
 #endif

+ 22
- 16
cmProc5.h Voir le fichier

@@ -5,10 +5,11 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Process Library 5", kw:[proclib]}
9
+  //)
8 10
 
9
-  //=======================================================================================================================
10
-  // Goertzel Filter
11
-  //
11
+  
12
+  //( { label:cmGoertzel file_desc:"Goertzel tone detection filter." kw:[proc]}
12 13
 
13 14
   typedef struct
14 15
   {
@@ -38,10 +39,10 @@ extern "C" {
38 39
   cmRC_t cmGoertzelSetFcHz( cmGoertzel* p, unsigned chIdx, double hz );
39 40
   cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt,  double* outV, unsigned chCnt );
40 41
 
42
+  //------------------------------------------------------------------------------------------------------------
43
+  //)
41 44
 
42
-  //=======================================================================================================================
43
-  // Gold Code Signal Generator
44
-  //
45
+  //( { label:cmGoldCode file_desc:"Gold code random generator." kw:[proc]}
45 46
 
46 47
   typedef struct
47 48
   {
@@ -110,9 +111,10 @@ extern "C" {
110 111
   cmRC_t cmGoldSigTest( cmCtx* ctx );
111 112
 
112 113
 
113
-  //=======================================================================================================================
114
-  // Phase aligned transform generalized cross correlator
115
-  //
114
+  //------------------------------------------------------------------------------------------------------------
115
+  //)
116
+
117
+  //( { label:cmPhat file_desc:"Phase-aligned transform for generalized cross correlator." kw:[proc]}
116 118
 
117 119
   // Flags for use with the 'flags' argument to cmPhatAlloc() 
118 120
   enum
@@ -192,9 +194,10 @@ extern "C" {
192 194
   cmRC_t cmPhatWrite( cmPhat_t* p, const char* dirStr );
193 195
 
194 196
 
195
-  //=======================================================================================================================
196
-  // 
197
-  //
197
+  //------------------------------------------------------------------------------------------------------------
198
+  //)
199
+
200
+  //( { label:cmReflectCal file_desc:"Calculate the time of flight of Gold code acoustic reflections." kw:[proc]}
198 201
 
199 202
 
200 203
   typedef struct
@@ -225,9 +228,11 @@ extern "C" {
225 228
   cmRC_t cmReflectCalcExec(  cmReflectCalc_t* p, const cmSample_t* xV, cmSample_t* yV, unsigned xyN );
226 229
   cmRC_t cmReflectCalcWrite( cmReflectCalc_t* p, const char* dirStr );
227 230
 
228
-  //=======================================================================================================================
229
-  // 
230
-  //
231
+  //------------------------------------------------------------------------------------------------------------
232
+  //)
233
+
234
+  //( { label:cmNlms file_desc:"Normalized least mean squares echo canceller." kw:[proc]}
235
+  
231 236
   typedef struct
232 237
   {
233 238
     cmObj          obj;
@@ -260,7 +265,8 @@ extern "C" {
260 265
   void        cmNlmsEcSetMu(     cmNlmsEc_t* p, float mu );
261 266
   void        cmNlmsEcSetDelayN( cmNlmsEc_t* p, unsigned delayN );
262 267
   void        cmNlmsEcSetIrN(    cmNlmsEc_t* p, unsigned irN );
263
-  
268
+  //)
269
+
264 270
   
265 271
 #ifdef __cplusplus
266 272
 }

+ 3
- 2
cmProcObj.h Voir le fichier

@@ -5,7 +5,7 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  /*
8
+  /*( { file_desc:"Base class for all 'proc' objects." kw:[proclib] } 
9 9
 
10 10
     The first field in all objects must be an cmObj record.
11 11
 
@@ -164,7 +164,8 @@ extern "C" {
164 164
 #define cmMtxFileRealExecN(f,p,n,s) cmMtxFileDoubleExec((f),(p),(n),(s))
165 165
 #endif
166 166
 
167
-
167
+  //)
168
+  
168 169
 #ifdef __cplusplus
169 170
 }
170 171
 #endif

+ 3
- 0
cmRbm.h Voir le fichier

@@ -5,6 +5,7 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Restricted Bolzmann Machine object." kw:[model] }
8 9
 enum
9 10
 {
10 11
   kOkRbmRC = cmOkRC,
@@ -38,6 +39,8 @@ enum
38 39
 
39 40
   void cmRbmBinaryTest(cmCtx_t* ctx);
40 41
 
42
+  //)
43
+  
41 44
 #ifdef __cplusplus
42 45
 }
43 46
 #endif

+ 1
- 1
cmRpt.c Voir le fichier

@@ -11,7 +11,7 @@ cmRpt_t cmRptNull = { NULL, NULL, NULL };
11 11
 void _cmDefaultPrint( void* userPtr, const cmChar_t* text )
12 12
 { 
13 13
   if( text != NULL )
14
-    fputs(text,stdin);
14
+    fputs(text,stdout);
15 15
 }
16 16
 
17 17
 void _cmDefaultError( void* userPtr, const cmChar_t* text )

+ 1
- 4
cmRpt.h Voir le fichier

@@ -5,12 +5,10 @@
5 5
 #ifdef __cplusplus
6 6
 extern "C" {
7 7
 #endif
8
-  //{
9 8
 
10 9
   
11
-  //(
10
+  //( { file_desc: "The cmRpt class provides console style output for all objects in the cm system." kw:[base]}
12 11
   // 
13
-  // The cmRpt class provides console style output for all objects in the cm system.
14 12
   // 
15 13
   // The cmRpt class provides console output style output, like stdout and stderr
16 14
   // for most of the classes in the cm library.
@@ -51,7 +49,6 @@ extern "C" {
51 49
   void cmRptVErrorf( cmRpt_t* rpt, const cmChar_t* fmt, va_list vl );
52 50
   void cmRptErrorf(  cmRpt_t* rpt, const cmChar_t* fmt, ... );
53 51
   //)
54
-  //}
55 52
 
56 53
 #ifdef __cplusplus
57 54
   }

+ 4
- 1
cmRtNet.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"rtSys networking component." kw:[rtsys network] }
9
+  
8 10
   /*
9 11
    Nodes and Endpoints:
10 12
    ---------------------
@@ -202,7 +204,8 @@ extern "C" {
202 204
         4)  The symbol -=- in the flow chart implies a network transmission.
203 205
 
204 206
    */  
205
-
207
+  //)
208
+  
206 209
 #ifdef __cplusplus
207 210
 }
208 211
 #endif

+ 4
- 7
cmRtSys.h Voir le fichier

@@ -1,5 +1,4 @@
1
-// cmRtSys.h
2
-// Implements a real-time audio processing engine.
1
+//( { file_desc:"Improved real-time audio processing engine." kw:[rtsys] }
3 2
 //
4 3
 // The audio system is composed a collection of independent sub-systems.
5 4
 // Each sub-system maintains a thread which runs asynchrounsly
@@ -48,10 +47,7 @@
48 47
 // Messages arriving while the mutex is locked are queued and
49 48
 // delivered to the DSP procedure at the end of the DSP execution
50 49
 // procedure.
51
-//
52
-// Usage example and testing code:
53
-// See  cmRtSysTest().
54
-// \snippet cmRtSys.c cmRtSysTest
50
+//)
55 51
 
56 52
 #ifndef cmRtSys_h
57 53
 #define cmRtSys_h
@@ -60,6 +56,7 @@
60 56
 extern "C" {
61 57
 #endif
62 58
 
59
+  //(
63 60
   // Audio system result codes
64 61
   enum
65 62
   {
@@ -329,7 +326,7 @@ extern "C" {
329 326
   cmRtRC_t cmRtSysNetReport( cmRtSysH_t h );
330 327
   cmRtRC_t cmRtSysNetReportSyncEnable( cmRtSysH_t h, bool enableFl );
331 328
   cmRtRC_t cmRtSysNetGetHandle( cmRtSysH_t h, unsigned rtSubIdx, cmRtNetH_t* hp );
332
-
329
+  //)
333 330
 
334 331
 #ifdef __cplusplus
335 332
 }

+ 4
- 2
cmRtSysMsg.h Voir le fichier

@@ -4,7 +4,8 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
-
7
+  //( { file_desc:"rtSys message contants and data structures." kw:[rtsys] }
8
+  
8 9
   // Reserved DSP message selector id's (second field of all 
9 10
   // host<->audio system messages)
10 11
   enum
@@ -105,7 +106,8 @@ extern "C" {
105 106
     // char msg[ msgByteCnt ]
106 107
   } cmRtNetMsg_t;
107 108
 
108
-
109
+  //)
110
+  
109 111
 #ifdef __cplusplus
110 112
 }
111 113
 #endif

+ 2
- 9
cmSerialize.h Voir le fichier

@@ -5,14 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  //{
9
-  //(
10
-  // cmSerialize is an API for serializing data structures into 
11
-  // byte streams and then deserializing them back into data structures.
12
-  //
13
-  //)
14
-
15
-  //(
8
+  //( { file_desc:" An API for serializing data structures into byte streams and then deserializing them back into data structures." kw:[base]}
9
+  
16 10
 
17 11
   // Result codes
18 12
   enum
@@ -299,7 +293,6 @@ extern "C" {
299 293
   cmSrRC_t cmSrTest( cmCtx_t* ctx );
300 294
 
301 295
   //)
302
-  //}
303 296
 
304 297
 #ifdef __cplusplus
305 298
 }

+ 4
- 1
cmStack.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Push-down stack data structure for binary blobs." kw:[container] }
9
+  
8 10
   enum
9 11
   {
10 12
     kOkStRC = cmOkRC,
@@ -62,7 +64,8 @@ extern "C" {
62 64
 
63 65
 #define cmStackEle(h,t,i) (*(t*)cmStackGet(h,i))
64 66
 
65
-
67
+  //)
68
+  
66 69
 #ifdef __cplusplus
67 70
 }
68 71
 #endif

+ 4
- 0
cmStrStream.h Voir le fichier

@@ -6,6 +6,8 @@
6 6
 extern "C" {
7 7
 #endif
8 8
 
9
+  //( { file_desc:"String stream text sink." kw:[text] }
10
+  
9 11
   enum
10 12
   {
11 13
     kOkSsRC = cmOkRC,
@@ -34,6 +36,8 @@ extern "C" {
34 36
   void*     cmOStrStreamAllocBuf(  cmStrStreamH_t h );
35 37
   cmChar_t* cmOStrStreamAllocText( cmStrStreamH_t h );
36 38
 
39
+  //)
40
+  
37 41
 #ifdef __cplusplus
38 42
 }
39 43
 #endif

+ 1
- 7
cmSymTbl.h Voir le fichier

@@ -4,13 +4,8 @@
4 4
 #ifdef __cplusplus
5 5
 extern "C" {
6 6
 #endif
7
-  //{
8
-  //(
9
-  //  Symbol table component.
10
-  //)
11
-
7
+  //( { file_desc:"Symbol table object." kw:[base] }
12 8
   
13
-  //(
14 9
   typedef cmHandle_t cmSymTblH_t;
15 10
 
16 11
   extern cmSymTblH_t cmSymTblNullHandle;
@@ -61,7 +56,6 @@ extern "C" {
61 56
   void        cmSymTblTest(cmCtx_t* ctx);
62 57
   
63 58
   //)
64
-  //}
65 59
 
66 60
 #ifdef __cplusplus
67 61
 }

+ 4
- 0
cmTagFile.h Voir le fichier

@@ -5,6 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
+  //( { file_desc:"Read a 'ctags' output file." kw:[file] }
9
+  
8 10
   // Read a ctags file generated by:
9 11
   //
10 12
   // ctags --c-kinds=+p --fields=+n  file.h
@@ -61,6 +63,8 @@ extern "C" {
61 63
 
62 64
   cmTfRC_t cmTfTest( cmCtx_t* ctx, const cmChar_t* fn );
63 65
 
66
+  //)
67
+  
64 68
 #ifdef __cplusplus
65 69
 }
66 70
 #endif

+ 4
- 2
cmTaskMgr.h Voir le fichier

@@ -5,7 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  /*
8
+  /*( { file_desc:"Task manager for controlling and monitoring tasks running in independent thread." kw:[parallel]}
9
+
9 10
     Usage:
10 11
     1) Use cmTaskMgrInstall() to register a worker function 
11 12
     (cmTaskMgrFunc_t) with the task manager.
@@ -353,7 +354,8 @@ extern "C" {
353 354
   cmTmWorkerRC_t cmTaskMgrWorkerMsgSend( cmTaskMgrFuncArg_t* a, const void* buf, unsigned bufByteCnt );
354 355
 
355 356
   cmTmRC_t cmTaskMgrTest(cmCtx_t* ctx);
356
-
357
+  //)
358
+  
357 359
 #ifdef __cplusplus
358 360
 }
359 361
 #endif

+ 2
- 3
cmText.h Voir le fichier

@@ -5,8 +5,8 @@
5 5
 extern "C" {
6 6
 #endif
7 7
 
8
-  //{
9
-  //(
8
+  //( { file_desc:"Text processing functions." kw:[text]}
9
+  //
10 10
   // The cmText API supports two basic tasks: the generation of
11 11
   // formatted text into dynamic arrays and text to number parsing.
12 12
   // 
@@ -297,7 +297,6 @@ extern "C" {
297 297
 
298 298
 
299 299
   //)
300
-  //}
301 300
 
302 301
 #ifdef __cplusplus
303 302
 }

+ 55
- 49
cmTextTemplate.h Voir le fichier

@@ -1,55 +1,61 @@
1 1
 #ifndef cmTextTemplate_h
2 2
 #define cmTextTemplate_h
3 3
 
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
4 7
 
5
-enum
6
-{
7
-  kOkTtRC = cmOkRC,
8
-  kFileFailTtRC,
9
-  kLHeapFailTtRC,
10
-  kSyntaxErrTtRC,
11
-  kFindFailTtRC,
12
-  kInvalidTypeTtRC,
13
-  kJsonFailTtRC
14
-};
15
-
16
-typedef cmHandle_t cmTtH_t;
17
-typedef unsigned   cmTtRC_t;
18
-extern cmTtH_t cmTtNullHandle;
19
-
20
-// Initialize a template file.
21
-cmTtRC_t cmTextTemplateInitialize( cmCtx_t* ctx, cmTtH_t* hp, const cmChar_t* fn );
22
-
23
-// Finalize a template file
24
-cmTtRC_t cmTextTemplateFinalize( cmTtH_t* hp );
25
-
26
-// Return true if the template file is intialized.
27
-bool     cmTextTemplateIsValid( cmTtH_t h );
28
-
29
-// Set the value of a template variable.
30
-// The node identified by { label,index, label, index ... } must
31
-// be a variable node.  The function will fail if a 'set' or 'text' node
32
-// is identified.
33
-// Set 'value' to NULL to erase a previously set value.
34
-cmTtRC_t cmTextTemplateSetValue( cmTtH_t h, const cmChar_t* value, const cmChar_t* label, unsigned index, ... );
35
-
36
-// Create a copy of the sub-tree identified by the variable path
37
-// and insert it as the left sibling of the sub-tree's root.
38
-cmTtRC_t cmTextTemplateRepeat( cmTtH_t h, const cmChar_t* label, unsigned index, ... );
39
-
40
-// Write the template file.
41
-cmTtRC_t cmTextTemplateWrite( cmTtH_t h, const cmChar_t* fn );
42
-
43
-// Apply a template value JSON file to this template
44
-cmTtRC_t cmTextTemplateApply( cmTtH_t h, const cmChar_t* fn );
45
-
46
-
47
-// Print an annotated template tree.
48
-void cmTtPrintTree( cmTtH_t h, cmRpt_t* rpt );
49
-
50
-
51
-cmTtRC_t cmTextTemplateTest( cmCtx_t* ctx, const cmChar_t* fn );
52
-
53
-
8
+  //( { file_desc:"Generate text using templates with replaceable variables." kw:[text] }
9
+  enum
10
+  {
11
+    kOkTtRC = cmOkRC,
12
+    kFileFailTtRC,
13
+    kLHeapFailTtRC,
14
+    kSyntaxErrTtRC,
15
+    kFindFailTtRC,
16
+    kInvalidTypeTtRC,
17
+    kJsonFailTtRC
18
+  };
19
+
20
+  typedef cmHandle_t cmTtH_t;
21
+  typedef unsigned   cmTtRC_t;
22
+  extern  cmTtH_t    cmTtNullHandle;
23
+
24
+  // Initialize a template file.
25
+  cmTtRC_t cmTextTemplateInitialize( cmCtx_t* ctx, cmTtH_t* hp, const cmChar_t* fn );
26
+
27
+  // Finalize a template file
28
+  cmTtRC_t cmTextTemplateFinalize( cmTtH_t* hp );
29
+
30
+  // Return true if the template file is intialized.
31
+  bool     cmTextTemplateIsValid( cmTtH_t h );
32
+
33
+  // Set the value of a template variable.
34
+  // The node identified by { label,index, label, index ... } must
35
+  // be a variable node.  The function will fail if a 'set' or 'text' node
36
+  // is identified.
37
+  // Set 'value' to NULL to erase a previously set value.
38
+  cmTtRC_t cmTextTemplateSetValue( cmTtH_t h, const cmChar_t* value, const cmChar_t* label, unsigned index, ... );
39
+
40
+  // Create a copy of the sub-tree identified by the variable path
41
+  // and insert it as the left sibling of the sub-tree's root.
42
+  cmTtRC_t cmTextTemplateRepeat( cmTtH_t h, const cmChar_t* label, unsigned index, ... );
43
+
44
+  // Write the template file.
45
+  cmTtRC_t cmTextTemplateWrite( cmTtH_t h, const cmChar_t* fn );
46
+
47
+  // Apply a template value JSON file to this template
48
+  cmTtRC_t cmTextTemplateApply( cmTtH_t h, const cmChar_t* fn );
49
+
50
+  // Print an annotated template tree.
51
+  void cmTtPrintTree( cmTtH_t h, cmRpt_t* rpt );
52
+
53
+  cmTtRC_t cmTextTemplateTest( cmCtx_t* ctx, const cmChar_t* fn );
54
+  
55
+  //)
56
+  
57
+#ifdef __cplusplus
58
+}
59
+#endif
54 60
 
55 61
 #endif

+ 0
- 0
cmThread.h Voir le fichier


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff

Chargement…
Annuler
Enregistrer