shithub: dumb

Download patch

ref: 7a16e6a7caf6c001064e47e5da9c19f9e2c75d43
parent: 5c5fedc5f76277abc281066b26dd7463a06841b4
author: Chris Moeller <[email protected]>
date: Mon Aug 26 18:50:32 EDT 2013

Invalid notes correctly cause note fade, and range of valid notes increased to include 120/B-9

--- a/dumb/include/internal/it.h
+++ b/dumb/include/internal/it.h
@@ -57,7 +57,6 @@
  */
 //#define STEREO_SAMPLES_COUNT_AS_TWO
 #define INVALID_ORDERS_END_SONG
-#define INVALID_NOTES_CAUSE_NOTE_CUT
 #define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP
 #define VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
 
--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -1731,22 +1731,10 @@
 	int i, envelopes_copied = 0;
 
 	if (channel->playing) {
-#ifdef INVALID_NOTES_CAUSE_NOTE_CUT
-		if (channel->note == IT_NOTE_OFF)
-			nna = NNA_NOTE_OFF;
-		else if (channel->note >= 120 || !channel->playing->instrument || (channel->playing->flags & IT_PLAYING_DEAD))
-			nna = NNA_NOTE_CUT;
-		else if (channel->new_note_action != 0xFF)
-		{
-			nna = channel->new_note_action;
-		}
-		else
-			nna = channel->playing->instrument->new_note_action;
-#else
 		if (channel->note == IT_NOTE_CUT)
 			nna = NNA_NOTE_CUT;
-		if (channel->note >= 120)
-			nna = NNA_NOTE_OFF;
+		if (channel->note > 120)
+			nna = NNA_NOTE_FADE;
 		else if (!channel->playing->instrument || (channel->playing->flags & IT_PLAYING_DEAD))
 			nna = NNA_NOTE_CUT;
 		else if (channel->new_note_action != 0xFF)
@@ -1755,7 +1743,6 @@
 		}
 		else
 			nna = channel->playing->instrument->new_note_action;
-#endif
 
 		if (!(channel->playing->flags & IT_PLAYING_SUSTAINOFF))
 		{
@@ -1785,7 +1772,7 @@
 
 	channel->new_note_action = 0xFF;
 
-	if (channel->sample == 0 || channel->note >= 120)
+	if (channel->sample == 0 || channel->note > 120)
 		return;
 
 	channel->destnote = IT_NOTE_OFF;
@@ -3197,7 +3184,7 @@
 		if (entry->mask & IT_ENTRY_INSTRUMENT)
 			channel->instrument = entry->instrument;
 		instrument_to_sample(sigdata, channel);
-		if (channel->note < 120) {
+		if (channel->note <= 120) {
 			if ((sigdata->flags & IT_USE_INSTRUMENTS) && channel->sample == 0)
 				it_retrigger_note(sigrenderer, channel); /* Stop the note */ /*return 1;*/
 			if (entry->mask & IT_ENTRY_INSTRUMENT)
@@ -3242,7 +3229,7 @@
 				channel->lastEF = v;
 			}
 			if ((entry->mask & IT_ENTRY_NOTE) || ((sigdata->flags & IT_COMPATIBLE_GXX) && (entry->mask & IT_ENTRY_INSTRUMENT))) {
-				if (channel->note < 120) {
+				if (channel->note <= 120) {
 					if (channel->sample)
 						channel->destnote = channel->truenote;
 					else
@@ -3267,7 +3254,7 @@
 				channel->lastEF = v;
 			}
 			if ((entry->mask & IT_ENTRY_NOTE) || ((sigdata->flags & IT_COMPATIBLE_GXX) && (entry->mask & IT_ENTRY_INSTRUMENT))) {
-				if (channel->note < 120) {
+				if (channel->note <= 120) {
 					if (channel->sample)
 						channel->destnote = channel->truenote;
 					else
@@ -3282,7 +3269,7 @@
 	if ((entry->mask & IT_ENTRY_NOTE) ||
 		((entry->mask & IT_ENTRY_INSTRUMENT) && (!channel->playing || entry->instrument != channel->playing->instnum)))
 	{
-		if (channel->note < 120) {
+		if (channel->note <= 120) {
 			get_true_pan(sigdata, channel);
 			if ((entry->mask & IT_ENTRY_NOTE) || !(sigdata->flags & (IT_WAS_AN_S3M|IT_WAS_A_PTM)))
 				it_retrigger_note(sigrenderer, channel);