aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-06-08 21:25:18 +0200
committerJohannes Schickel2013-06-08 21:47:51 +0200
commit21f87070afa31f30593e85a9ddd5fcb84c292ec8 (patch)
tree5b6e1dbe3b60144de1abedc59bf556e38d550b8e
parent190ec9c2b64c940272d2f3e207296ce3eaab043f (diff)
downloadscummvm-rg350-21f87070afa31f30593e85a9ddd5fcb84c292ec8.tar.gz
scummvm-rg350-21f87070afa31f30593e85a9ddd5fcb84c292ec8.tar.bz2
scummvm-rg350-21f87070afa31f30593e85a9ddd5fcb84c292ec8.zip
COMMON: Fix regression in SineTable creation.
This is a regression from f4ba8a6485b097a8ef1e2004d1af127243f379f1. The commit replaced the static cosine and sine tables with dynamically created ones. In the process of that a copy&paste error happened which made the sine table use the layout of the cosine table. This commit now changes the dynamically created sine tables to conform to the layout of the previous static tables.
-rw-r--r--common/sinetables.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/sinetables.cpp b/common/sinetables.cpp
index a6ec99469d..2198dbfd1a 100644
--- a/common/sinetables.cpp
+++ b/common/sinetables.cpp
@@ -36,13 +36,13 @@ SineTable::SineTable(int bitPrecision) {
double freq = 2 * M_PI / m;
_table = new float[m];
- // Table contains sin(2*pi*x/n) for 0<=x<=n/4,
- // followed by its reverse
- for (int i = 0; i <= m / 4; i++)
+ // Table contains sin(2*pi*i/m) for 0<=i<m/4,
+ // followed by m/2<=i<3m/4
+ for (int i = 0; i < m / 4; i++)
_table[i] = sin(i * freq);
- for (int i = 1; i < m / 4; i++)
- _table[m / 2 - i] = _table[i];
+ for (int i = 0; i < m / 4; i++)
+ _table[m / 4 + i] = -_table[i];
}
SineTable::~SineTable() {