We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4770 - Mix_FadeOutChannel never sets fade_volume_reset causing faded out chunks to have volume reset incorrectly
Summary: Mix_FadeOutChannel never sets fade_volume_reset causing faded out chunks to h...
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.4
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
: 4205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-08-21 01:20 UTC by birk.kevin
Modified: 2019-08-22 07:05 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description birk.kevin 2019-08-21 01:20:33 UTC
The following code at line 1155 in mixer.c ensures that the conditional to set fade_volume_reset can never be true.

    mix_channel[which].fade_volume = mix_channel[which].volume;
    mix_channel[which].fading = MIX_FADING_OUT;
    mix_channel[which].fade_length = (Uint32)ms;
    mix_channel[which].ticks_fade = SDL_GetTicks();

    /* only change fade_volume_reset if we're not fading. */
    if (mix_channel[which].fading == MIX_NO_FADING) {
        mix_channel[which].fade_volume_reset = mix_channel[which].volume;
    }

The `mix_channel[which].fading = MIX_FADING_OUT;` must be moved after the `if` statement.
Comment 1 Sylvain 2019-08-21 07:32:28 UTC
Thanks ! It's here: https://hg.libsdl.org/SDL_mixer/rev/c8ae0feb801e

I also modified the Mix_FadeInChannel
because when playing on the same channel while fading, it was saving the fading volume.

Please give a try !
Comment 2 Sylvain 2019-08-22 07:05:48 UTC
*** Bug 4205 has been marked as a duplicate of this bug. ***