shithub: dumb

Download patch

ref: 0e95459562669335f7de543d063cfa57d25a8b77
parent: 7fc359f6c61939618b11aa2aedf42d45220609f7
author: Chris Moeller <kode54@gmail.com>
date: Mon Feb 27 11:04:22 EST 2012

2012-02-24 19:11 UTC - kode54
- Fixed MOD vibrato depth
- Fixed XM tremolo ramp and square waveform tracking
- Version is now 0.9.9.52

--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -1956,6 +1956,13 @@
 
 extern const char xm_convert_vibrato[];
 
+const char mod_convert_vibrato[] = {
+	IT_VIBRATO_SINE,
+	IT_VIBRATO_RAMP_UP, /* this will be inverted by IT_OLD_EFFECTS */
+	IT_VIBRATO_XM_SQUARE,
+	IT_VIBRATO_XM_SQUARE
+};
+
 /* Returns 1 if a callback caused termination of playback. */
 static int process_effects(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry, int ignore_cxx)
 {
@@ -2201,7 +2208,7 @@
 						if (depth == 0)
 							depth = channel->lastHdepth;
 						else {
-							if (sigdata->flags & IT_OLD_EFFECTS)
+							if (sigdata->flags & IT_OLD_EFFECTS && !(sigdata->flags & IT_WAS_A_MOD))
 								depth <<= 3;
 							else
 								depth <<= 2;
@@ -2473,7 +2480,8 @@
 						case IT_S_SET_VIBRATO_WAVEFORM:
 							{
 								int waveform = effectvalue & 3;
-								if (sigdata->flags & IT_WAS_AN_XM) waveform = xm_convert_vibrato[waveform];
+								if (sigdata->flags & IT_WAS_A_MOD) waveform = mod_convert_vibrato[waveform];
+								else if (sigdata->flags & IT_WAS_AN_XM) waveform = xm_convert_vibrato[waveform];
 								channel->vibrato_waveform = waveform;
 								if (channel->playing) {
 									channel->playing->vibrato_waveform = waveform;
@@ -2485,7 +2493,8 @@
 						case IT_S_SET_TREMOLO_WAVEFORM:
 							{
 								int waveform = effectvalue & 3;
-								if (sigdata->flags & IT_WAS_AN_XM) waveform = xm_convert_vibrato[waveform];
+								if (sigdata->flags & IT_WAS_A_MOD) waveform = mod_convert_vibrato[waveform];
+								else if (sigdata->flags & IT_WAS_AN_XM) waveform = xm_convert_vibrato[waveform];
 								channel->tremolo_waveform = waveform;
 								if (channel->playing) {
 									channel->playing->tremolo_waveform = waveform;
@@ -4266,13 +4275,13 @@
 			vol = (rand() % 129) - 64;
 			break;
 		case 4:
-			vol = it_xm_squarewave[playing->vibrato_time];
+			vol = it_xm_squarewave[playing->tremolo_time];
 			break;
 		case 5:
-			vol = it_xm_ramp[playing->vibrato_time];
+			vol = it_xm_ramp[playing->tremolo_time];
 			break;
 		case 6:
-			vol = it_xm_ramp[255-playing->vibrato_time];
+			vol = it_xm_ramp[255-((sigrenderer->sigdata->flags & IT_WAS_A_MOD)?playing->vibrato_time:playing->tremolo_time)];
 			break;
 		}
 		vol *= playing->tremolo_depth;