shithub: neindaw

Download patch

ref: e71361d5f47f408ca3192ecdf2a44de48c0aeef9
parent: cb02cb542f17f9a9fa1c408a32358d0f47f9bd1d
author: Sigrid Haflínudóttir <[email protected]>
date: Tue May 12 18:25:47 EDT 2020

ay: env period: stick to seconds as the unit

--- a/ay/ay.c
+++ b/ay/ay.c
@@ -141,7 +141,7 @@
 	}
 
 	if (ui->zone == &dsp->envperiod) {
-		pd = MAX(1, MIN(65535, (tickhz / 1000) * (*ui->zone) / 256));
+		pd = MAX(1, MIN(65535, tickhz*(*ui->zone) / 256));
 		regw(ay, AY38910_REG_ENV_PERIOD_FINE, pd&0xff);
 		regw(ay, AY38910_REG_ENV_PERIOD_COARSE, pd>>8);
 		*ui->zone = MAX(1, pd*256000LL/tickhz);
@@ -239,8 +239,8 @@
 		min = MAX(1, 256000/tickhz);
 		max = floor(16776960000LL/tickhz);
 		ui_declare(&dsp->envperiod, "0", "");
-		ui_declare(&dsp->envperiod, "unit", "ms");
-		BIND(ui_hslider("Period", &dsp->envperiod, 500, min, max, 1));
+		ui_declare(&dsp->envperiod, "unit", "s");
+		BIND(ui_hslider("Period", &dsp->envperiod, 0.5, min/1000.0, max/1000.0, 0.001));
 
 		ui_declare(&dsp->hold, "1", "");
 		BIND(ui_checkbox("Hold", &dsp->hold));