aboutsummaryrefslogtreecommitdiff
path: root/common/sinetables.h
diff options
context:
space:
mode:
authorFilippos Karapetis2012-04-19 01:13:47 -0700
committerFilippos Karapetis2012-04-19 01:13:47 -0700
commita1618c215ba4b731c61df39a0eb31fc8028d34ed (patch)
tree324929ba691765db61d7012b5eb75c87f7eb1d3e /common/sinetables.h
parent677806a4e97033a3e35559cf2a1da7ba45b0b72c (diff)
parent0f66d2c701958dc70ed57b570a7f59965a90bf66 (diff)
downloadscummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.tar.gz
scummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.tar.bz2
scummvm-rg350-a1618c215ba4b731c61df39a0eb31fc8028d34ed.zip
Merge pull request #226 from digitall/sincos
Replace large static Sin and Cos tables with dynamically generated ones.
Diffstat (limited to 'common/sinetables.h')
-rw-r--r--common/sinetables.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/common/sinetables.h b/common/sinetables.h
index 28918838f4..16e203f26d 100644
--- a/common/sinetables.h
+++ b/common/sinetables.h
@@ -25,12 +25,30 @@
namespace Common {
-/**
- * Get a sine table with the specified bit precision
- *
- * @param bits Precision of the table, which must be in range [4, 16]
- */
-const float *getSineTable(int bits);
+class SineTable {
+public:
+ /**
+ * Construct a sine table with the specified bit precision
+ *
+ * @param bitPrecision Precision of the table, which must be in range [4, 16]
+ */
+ SineTable(int bitPrecision);
+ ~SineTable();
+
+ /**
+ * Get pointer to table
+ */
+ const float *getTable() { return _table; }
+
+ /**
+ * Get pointer to table
+ */
+ int getPrecision() { return _bitPrecision; }
+
+private:
+ float *_table;
+ int _bitPrecision;
+};
} // End of namespace Common