shithub: sf2mid

Download patch

ref: 6bebb187e491494b94fb69745fa6cddb4999e98a
parent: 91c24e1620a8f9c13be1aa21698757e5ad5a95a6
author: Bernhard Schelling <14200249+schellingb@users.noreply.github.com>
date: Thu Mar 19 19:19:55 EDT 2020

Clamp region initial attenuation to legal values
Related to #46

--- a/tsf.h
+++ b/tsf.h
@@ -693,6 +693,8 @@
 								if (zoneRegion.pan < -0.5f) zoneRegion.pan = -0.5f;
 								else if (zoneRegion.pan > 0.5f) zoneRegion.pan = 0.5f;
 								if (zoneRegion.initialFilterQ < 1500 || zoneRegion.initialFilterQ > 13500) zoneRegion.initialFilterQ = 0;
+								if (zoneRegion.attenuation < 0) zoneRegion.attenuation = 0;
+								else if (zoneRegion.attenuation > 1440) zoneRegion.attenuation = 1440;
 
 								pshdr = &hydra->shdrs[pigen->genAmount.wordAmount];
 								zoneRegion.offset += pshdr->start;