|
@@ -1907,6 +1907,38 @@ void cmMidiFilePrintTracks( cmMidiFileH_t h, unsigned trkIdx, cmRpt_t* rpt )
|
1907
|
1907
|
void cmMidiFileTestPrint( void* printDataPtr, const char* fmt, va_list vl )
|
1908
|
1908
|
{ vprintf(fmt,vl); }
|
1909
|
1909
|
|
|
1910
|
+cmMidiFileDensity_t* cmMidiFileNoteDensity( cmMidiFileH_t h, unsigned* cntRef )
|
|
1911
|
+{
|
|
1912
|
+ int msgN = cmMidiFileMsgCount(h);
|
|
1913
|
+ const cmMidiTrackMsg_t** msgs = cmMidiFileMsgArray(h);
|
|
1914
|
+ cmMidiFileDensity_t* dV = cmMemAllocZ(cmMidiFileDensity_t,msgN);
|
|
1915
|
+
|
|
1916
|
+ int i,j,k;
|
|
1917
|
+ for(i=0,k=0; i<msgN && k<msgN; ++i)
|
|
1918
|
+ if( msgs[i]->status == kNoteOnMdId && msgs[i]->u.chMsgPtr->d1 > 0 )
|
|
1919
|
+ {
|
|
1920
|
+ dV[k].uid = msgs[i]->uid;
|
|
1921
|
+ dV[k].amicro = msgs[i]->amicro;
|
|
1922
|
+
|
|
1923
|
+ for(j=i; j>=0; --j)
|
|
1924
|
+ {
|
|
1925
|
+ if( msgs[i]->amicro - msgs[j]->amicro > 1000000 )
|
|
1926
|
+ break;
|
|
1927
|
+
|
|
1928
|
+ dV[k].density += 1;
|
|
1929
|
+ }
|
|
1930
|
+
|
|
1931
|
+ k += 1;
|
|
1932
|
+
|
|
1933
|
+ }
|
|
1934
|
+
|
|
1935
|
+ if( cntRef != NULL )
|
|
1936
|
+ *cntRef = k;
|
|
1937
|
+
|
|
1938
|
+ return dV;
|
|
1939
|
+}
|
|
1940
|
+
|
|
1941
|
+
|
1910
|
1942
|
cmMfRC_t cmMidiFileGenPlotFile( cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* outFn )
|
1911
|
1943
|
{
|
1912
|
1944
|
cmMfRC_t rc = kOkMfRC;
|