From 2252c8e944383c19e97b2c7c91ead56a26bb523f Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 6 Jan 2019 14:34:58 -0800 Subject: [PATCH] Improve preamp handling Setting the preamp to the mid point should have no effect. --- js/media/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/media/index.ts b/js/media/index.ts index 4c4f5680..0704f2c4 100644 --- a/js/media/index.ts +++ b/js/media/index.ts @@ -194,9 +194,12 @@ export default class Media { this._gainNode.gain.value = volume / 100; } - // From 0-1 + // From 0 to 100 + // The input value here is 0-100 which is kinda wrong, since it represents -12db to 12db. + // For now, 50 is 0db (no change). + // For now we map the values 0-100 to 0.5-1.5 setPreamp(value: number) { - this._preamp.gain.value = value / 100; + this._preamp.gain.value = 1 + (value - 50) / 100; } // From -100 to 100