From 06ad38fc65056e533ebe474ee8cf9c4abc25aa8f Mon Sep 17 00:00:00 2001 From: Tronix Date: Wed, 10 Mar 2021 15:06:35 +0300 Subject: [PATCH] Added note priority --- .gitignore | 5 +- CMS.C | 61 +++++++++--- CMS.H | 2 +- CMS.LST | 273 +++++++++++++++++++++++++---------------------------- DOSMID.CFG | 1 + DOSMID.EXE | Bin 40994 -> 41138 bytes 6 files changed, 179 insertions(+), 163 deletions(-) diff --git a/.gitignore b/.gitignore index f30211c..4a1019b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.obj *.mid -*.map \ No newline at end of file +*.map +*.lst +*.log +*.lst diff --git a/CMS.C b/CMS.C index 27fc84f..447d872 100644 --- a/CMS.C +++ b/CMS.C @@ -1,5 +1,7 @@ #ifdef CMS +//#define CMS_DEBUG 1 + #ifdef CMS_DEBUG #include #include @@ -52,6 +54,10 @@ unsigned char CmsOctaveStore[12]; unsigned char ChanEnableReg[2] = {0,0}; +// Note priority +unsigned char NotePriority; + + void __declspec( naked ) cmsWrite(void) { /* @@ -115,9 +121,9 @@ void cmsReset(unsigned short port) for (i=0;i cms_synth[voice].priority ) + cms_synth[i].priority = cms_synth[i].priority - 1; + + + if (NotePriority != 0) NotePriority--; + cmsDisableVoice(voice); cms_synth[voice].note = 0; + cms_synth[voice].priority = 0; } void cmsNoteOn(unsigned char channel, unsigned char note, unsigned char velocity) @@ -312,6 +327,8 @@ void cmsNoteOn(unsigned char channel, unsigned char note, unsigned char velocity octave = (note_cms / 12) - 1; //Some fancy math to get the correct octave noteVal = note_cms - ((octave + 1) * 12); //More fancy math to get the correct note + NotePriority++; + voice = MAX_CMS_CHANNELS; for(i=0; i?czmG8bFgvtD1Uu-vwvvi6G1)1NHI+C3@$mUjCMK>DWTmgB7@ zimV+=6svCdn(P33+pIc}Z|3{Nc0~ZGnf%4av9ljptgs(hq9~rfz>{y9JBRtF?Y6*v z+HM-_vwvH0)%=3}Yu{-*Nx4}kqIUh-GtJ)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