Question about the es5506 code
Parduz
12/08/23 11:23 AM
This may be a dumb question, but i have a hard time in understanding the code, the accumulator register management in particular.
The es5506.cpp/h files manages both the OTIS 5505 and the OTTO 5506 and contains this constant:
// constants for address
const s8 ADDRESS_FRAC_BIT = 11;
Both the es5506_device and the es5505_device are derived from it, and manage the differences.
The OTTO is 21bit integer/11bit decimal, and inside the es5506_device class there is these constants:
const s8 ADDRESS_INTEGER_BIT_ES5506 = 21;
const s8 ADDRESS_FRAC_BIT_ES5506 = 11;
The OTIS is a 20bit integer/9bit decimal, and inside the es5505_device class there is these constants:
const s8 ADDRESS_INTEGER_BIT_ES5505 = 20;
const s8 ADDRESS_FRAC_BIT_ES5505 = 9;
Both the classes uses the 550x
generate_pcm
function, which contains this code:
// fetch two samples
s32 val1 = (s16)read_sample(voice, get_integer_addr(accum));
s32 val2 = (s16)read_sample(voice, get_integer_addr(accum, 1));
And this is the code of the
get_integer_addr
function:
inline u64 get_integer_addr(u64 accum, s32 bias = 0) { return ((accum + (bias << ADDRESS_FRAC_BIT)) & m_address_acc_mask) >> ADDRESS_FRAC_BIT; }
I have problem with this one. Shouldn't the 5505 use ADDRESS_FRAC_BIT_ES5505 instead of ADDRESS_FRAC_BIT? Shouldn't the two devices uses they own version of get_integer_addr ?
What am i not understanding?
Thanks.