summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-12 21:36:29 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-12 21:36:29 +0000
commit724a2d2514578297a7fe21dc4c17a7b51a25758d (patch)
treed89b1646a89241cd3bcc9d355acbdc5a1072c803
parent5f6d8bfcc0071848454447ecfffa8c337a3cd2b4 (diff)
downloadrockbox-724a2d2514578297a7fe21dc4c17a7b51a25758d.tar.gz
rockbox-724a2d2514578297a7fe21dc4c17a7b51a25758d.zip
6th part of FS#12176. Reduce memory consumption of libgme emulators to allow enabling of NSF and SGC codecs for low memory targets. The main lookup table only requires byte precision and can be used by 2413 and 8950 emulators. Update the manual accordingly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30283 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/SOURCES2
-rw-r--r--apps/codecs/libgme/emu2413.c2
-rw-r--r--apps/codecs/libgme/emu8950.c20
-rw-r--r--manual/appendix/file_formats.tex6
4 files changed, 19 insertions, 11 deletions
diff --git a/apps/codecs/SOURCES b/apps/codecs/SOURCES
index bbceae45b0..6862eeda8e 100644
--- a/apps/codecs/SOURCES
+++ b/apps/codecs/SOURCES
@@ -35,9 +35,9 @@ wmapro.c
35ay.c 35ay.c
36gbs.c 36gbs.c
37hes.c 37hes.c
38#if MEMORYSIZE > 2
39nsf.c 38nsf.c
40sgc.c 39sgc.c
40#if MEMORYSIZE > 2
41vgm.c 41vgm.c
42kss.c 42kss.c
43#endif 43#endif
diff --git a/apps/codecs/libgme/emu2413.c b/apps/codecs/libgme/emu2413.c
index e7acebc63f..def6d60b7f 100644
--- a/apps/codecs/libgme/emu2413.c
+++ b/apps/codecs/libgme/emu2413.c
@@ -210,7 +210,7 @@ static e_uint32 dphaseARTable[16][16];
210static e_uint32 dphaseDRTable[16][16]; 210static e_uint32 dphaseDRTable[16][16];
211 211
212/* KSL + TL Table */ 212/* KSL + TL Table */
213static e_uint32 tllTable[16][8][1 << TL_BITS][4]; 213e_uint8 tllTable[16][8][1 << TL_BITS][4];
214static e_int32 rksTable[2][8][2]; 214static e_int32 rksTable[2][8][2];
215 215
216/* We may not have too much SRAM in rockbox */ 216/* We may not have too much SRAM in rockbox */
diff --git a/apps/codecs/libgme/emu8950.c b/apps/codecs/libgme/emu8950.c
index 0e9c4864eb..e75bf66d64 100644
--- a/apps/codecs/libgme/emu8950.c
+++ b/apps/codecs/libgme/emu8950.c
@@ -36,7 +36,12 @@ static unsigned int dphaseARTable[16][16];
36/** Phase incr table for Decay and Release. */ 36/** Phase incr table for Decay and Release. */
37static unsigned int dphaseDRTable[16][16]; 37static unsigned int dphaseDRTable[16][16];
38/** KSL + TL Table. */ 38/** KSL + TL Table. */
39static int tllTable[16][8][1<<TL_BITS][4]; 39#if !defined(ROCKBOX)
40static unsigned char tllTable[16][8][1<<TL_BITS][4];
41#else
42/* Use the table calculated in emu2413 which is identical. */
43extern unsigned char tllTable[16][8][1<<TL_BITS][4];
44#endif
40static int rksTable[2][8][2]; 45static int rksTable[2][8][2];
41/** Since we wont change clock rate in rockbox we can 46/** Since we wont change clock rate in rockbox we can
42 skip this table */ 47 skip this table */
@@ -193,6 +198,7 @@ static void makeDphaseTable(int sampleRate, int clockRate)
193} 198}
194#endif 199#endif
195 200
201#if !defined(ROCKBOX)
196static void makeTllTable(void) 202static void makeTllTable(void)
197{ 203{
198 #define dB2(x) (int)((x)*2) 204 #define dB2(x) (int)((x)*2)
@@ -209,17 +215,17 @@ static void makeTllTable(void)
209 for (TL=0; TL<64; TL++) 215 for (TL=0; TL<64; TL++)
210 for (KL=0; KL<4; KL++) { 216 for (KL=0; KL<4; KL++) {
211 if (KL==0) { 217 if (KL==0) {
212 tllTable[fnum][block][TL][KL] = ALIGN(TL, TL_STEP, EG_STEP); 218 tllTable[fnum][block][TL][KL] = (ALIGN(TL, TL_STEP, EG_STEP) ) >> 1;
213 } else { 219 } else {
214 int tmp = kltable[fnum] - dB2(3.000) * (7 - block); 220 int tmp = kltable[fnum] - dB2(3.000) * (7 - block);
215 if (tmp <= 0) 221 if (tmp <= 0)
216 tllTable[fnum][block][TL][KL] = ALIGN(TL, TL_STEP, EG_STEP); 222 tllTable[fnum][block][TL][KL] = (ALIGN(TL, TL_STEP, EG_STEP) ) >> 1;
217 else 223 else
218 tllTable[fnum][block][TL][KL] = (int)((tmp>>(3-KL))/EG_STEP) + ALIGN(TL, TL_STEP, EG_STEP); 224 tllTable[fnum][block][TL][KL] = ((int)((tmp>>(3-KL))/EG_STEP) + ALIGN(TL, TL_STEP, EG_STEP) ) >> 1;
219 } 225 }
220 } 226 }
221} 227}
222 228#endif
223 229
224// Rate Table for Attack 230// Rate Table for Attack
225static void makeDphaseARTable(int sampleRate, int clockRate) 231static void makeDphaseARTable(int sampleRate, int clockRate)
@@ -313,7 +319,7 @@ static inline void slotUpdatePG(struct Slot* slot)
313 319
314static inline void slotUpdateTLL(struct Slot* slot) 320static inline void slotUpdateTLL(struct Slot* slot)
315{ 321{
316 slot->tll = tllTable[slot->fnum>>6][slot->block][slot->patch.TL][slot->patch.KL]; 322 slot->tll = (int)(tllTable[slot->fnum>>6][slot->block][slot->patch.TL][slot->patch.KL]) << 1;
317} 323}
318 324
319static inline void slotUpdateRKS(struct Slot* slot) 325static inline void slotUpdateRKS(struct Slot* slot)
@@ -457,7 +463,9 @@ void OPL_init(struct Y8950* this, byte* ramBank, int sampleRam)
457 463
458 makeAdjustTable(); 464 makeAdjustTable();
459 makeDB2LinTable(); 465 makeDB2LinTable();
466#if !defined(ROCKBOX)
460 makeTllTable(); 467 makeTllTable();
468#endif
461 makeRksTable(); 469 makeRksTable();
462 makeSinTable(); 470 makeSinTable();
463 471
diff --git a/manual/appendix/file_formats.tex b/manual/appendix/file_formats.tex
index a54debb9ca..f75bd53786 100644
--- a/manual/appendix/file_formats.tex
+++ b/manual/appendix/file_formats.tex
@@ -222,11 +222,12 @@
222 \nopt{clipv1,c200v2}{ 222 \nopt{clipv1,c200v2}{
223 MSX Konami Sound System 223 MSX Konami Sound System
224 & \fname{.kss} 224 & \fname{.kss}
225 & Progress bar and seek use subtracks instead of seconds.\\ 225 & Progress bar and seek use subtracks instead of seconds.\\}
226 SMS/GG/CV Sound Format 226 SMS/GG/CV Sound Format
227 & \fname{.sgc} 227 & \fname{.sgc}
228 & Supports Sega Master System and Game Gear Sound Format. 228 & Supports Sega Master System and Game Gear Sound Format.
229 Progress bar and seek use subtracks instead of seconds.\\ 229 Progress bar and seek use subtracks instead of seconds.\\
230 \nopt{clipv1,c200v2}{
230 Video Game Music Format 231 Video Game Music Format
231 & \fname{.vgm} 232 & \fname{.vgm}
232 & \\ 233 & \\
@@ -236,10 +237,9 @@
236 MOD 237 MOD
237 & \fname{.mod} 238 & \fname{.mod}
238 & \\ 239 & \\
239 \nopt{clipv1,c200v2}{
240 NES Sound Format 240 NES Sound Format
241 & \fname{.nsf}, \fname{.nsfe} 241 & \fname{.nsf}, \fname{.nsfe}
242 & Progress bar and seek use subtracks instead of seconds.\\} 242 & Progress bar and seek use subtracks instead of seconds.\\
243 Atari SAP 243 Atari SAP
244 & \fname{.sap} 244 & \fname{.sap}
245 & \\ 245 & \\