shithub: sf2mid

Download patch

ref: 2ca9fd3456f45e57a2e4a1bb4a97a1853188305d
parent: 9e1984a387c74d203b1c17071f7d2afaa8b8b58b
author: Bernhard Schelling <[email protected]>
date: Tue Sep 26 07:36:19 EDT 2017

- Fix certain presets for which the state of the lowpass filter was not stored across multiple voice render calls
- Allow custom values for TSF_RENDER_EFFECTSAMPLEBLOCK in user code

--- a/tsf.h
+++ b/tsf.h
@@ -154,7 +154,9 @@
 // The lower this block size is the more accurate the effects are.
 // Increasing the value significantly lowers the CPU usage of the voice rendering.
 // If LFO affects the low-pass filter it can be hearable even as low as 8.
+#ifndef TSF_RENDER_EFFECTSAMPLEBLOCK
 #define TSF_RENDER_EFFECTSAMPLEBLOCK 64
+#endif
 
 // Grace release time for quick voice off (avoid clicking noise)
 #define TSF_FASTRELEASETIME 0.01f
@@ -991,7 +993,7 @@
 	}
 
 	v->sourceSamplePosition = tmpSourceSamplePosition;
-	if (dynamicLowpass) v->lowpass = tmpLowpass;
+	if (tmpLowpass.active || dynamicLowpass) v->lowpass = tmpLowpass;
 }
 
 TSFDEF tsf* tsf_load(struct tsf_stream* stream)