Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_SetAudioStreamGain sets stream's gain, but SDL doesn't take it into account (SDL 3.2) #12091

Open
Tsukulimer opened this issue Jan 26, 2025 · 2 comments
Assignees
Milestone

Comments

@Tsukulimer
Copy link

Tsukulimer commented Jan 26, 2025

SDL 3.2 simple-playback.c from examples directory
To test it I just added this code after stream creation

    if (!SDL_SetAudioStreamGain(stream, 0.0f))
    {
        return SDL_APP_FAILURE;
    }

It returns true and SDL_GetAudioStreamGain returns 0, but I still can hear sine wave at full volume

Debian 12, tried with SDL_AUDIODRIVER=alsa , SDL_AUDIODRIVER=pulseaudio and SDL_AUDIODRIVER=pipewire

@Tsukulimer Tsukulimer changed the title SDL_SetAudioStreamGain doesn't actually change stream's volume (SDL 3.2) SDL_SetAudioStreamGain sets stream's gain, but SDL doesn't take it into account (SDL 3.2) Jan 26, 2025
@icculus icculus self-assigned this Jan 26, 2025
@icculus icculus added this to the 3.2.2 milestone Jan 26, 2025
@slouken
Copy link
Collaborator

slouken commented Jan 27, 2025

From Discord:

Lyris the Kitori — Today at 11:07 PM
yeah im digging through the SDL source code and im not sure why gain would be applied inconsistently the actual gain it's using is always correct but it's sometimes applied twice, and sometimes applied not at all (which was the original issue i noticed with a 44100 audio -> 48000 device conversion)

@Tsukulimer
Copy link
Author

Tsukulimer commented Jan 27, 2025

FWIW it works as expected if audiospec.format is SDL_AUDIO_S16 instead of SDL_AUDIO_F32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants