cmMidiFile.h/c _cmMidiFileClose() is now called by cmMidiFileOpen() on the incoming handle.

This commit is contained in:
kpl 2012-11-26 23:03:35 -08:00
parent fdf1a7c15a
commit d32c47be4c
2 changed files with 19 additions and 10 deletions

View File

@ -459,6 +459,10 @@ cmMfRC_t cmMidiFileOpen( const char* fn, cmMidiFileH_t* hPtr, cmCtx_t* ctx )
unsigned short trkIdx = 0;
cmErr_t err;
if( cmMidiFileIsValid(*hPtr) )
if((rc = _cmMidiFileClose(_cmMidiFileHandleToPtr(*hPtr))) != kOkMfRC )
return rc;
cmErrSetup(&err,&ctx->rpt,"MIDI File");
// allocate the midi file object
@ -600,6 +604,9 @@ cmMfRC_t cmMidiFileClose( cmMidiFileH_t* h )
return rc;
}
bool cmMidiFileIsValid( cmMidiFileH_t h )
{ return !cmMidiFileIsNull(h); }
unsigned cmMidiFileTrackCount( cmMidiFileH_t h )
{
_cmMidiFile_t* mfp;

View File

@ -107,6 +107,8 @@ extern "C" {
cmMfRC_t cmMidiFileOpen( const char* fn, cmMidiFileH_t* hPtr, cmCtx_t* ctx );
cmMfRC_t cmMidiFileClose( cmMidiFileH_t* hp );
bool cmMidiFileIsValid( cmMidiFileH_t h );
// Returns track count or kInvalidCnt if 'h' is invalid.
unsigned cmMidiFileTrackCount( cmMidiFileH_t h );