summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2007-11-15 23:32:56 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2007-11-15 23:32:56 +0000
commit7197d9dde7bb4f1476eb82318c1253982fc9e620 (patch)
treed89d99626715037be0ace3257974c069e647b52f
parent65331f17497d132c03ad48be90322d24c20d6415 (diff)
downloadrockbox-7197d9dde7bb4f1476eb82318c1253982fc9e620.zip
rockbox-7197d9dde7bb4f1476eb82318c1253982fc9e620.tar.gz
rockbox-7197d9dde7bb4f1476eb82318c1253982fc9e620.tar.bz2
rockbox-7197d9dde7bb4f1476eb82318c1253982fc9e620.tar.xz
move {bass,treble,prescale}_table from sound.c to mas35xx.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15632 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/mas35xx.h94
-rw-r--r--firmware/sound.c93
2 files changed, 95 insertions, 92 deletions
diff --git a/firmware/export/mas35xx.h b/firmware/export/mas35xx.h
index faf11d0..d89b489 100644
--- a/firmware/export/mas35xx.h
+++ b/firmware/export/mas35xx.h
@@ -22,4 +22,98 @@
#ifndef _MAS35XX_H
#define _MAS35XX_H
+#include "config.h"
+
+#if CONFIG_CODEC == MAS3507D
+static const unsigned int bass_table[] =
+{
+ 0x9e400, /* -15dB */
+ 0xa2800, /* -14dB */
+ 0xa7400, /* -13dB */
+ 0xac400, /* -12dB */
+ 0xb1800, /* -11dB */
+ 0xb7400, /* -10dB */
+ 0xbd400, /* -9dB */
+ 0xc3c00, /* -8dB */
+ 0xca400, /* -7dB */
+ 0xd1800, /* -6dB */
+ 0xd8c00, /* -5dB */
+ 0xe0400, /* -4dB */
+ 0xe8000, /* -3dB */
+ 0xefc00, /* -2dB */
+ 0xf7c00, /* -1dB */
+ 0,
+ 0x800, /* 1dB */
+ 0x10000, /* 2dB */
+ 0x17c00, /* 3dB */
+ 0x1f800, /* 4dB */
+ 0x27000, /* 5dB */
+ 0x2e400, /* 6dB */
+ 0x35800, /* 7dB */
+ 0x3c000, /* 8dB */
+ 0x42800, /* 9dB */
+ 0x48800, /* 10dB */
+ 0x4e400, /* 11dB */
+ 0x53800, /* 12dB */
+ 0x58800, /* 13dB */
+ 0x5d400, /* 14dB */
+ 0x61800 /* 15dB */
+};
+
+static const unsigned int treble_table[] =
+{
+ 0xb2c00, /* -15dB */
+ 0xbb400, /* -14dB */
+ 0xc1800, /* -13dB */
+ 0xc6c00, /* -12dB */
+ 0xcbc00, /* -11dB */
+ 0xd0400, /* -10dB */
+ 0xd5000, /* -9dB */
+ 0xd9800, /* -8dB */
+ 0xde000, /* -7dB */
+ 0xe2800, /* -6dB */
+ 0xe7e00, /* -5dB */
+ 0xec000, /* -4dB */
+ 0xf0c00, /* -3dB */
+ 0xf5c00, /* -2dB */
+ 0xfac00, /* -1dB */
+ 0,
+ 0x5400, /* 1dB */
+ 0xac00, /* 2dB */
+ 0x10400, /* 3dB */
+ 0x16000, /* 4dB */
+ 0x1c000, /* 5dB */
+ 0x22400, /* 6dB */
+ 0x28400, /* 7dB */
+ 0x2ec00, /* 8dB */
+ 0x35400, /* 9dB */
+ 0x3c000, /* 10dB */
+ 0x42c00, /* 11dB */
+ 0x49c00, /* 12dB */
+ 0x51800, /* 13dB */
+ 0x58400, /* 14dB */
+ 0x5f800 /* 15dB */
+};
+
+static const unsigned int prescale_table[] =
+{
+ 0x80000, /* 0db */
+ 0x8e000, /* 1dB */
+ 0x9a400, /* 2dB */
+ 0xa5800, /* 3dB */
+ 0xaf400, /* 4dB */
+ 0xb8000, /* 5dB */
+ 0xbfc00, /* 6dB */
+ 0xc6c00, /* 7dB */
+ 0xcd000, /* 8dB */
+ 0xd25c0, /* 9dB */
+ 0xd7800, /* 10dB */
+ 0xdc000, /* 11dB */
+ 0xdfc00, /* 12dB */
+ 0xe3400, /* 13dB */
+ 0xe6800, /* 14dB */
+ 0xe9400 /* 15dB */
+};
+#endif /*CONFIG_CODEC == MAS3507D*/
+
#endif /* _MAS35XX_H */
diff --git a/firmware/sound.c b/firmware/sound.c
index 37ca27b..9cb4c28 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -189,98 +189,7 @@ void sound_set_dsp_callback(int (*func)(int, intptr_t))
#endif
#ifndef SIMULATOR
-#if CONFIG_CODEC == MAS3507D /* volume/balance/treble/bass interdependency */
-
-static const unsigned int bass_table[] =
-{
- 0x9e400, /* -15dB */
- 0xa2800, /* -14dB */
- 0xa7400, /* -13dB */
- 0xac400, /* -12dB */
- 0xb1800, /* -11dB */
- 0xb7400, /* -10dB */
- 0xbd400, /* -9dB */
- 0xc3c00, /* -8dB */
- 0xca400, /* -7dB */
- 0xd1800, /* -6dB */
- 0xd8c00, /* -5dB */
- 0xe0400, /* -4dB */
- 0xe8000, /* -3dB */
- 0xefc00, /* -2dB */
- 0xf7c00, /* -1dB */
- 0,
- 0x800, /* 1dB */
- 0x10000, /* 2dB */
- 0x17c00, /* 3dB */
- 0x1f800, /* 4dB */
- 0x27000, /* 5dB */
- 0x2e400, /* 6dB */
- 0x35800, /* 7dB */
- 0x3c000, /* 8dB */
- 0x42800, /* 9dB */
- 0x48800, /* 10dB */
- 0x4e400, /* 11dB */
- 0x53800, /* 12dB */
- 0x58800, /* 13dB */
- 0x5d400, /* 14dB */
- 0x61800 /* 15dB */
-};
-
-static const unsigned int treble_table[] =
-{
- 0xb2c00, /* -15dB */
- 0xbb400, /* -14dB */
- 0xc1800, /* -13dB */
- 0xc6c00, /* -12dB */
- 0xcbc00, /* -11dB */
- 0xd0400, /* -10dB */
- 0xd5000, /* -9dB */
- 0xd9800, /* -8dB */
- 0xde000, /* -7dB */
- 0xe2800, /* -6dB */
- 0xe7e00, /* -5dB */
- 0xec000, /* -4dB */
- 0xf0c00, /* -3dB */
- 0xf5c00, /* -2dB */
- 0xfac00, /* -1dB */
- 0,
- 0x5400, /* 1dB */
- 0xac00, /* 2dB */
- 0x10400, /* 3dB */
- 0x16000, /* 4dB */
- 0x1c000, /* 5dB */
- 0x22400, /* 6dB */
- 0x28400, /* 7dB */
- 0x2ec00, /* 8dB */
- 0x35400, /* 9dB */
- 0x3c000, /* 10dB */
- 0x42c00, /* 11dB */
- 0x49c00, /* 12dB */
- 0x51800, /* 13dB */
- 0x58400, /* 14dB */
- 0x5f800 /* 15dB */
-};
-
-static const unsigned int prescale_table[] =
-{
- 0x80000, /* 0db */
- 0x8e000, /* 1dB */
- 0x9a400, /* 2dB */
- 0xa5800, /* 3dB */
- 0xaf400, /* 4dB */
- 0xb8000, /* 5dB */
- 0xbfc00, /* 6dB */
- 0xc6c00, /* 7dB */
- 0xcd000, /* 8dB */
- 0xd25c0, /* 9dB */
- 0xd7800, /* 10dB */
- 0xdc000, /* 11dB */
- 0xdfc00, /* 12dB */
- 0xe3400, /* 13dB */
- 0xe6800, /* 14dB */
- 0xe9400 /* 15dB */
-};
-
+#if CONFIG_CODEC == MAS3507D
/* convert tenth of dB volume (-780..+180) to dac3550 register value */
static int tenthdb2reg(int db)
{