From 724a2d2514578297a7fe21dc4c17a7b51a25758d Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Fri, 12 Aug 2011 21:36:29 +0000 Subject: 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 --- apps/codecs/SOURCES | 2 +- apps/codecs/libgme/emu2413.c | 2 +- apps/codecs/libgme/emu8950.c | 20 ++++++++++++++------ manual/appendix/file_formats.tex | 6 +++--- 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 ay.c gbs.c hes.c -#if MEMORYSIZE > 2 nsf.c sgc.c +#if MEMORYSIZE > 2 vgm.c kss.c #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]; static e_uint32 dphaseDRTable[16][16]; /* KSL + TL Table */ -static e_uint32 tllTable[16][8][1 << TL_BITS][4]; +e_uint8 tllTable[16][8][1 << TL_BITS][4]; static e_int32 rksTable[2][8][2]; /* 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]; /** Phase incr table for Decay and Release. */ static unsigned int dphaseDRTable[16][16]; /** KSL + TL Table. */ -static int tllTable[16][8][1<> 1; } else { int tmp = kltable[fnum] - dB2(3.000) * (7 - block); if (tmp <= 0) - tllTable[fnum][block][TL][KL] = ALIGN(TL, TL_STEP, EG_STEP); + tllTable[fnum][block][TL][KL] = (ALIGN(TL, TL_STEP, EG_STEP) ) >> 1; else - tllTable[fnum][block][TL][KL] = (int)((tmp>>(3-KL))/EG_STEP) + ALIGN(TL, TL_STEP, EG_STEP); + tllTable[fnum][block][TL][KL] = ((int)((tmp>>(3-KL))/EG_STEP) + ALIGN(TL, TL_STEP, EG_STEP) ) >> 1; } } } - +#endif // Rate Table for Attack static void makeDphaseARTable(int sampleRate, int clockRate) @@ -313,7 +319,7 @@ static inline void slotUpdatePG(struct Slot* slot) static inline void slotUpdateTLL(struct Slot* slot) { - slot->tll = tllTable[slot->fnum>>6][slot->block][slot->patch.TL][slot->patch.KL]; + slot->tll = (int)(tllTable[slot->fnum>>6][slot->block][slot->patch.TL][slot->patch.KL]) << 1; } static inline void slotUpdateRKS(struct Slot* slot) @@ -457,7 +463,9 @@ void OPL_init(struct Y8950* this, byte* ramBank, int sampleRam) makeAdjustTable(); makeDB2LinTable(); +#if !defined(ROCKBOX) makeTllTable(); +#endif makeRksTable(); makeSinTable(); 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 @@ \nopt{clipv1,c200v2}{ MSX Konami Sound System & \fname{.kss} - & Progress bar and seek use subtracks instead of seconds.\\ + & Progress bar and seek use subtracks instead of seconds.\\} SMS/GG/CV Sound Format & \fname{.sgc} & Supports Sega Master System and Game Gear Sound Format. Progress bar and seek use subtracks instead of seconds.\\ + \nopt{clipv1,c200v2}{ Video Game Music Format & \fname{.vgm} & \\ @@ -236,10 +237,9 @@ MOD & \fname{.mod} & \\ - \nopt{clipv1,c200v2}{ NES Sound Format & \fname{.nsf}, \fname{.nsfe} - & Progress bar and seek use subtracks instead of seconds.\\} + & Progress bar and seek use subtracks instead of seconds.\\ Atari SAP & \fname{.sap} & \\ -- cgit v1.2.3