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