aboutsummaryrefslogtreecommitdiff
path: root/src/logscale.cpp
diff options
context:
space:
mode:
authorvovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2008-02-07 13:36:34 +0000
committervovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2008-02-07 13:36:34 +0000
commit06d1877811fa6aa97dddc0e03bcde4e766928c87 (patch)
treec25462d0e58c3d58c728664440412bf4f16a49ec /src/logscale.cpp
parent3f6b60f23c44a8ba8dd97ca6f41a16e2af7ef2f7 (diff)
downloadqmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.gz
qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.bz2
qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.zip
new directory structure
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@232 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/logscale.cpp')
-rw-r--r--src/logscale.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/logscale.cpp b/src/logscale.cpp
deleted file mode 100644
index 921004fd9..000000000
--- a/src/logscale.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
-//
-// Use, modification and distribution is allowed without limitation,
-// warranty, or liability of any kind.
-//
-
-#include "logscale.h"
-
-#include <math.h>
-#include <stdio.h>
-
-
-LogScale::LogScale(int maxscale, int maxrange)
- : indices(0), s(0), r(0)
-{
- setMax(maxscale, maxrange);
-}
-
-
-LogScale::~LogScale()
-{
- if (indices)
- delete [] indices;
-}
-
-
-void LogScale::setMax(int maxscale, int maxrange)
-{
- if (maxscale == 0 || maxrange == 0)
- return;
-
- s = maxscale;
- r = maxrange;
-
- if (indices)
- delete [] indices;
-
- double alpha;
- int i, scaled;
- double domain = double(maxscale),
- range = double(maxrange),
- x = 1.0,
- dx = 1.0,
- y = 0.0,
- yy = 0.0,
- t = 0.0,
- e4 = double(1.0E-8);
-
- indices = new int[maxrange];
- for (i = 0; i < maxrange; i++)
- indices[i] = 0;
-
- // initialize log scale
- while (fabs(dx) > e4) {
- t = log((domain + x) / x);
- y = (x * t) - range;
- yy = t - (domain / (x + domain));
- dx = y / yy;
- x -= dx;
- }
-
- alpha = x;
- for (i = 1; i < (int) domain; i++) {
- scaled = (int) floor(0.5 + (alpha * log((double(i) + alpha) / alpha)));
- if (indices[scaled - 1] < i)
- indices[scaled - 1] = i;
- }
-}
-
-
-int LogScale::operator[](int index)
-{
- return indices[index];
-}