News for hackers. Stuff that matters.
Re:C++ audio mixing library design by throwaway17_17 on Monday October 17, 2022 @02:17AM (#33230301)
SDL takes array pointers as arguments for its audio output functions in general, so I would assume they were coding against the SDL Audio API.
Re:C++ audio mixing library design by pjmlp on Monday October 17, 2022 @02:35AM (#33230392)
No reason to use them on C++ method definitions.

    void engine::callback(std::span<float> output)
    {
        std::size_t samples = 0;
        if (stream_)
        {
            samples = stream_->read(output.data(), output.size());
            if (samples == 0) stream_ = nullptr;
        }
        auto remaining = output.subspan(samples);
        std::fill(remaining.begin(), remaining.end(), 0.f);
    }