From c4749f20a5ad31ed8c68c11547120a0d1da45a8f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 8 Oct 2010 18:06:38 +0000 Subject: dynamic buffer size git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1928 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/logscale.cpp | 74 ----------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 src/ui/logscale.cpp (limited to 'src/ui/logscale.cpp') 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 -// -// Use, modification and distribution is allowed without limitation, -// warranty, or liability of any kind. -// - -#include "logscale.h" - -#include -#include - - -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]; -} -- cgit v1.2.3-13-gbd6f