shithub: dumb

Download patch

ref: 477011d74059eac39f530737ad73b98da24085f1
parent: 52a88bedf98d7582e1efda99782534dab0d3f089
author: Chris Moeller <[email protected]>
date: Tue Mar 25 15:50:19 EDT 2014

Made volume ramping configurable once again, now configurable between note on/off declicking only or full ramping

--- a/dumb/include/dumb.h
+++ b/dumb/include/dumb.h
@@ -379,6 +379,15 @@
 
 void dumb_it_set_resampling_quality(DUMB_IT_SIGRENDERER * sigrenderer, int quality);
 
+enum
+{
+    DUMB_IT_RAMP_NONE = 0,
+    DUMB_IT_RAMP_ONOFF_ONLY = 1,
+    DUMB_IT_RAMP_FULL = 2
+};
+        
+void dumb_it_set_ramp_style(DUMB_IT_SIGRENDERER * sigrenderer, int ramp_style);
+        
 void dumb_it_set_loop_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
 void dumb_it_set_xm_speed_zero_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
 void dumb_it_set_midi_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data, int channel, unsigned char midi_byte), void *data);
--- a/dumb/include/internal/it.h
+++ b/dumb/include/internal/it.h
@@ -743,6 +743,8 @@
 	long gvz_time;
 	int gvz_sub_time;
 
+    int ramp_style;
+    
 	//int max_output;
 };
 
--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -3922,6 +3922,7 @@
 	int pan;
 	float vol, span;
     float rampScale;
+    int ramp_style = sigrenderer->ramp_style;
  
 	pan = apply_pan_envelope(playing);
 
@@ -3944,23 +3945,30 @@
 	playing->float_volume[0] *= vol;
 	playing->float_volume[1] *= vol;
 
-    rampScale = 4;
-    if (playing->declick_stage == 0) {
-        playing->ramp_volume[0] = 0;
-        playing->ramp_volume[1] = 0;
-        rampScale = 48;
-        playing->declick_stage++;
-    } else if (playing->declick_stage == 1) {
-        rampScale = 48;
-    } else if (playing->declick_stage >= 3) {
-        playing->float_volume[0] = 0;
-        playing->float_volume[1] = 0;
-        if (playing->declick_stage == 3)
+    if (ramp_style == 0 || (ramp_style < 2 && playing->declick_stage == 2)) {
+        playing->ramp_volume[0] = playing->float_volume[0];
+        playing->ramp_volume[1] = playing->float_volume[1];
+        playing->ramp_delta[0] = 0;
+        playing->ramp_delta[1] = 0;
+    } else {
+        rampScale = 4;
+        if (playing->declick_stage == 0) {
+            playing->ramp_volume[0] = 0;
+            playing->ramp_volume[1] = 0;
+            rampScale = 48;
             playing->declick_stage++;
-        rampScale = 48;
+        } else if (playing->declick_stage == 1) {
+            rampScale = 48;
+        } else if (playing->declick_stage >= 3) {
+            playing->float_volume[0] = 0;
+            playing->float_volume[1] = 0;
+            if (playing->declick_stage == 3)
+                playing->declick_stage++;
+            rampScale = 48;
+        }
+        playing->ramp_delta[0] = rampScale * invt2g * (playing->float_volume[0] - playing->ramp_volume[0]);
+        playing->ramp_delta[1] = rampScale * invt2g * (playing->float_volume[1] - playing->ramp_volume[1]);
     }
-    playing->ramp_delta[0] = rampScale * invt2g * (playing->float_volume[0] - playing->ramp_volume[0]);
-	playing->ramp_delta[1] = rampScale * invt2g * (playing->float_volume[1] - playing->ramp_volume[1]);
 }
 
 static void process_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float invt2g)
@@ -5154,6 +5162,7 @@
 	sigrenderer->sigdata = sigdata;
 	sigrenderer->n_channels = n_channels;
 	sigrenderer->resampling_quality = dumb_resampling_quality;
+    sigrenderer->ramp_stype = DUMB_IT_RAMP_FULL;
 	sigrenderer->globalvolume = sigdata->global_volume;
 	sigrenderer->tempo = sigdata->tempo;