Welcome!

Final Burn Neo => FBN Development => Topic started by: vbt on September 07, 2014, 07:53:35 PM

Title: troubles with YM2151
Post by: vbt on September 07, 2014, 07:53:35 PM
i've spent some time on ym2151 on saturn (sh2 big endian) using gcc 4.9.0
the result is :
volume_calc returns many times 0x3FF or more, quiet value is 0x340 => no sound
op_calc1 give me strange behavior :
Quote
p = (env<<3) + sin_tab[ (i>>FREQ_SH) & SIN_MASK];
(env<<3) = 19f8
(i>>FREQ_SH) & SIN_MASK = 03b2
sin_tab = FFF8C400
p = FFF8DDF8
TL_TAB_LEN = 1A00
p >= TL_TAB_LEN  => no sound

anybody could help ? can it be an endian problem? i've seen nothing in gp32/xb360 port that could help
Title: Re: troubles with YM2151
Post by: vbt on October 17, 2014, 07:09:32 PM
i've found a fix for tl_tab

m = (1<<16) / powf(2, (x+1) * 0.00390625);
m = floorf(m);

floorf & powf fix m results
Title: Re: troubles with YM2151
Post by: vbt on November 02, 2014, 09:26:01 PM
m = sinf( ((i*2)+1) * PI / SIN_LEN ); /* verified on the real chip */

few lines later, sinf instead of sin and now all values are correct

 :biggrin: