Changes

Jump to navigation Jump to search

FF7/PSX/Sound/Opcodes/0xa8aa

7 bytes added, 17:41, 7 May 2020
m
Fix code block formatting
// Compiler optimizer (at least I think so :)) generated following tables to speedup volume calculation for left & right volume.
const uint16_t m_AKAO_VOLUME_TABLE_L[256] = { 
0x7f80, 0x7e80, 0x7d80, 0x7c80, 0x7b80, 0x7a80, 0x7980, 0x7880,
0x7780, 0x7680, 0x7580, 0x7480, 0x7380, 0x7280, 0x7180, 0x7080,
0x3100, 0x31e1, 0x32c4, 0x33a9, 0x3490, 0x3579, 0x3664, 0x3751,
0x3840, 0x3931, 0x3a24, 0x3b19, 0x3c10, 0x3d09, 0x3e04, 0x3f01
}; const uint16_t m_AKAO_VOLUME_TABLE_R[256] = { 
0x0080, 0x0180, 0x0280, 0x0380, 0x0480, 0x0580, 0x0680, 0x0780,
0x0880, 0x0980, 0x0a80, 0x0b80, 0x0c80, 0x0d80, 0x0e80, 0x0f80,
0xff1f, 0xff3c, 0xff57, 0xff70, 0xff87, 0xff9c, 0xffaf, 0xffc0,
0xffcf, 0xffdc, 0xffe7, 0xfff0, 0xfff7, 0xfffc, 0xffff, 0x0000
}; left_volume = m_AKAO_VOLUME_TABLE_L[aa_parameter] * ((a8_parameter * a3_parameter * 0x7f) / 128) / 256 / 128; right_volume = m_AKAO_VOLUME_TABLE_R[aa_parameter] * ((a8_parameter * a3_paramater * 0x7f) / 128) / 256 / 128;
If there is no A3 opcode in sequence (as in SENSUI.SND for example), default value 0x7f is used.
I'll remove these tables in future and add normal mathematical interpretation of volume calculation.
112
edits

Navigation menu