cmMidiFile.h/c : Added cmMidiFileReport().

This commit is contained in:
kevin 2017-12-17 13:41:58 -05:00
parent f028c892ad
commit d490c05b72
2 changed files with 33 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "cmErr.h"
#include "cmCtx.h"
#include "cmFile.h"
#include "cmRptFile.h"
#include "cmMem.h"
#include "cmMallocDebug.h"
#include "cmLinkedHeap.h"
@ -2071,6 +2072,35 @@ cmMfRC_t cmMidiFileGenSvgFile( cmCtx_t* ctx, const cmChar_t* midiFn, const cmCha
return rc;
}
cmMfRC_t cmMidiFileReport( cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* outTextFn )
{
cmMidiFileH_t mfH = cmMidiFileNullHandle;
cmRptFileH_t rptH = cmRptFileNullHandle;
cmMfRC_t rc;
if((rc = cmMidiFileOpen(ctx,&mfH,midiFn)) != kOkMfRC )
{
rc = cmErrMsg(&ctx->err,rc,"Unable to open the MIDI file: %s\n",cmStringNullGuard(midiFn));
goto errLabel;
}
if(( rc = cmRptFileCreate(ctx,&rptH, outTextFn, NULL )) != kOkRfRC )
{
rc = cmErrMsg(&ctx->err,rc,"Unable to open the report file: %s\n",cmStringNullGuard(outTextFn));
goto errLabel;
}
cmMidiFilePrintMsgs(mfH, cmRptFileRpt(rptH) );
errLabel:
cmRptFileClose(&rptH);
cmMidiFileClose(&mfH);
return rc;
}
void cmMidiFilePrintControlNumbers( cmCtx_t* ctx, const char* fn )
{
cmMidiFileH_t h = cmMidiFileNullHandle;

View File

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