Index: apps/codecs/libgme/ym2612_emu.c =================================================================== --- apps/codecs/libgme/ym2612_emu.c (Revision 30319) +++ apps/codecs/libgme/ym2612_emu.c (Arbeitskopie) @@ -42,9 +42,11 @@ #ifdef YM2612_CALCUL_TABLES #define FREQ_TAB_LOOKUP g->LFO_FREQ_TAB #define ENV_TAB_LOOKUP g->LFO_ENV_TAB + #define TL_TAB_LOOKUP g->TL_TAB #else #define FREQ_TAB_LOOKUP lfo_freq_coeff #define ENV_TAB_LOOKUP lfo_env_coeff + #define TL_TAB_LOOKUP tl_coeff #endif const int output_bits = 14; @@ -505,6 +507,7 @@ // [0 - 4095] = +output [4095 - ...] = +output overflow (fill with 0) // [12288 - 16383] = -output [16384 - ...] = -output overflow (fill with 0) +#if !defined(ROCKBOX) for ( i = 0; i < TL_LENGHT; i++ ) { if (i >= PG_CUT_OFF) // YM2612 cut off sound after 78 dB (14 bits output ?) @@ -522,6 +525,7 @@ impl->g.TL_TAB [TL_LENGHT + i] = -impl->g.TL_TAB [i]; } } +#endif // Tableau SIN : // impl->g.SIN_TAB [x] [y] = sin(x) * y; @@ -908,9 +912,25 @@ CALC_EN( 0 ) \ CALC_EN( 1 ) \ CALC_EN( 2 ) \ -CALC_EN( 3 ) \ -int const* const TL_TAB = g->TL_TAB; +CALC_EN( 3 ) +#if defined(ROCKBOX) +static inline int level( int i ) +{ + if (i >= (PG_CUT_OFF + TL_LENGHT)) { + return 0; + } else if (i >= TL_LENGHT) { + return -TL_TAB_LOOKUP [i - TL_LENGHT]; + } else if (i >= PG_CUT_OFF) { + return 0; + } else + return TL_TAB_LOOKUP [i]; +} +#define SINT( i, o ) (level(g->SIN_TAB [(i)] + (o))) +#else +#define SINT( i, o ) (TL_TAB [g->SIN_TAB [(i)] + (o)]) +#endif + #define DO_FEEDBACK \ int CH_S0_OUT_0 = ch->S0_OUT [0]; \ { \ @@ -919,8 +939,6 @@ CH_S0_OUT_0 = SINT( (temp >> SIN_LBITS) & SIN_MASK, en0 ); \ } \ -#define SINT( i, o ) (TL_TAB [g->SIN_TAB [(i)] + (o)]) - #define DO_LIMIT \ CH_OUTd >>= MAX_OUT_BITS - output_bits + 2; \ Index: apps/codecs/libgme/ym2612_emu.h =================================================================== --- apps/codecs/libgme/ym2612_emu.h (Revision 30319) +++ apps/codecs/libgme/ym2612_emu.h (Arbeitskopie) @@ -171,8 +171,8 @@ #ifdef YM2612_CALCUL_TABLES short LFO_ENV_TAB [LFO_LENGHT]; // LFO AMS TABLE (adjusted for 11.8 dB) short LFO_FREQ_TAB [LFO_LENGHT]; // LFO FMS TABLE + int TL_TAB [TL_LENGHT * 2]; // TOTAL LEVEL TABLE (positif and minus) #endif - int TL_TAB [TL_LENGHT * 2]; // TOTAL LEVEL TABLE (positif and minus) unsigned int DECAY_TO_ATTACK [ENV_LENGHT]; // Conversion from decay to attack phase unsigned int FINC_TAB [2048]; // Frequency step table };