Skip to content

Addendum to #258 #264

Description

@djdiskmachine

PR #258 introduces future-proofing functionality but also has some minor caveats.
Have a look at these points:

1: Null dereference after error log (SDLAudio::GetSampleRate)
After logging the error when drv is null, execution falls through and dereferences it. Add return 0; after the Trace::Error call in SDLAudio.cpp

2: AudioSettings uninitialized members
bufferSize, preBufferCount, and sampleRate have no default values. Any stack-constructed AudioSettings with a missed field is undefined behavior. Add in-class initializers to the struct.

3: Audio::GetSampleRate() base class returns hardcoded 44100
WavFileWriter and FxPrinter now call Audio::GetInstance()->GetSampleRate() expecting the real negotiated rate. Non-SDL backends (JACK, RTAudio) inherit the default and silently return 44100 regardless of what the driver actually opened. Either make it pure virtual or have those backends override it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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