mix: fix minor logic issue

This commit is contained in:
bnnm 2021-07-29 23:42:08 +02:00
parent 3c03891d13
commit 734848b5d5

View File

@ -680,6 +680,7 @@ void mixing_push_fade(VGMSTREAM* vgmstream, int ch_dst, double vol_start, double
} }
else if (mix_prev->time_post < 0 || mix.time_pre < 0) { else if (mix_prev->time_post < 0 || mix.time_pre < 0) {
int is_prev = 1; int is_prev = 1;
/* test if prev is really cancelled by this */
if ((mix_prev->time_end > mix.time_start) || if ((mix_prev->time_end > mix.time_start) ||
(mix_prev->time_post >= 0 && mix_prev->time_post > mix.time_start) || (mix_prev->time_post >= 0 && mix_prev->time_post > mix.time_start) ||
(mix.time_pre >= 0 && mix.time_pre < mix_prev->time_end)) (mix.time_pre >= 0 && mix.time_pre < mix_prev->time_end))
@ -687,12 +688,12 @@ void mixing_push_fade(VGMSTREAM* vgmstream, int ch_dst, double vol_start, double
if (is_prev) { if (is_prev) {
/* change negative values to actual points */ /* change negative values to actual points */
if (mix_prev->time_post < 0 && mix_prev->time_post < 0) { if (mix_prev->time_post < 0 && mix.time_pre < 0) {
mix_prev->time_post = mix_prev->time_end; mix_prev->time_post = mix_prev->time_end;
mix.time_pre = mix_prev->time_post; mix.time_pre = mix_prev->time_post;
} }
if (mix_prev->time_post >= 0 && mix.time_pre < 0) {
if (mix_prev->time_post >= 0 && mix.time_pre < 0) {
mix.time_pre = mix_prev->time_post; mix.time_pre = mix_prev->time_post;
} }
else if (mix_prev->time_post < 0 && mix.time_pre >= 0) { else if (mix_prev->time_post < 0 && mix.time_pre >= 0) {