Browse Source

cmMidiFile.h/c : Added cmMidiFileReport().

master
kevin 6 years ago
parent
commit
d490c05b72
2 changed files with 33 additions and 0 deletions
  1. 30
    0
      cmMidiFile.c
  2. 3
    0
      cmMidiFile.h

+ 30
- 0
cmMidiFile.c View File

@@ -4,6 +4,7 @@
4 4
 #include "cmErr.h"
5 5
 #include "cmCtx.h"
6 6
 #include "cmFile.h"
7
+#include "cmRptFile.h"
7 8
 #include "cmMem.h"
8 9
 #include "cmMallocDebug.h"
9 10
 #include "cmLinkedHeap.h"
@@ -2071,6 +2072,35 @@ cmMfRC_t cmMidiFileGenSvgFile( cmCtx_t* ctx, const cmChar_t* midiFn, const cmCha
2071 2072
   return rc;
2072 2073
 }
2073 2074
 
2075
+cmMfRC_t  cmMidiFileReport(     cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* outTextFn )
2076
+{
2077
+  cmMidiFileH_t mfH = cmMidiFileNullHandle;
2078
+  cmRptFileH_t  rptH = cmRptFileNullHandle;
2079
+  cmMfRC_t rc;
2080
+  
2081
+  if((rc = cmMidiFileOpen(ctx,&mfH,midiFn)) != kOkMfRC )
2082
+  {
2083
+    rc = cmErrMsg(&ctx->err,rc,"Unable to open the MIDI file: %s\n",cmStringNullGuard(midiFn));
2084
+    goto errLabel;
2085
+  }
2086
+
2087
+  if(( rc = cmRptFileCreate(ctx,&rptH, outTextFn, NULL )) != kOkRfRC )
2088
+  {
2089
+    rc = cmErrMsg(&ctx->err,rc,"Unable to open the report file: %s\n",cmStringNullGuard(outTextFn));
2090
+    goto errLabel;
2091
+    
2092
+  }
2093
+
2094
+  cmMidiFilePrintMsgs(mfH, cmRptFileRpt(rptH) );
2095
+
2096
+ errLabel:
2097
+  cmRptFileClose(&rptH);
2098
+  cmMidiFileClose(&mfH);
2099
+
2100
+  return rc;
2101
+}
2102
+
2103
+
2074 2104
 void cmMidiFilePrintControlNumbers( cmCtx_t* ctx, const char* fn )
2075 2105
 {
2076 2106
   cmMidiFileH_t h = cmMidiFileNullHandle;

+ 3
- 0
cmMidiFile.h View File

@@ -231,6 +231,9 @@ extern "C" {
231 231
 
232 232
   cmMfRC_t             cmMidiFileGenSvgFile( cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* outSvgFn, const cmChar_t* cssFn );
233 233
 
234
+  // Generate a text file reportusing cmMIdiFilePrintMsgs()
235
+  cmMfRC_t             cmMidiFileReport(     cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* outTextFn );
236
+
234 237
   void                  cmMidiFileTest( const char* fn, cmCtx_t* ctx );
235 238
 
236 239
 

Loading…
Cancel
Save