Skip to content
/ smpeg Public

SDL2.0 MPEGaudio::MPEGaudio() #8

@pch666777

Description

@pch666777

There is a small problem with the constructor of MPEGaudio at MPEGaudio:: MPEGaudio(MPEGstream *stream, bool initSDL). In SDL2.0 environment, this line:
audio_ active = (SDL_OpenAudio(&wanted, &actual) == 0);
Always return to the first available device mode. In the internal implementation of SDL_OpenAudio(), open_ audio_ device(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE, 1),SDL_ AUDIO_ ALLOW_ ANY_ CHANGE caused the problem, which led to the existing more powerful devices always returning to F32 mode audio support, so that the audio could not be played. To solve this problem, this sentence can be changed to:

#if SDL_ VERSION_ ATLEAST(2, 0, 0)
actual = wanted;
audio_ active = (SDL_OpenAudio(&wanted, NULL) == 0);
#else
audio_ active = (SDL_OpenAudio(&wanted, &actual) == 0);
#endif

Passed the test in Windows x64 mode and fixed the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions