Index: apps/codecs/libgme/emu2413.h =================================================================== --- apps/codecs/libgme/emu2413.h (revision 30319) +++ apps/codecs/libgme/emu2413.h (working copy) @@ -115,6 +115,8 @@ e_uint32 status; e_uint32 internal_mute; + + /* Internal buffer */ e_int16 buffer[AUDIO_MONO_BUFFER_SIZE]; } OPLL ; Index: apps/codecs/libgme/ym2612_emu.c =================================================================== --- apps/codecs/libgme/ym2612_emu.c (revision 30319) +++ apps/codecs/libgme/ym2612_emu.c (working copy) @@ -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 ?) @@ -517,11 +520,12 @@ #ifdef YM2612_CALCUL_TABLES impl->g.TL_TAB [i] = (int) (MAX_OUT / pow( 10.0, ENV_STEP / 20.0f * i )); #else - impl->g.TL_TAB [i] = tl_coeff [i]; + impl->g.TL_TAB [i] = TL_COEFF [i]; #endif impl->g.TL_TAB [TL_LENGHT + i] = -impl->g.TL_TAB [i]; } } +#endif // Tableau SIN : // impl->g.SIN_TAB [x] [y] = sin(x) * y; @@ -909,8 +913,28 @@ CALC_EN( 1 ) \ CALC_EN( 2 ) \ CALC_EN( 3 ) \ -int const* const TL_TAB = g->TL_TAB; +int const* const TL_TAB = TL_TAB_LOOKUP; +#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 +943,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 (working copy) @@ -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 };