From 1f726846f5e6f8137c6bcc1df53b61b35e3ae08d Mon Sep 17 00:00:00 2001
From: Klaus Schmidinger <vdr@tvdr.de>
Date: Sun, 17 Oct 2004 09:12:16 +0200
Subject: Refined formula for making volume control more linear

---
 CONTRIBUTORS | 3 +++
 HISTORY      | 2 +-
 dvbdevice.c  | 7 ++-----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 55250de3..09e3229a 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1092,3 +1092,6 @@ Arthur Konovalov <kasjas@hot.ee>
 Milos Kapoun <m.kapoun@cra.cz>
  for suggesting to skip code table info in SI data
  for adding missing Czech characters to fontosd-iso8859-2.c
+
+Udo Richter <udo_richter@gmx.de>
+ for refining the formula for making volume control more linear
diff --git a/HISTORY b/HISTORY
index 5f4b574a..547a8d37 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3022,7 +3022,7 @@ Video Disk Recorder Revision History
 - Avoiding unnecessary section filter start/stops (thanks to Marco Schl��ler).
 - Made the "Channel not available!" message and mtInfo instead of mtError (suggested
   by Wayne Keer).
-- Made volume control more linear (thanks to Emil Naepflein).
+- Made volume control more linear (thanks to Emil Naepflein and Udo Richter).
 - Now skipping code table info in SI data (suggested by Milos Kapoun).
 - Added missing Czech characters to fontosd-iso8859-2.c (thanks to Milos Kapoun).
 - Fixed a crash in the time search mechanism (reported by Reinhard Nissl).
diff --git a/dvbdevice.c b/dvbdevice.c
index 6bee3edc..561b6c62 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: dvbdevice.c 1.96 2004/10/16 14:38:24 kls Exp $
+ * $Id: dvbdevice.c 1.97 2004/10/17 09:10:43 kls Exp $
  */
 
 #include "dvbdevice.h"
@@ -786,10 +786,7 @@ void cDvbDevice::SetVolumeDevice(int Volume)
   if (HasDecoder()) {
      audio_mixer_t am;
      // conversion for linear volume response:
-     int i, Vol;
-     for (i = 1, Vol = 0; i < Volume; i++)
-         Vol += (256 - i) * (256 - i);
-     am.volume_left = am.volume_right = Vol / 21718;
+     am.volume_left = am.volume_right = 2 * Volume - Volume * Volume / 255;
      CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am));
      }
 }
-- 
cgit v1.2.3