aboutsummaryrefslogtreecommitdiff
path: root/src/ui/logscale.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-10-08 18:06:38 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-10-08 18:06:38 +0000
commitc4749f20a5ad31ed8c68c11547120a0d1da45a8f (patch)
tree805248511deeea91f7da2d2881f9afefe9f21b1a /src/ui/logscale.cpp
parent767150cfe9403eb432ea82377664abda214d6e04 (diff)
downloadqmmp-c4749f20a5ad31ed8c68c11547120a0d1da45a8f.tar.gz
qmmp-c4749f20a5ad31ed8c68c11547120a0d1da45a8f.tar.bz2
qmmp-c4749f20a5ad31ed8c68c11547120a0d1da45a8f.zip
dynamic buffer size
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1928 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/logscale.cpp')
-rw-r--r--src/ui/logscale.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/ui/logscale.cpp b/src/ui/logscale.cpp
deleted file mode 100644
index 921004fd9..000000000
--- a/src/ui/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];
-}