Fix mixing

This commit is contained in:
Zachary Hall 2024-10-17 10:28:22 -07:00
parent b52a316511
commit 480311b03e

View file

@ -134,11 +134,11 @@ class ZsmBackend : public PlaybackBackend {
ym_resample_len /= sizeof(int16_t);
for (size_t i = 0; i < samples / 2; i++) {
size_t j = i * 2;
int32_t psg[2] = {psg_ptr[j], psg_ptr[j + 1]};
int32_t pcm[2] = {pcm_ptr[j], pcm_ptr[j + 1]};
int32_t vera[2] = {psg[0] + pcm[0], psg[1] + pcm[1]};
int32_t fm[2] = {ym_resample_ptr[j], ym_resample_ptr[j + 1]};
int16_t mix[2] = {(vera[0] + fm[0]) / 3, (vera[1] + fm[1]) / 3};
int16_t psg[2] = {psg_ptr[j] >> 1, psg_ptr[j + 1] >> 1};
int16_t pcm[2] = {pcm_ptr[j] >> 1, pcm_ptr[j + 1] >> 1};
int16_t vera[2] = {psg[0] + pcm[0], psg[1] + pcm[1]};
int16_t fm[2] = {ym_resample_ptr[j], ym_resample_ptr[j + 1]};
int16_t mix[2] = {vera[0] + (fm[0] >> 1), vera[1] + (fm[1] >> 1)};
out_ptr[j++] = mix[0];
out_ptr[j++] = mix[1];
}