Giter Site home page Giter Site logo

SDL 3 Migration - Audio API about sdl HOT 2 CLOSED

Ravbug avatar Ravbug commented on August 15, 2024
SDL 3 Migration - Audio API

from sdl.

Comments (2)

icculus avatar icculus commented on August 15, 2024

Is it possible to configure SDL3 to invoke the audio callback such that it always asks for the same number of samples every time it is called?

No, but the callback also does not care how much data you actually put to the audiostream on each call. If you give it less than requested, it will fill the rest of the playback time with silence (which could make sense at the end of playback), and if you give it more, it'll just have extra already available when it goes to consume more data.

Which is to say: you can just feed the thing a fixed amount every time it runs, regardless of what it asks for.

The only gotcha is that you need to make sure you give it at least what it asks for so you don't get skips in the audio. After opening the audio device, you can call SDL_GetAudioDeviceFormat to find out how much data it intends to consume at a time, and then set up the middleware to output that much audio per iteration.

from sdl.

Ravbug avatar Ravbug commented on August 15, 2024

This works, thanks!

from sdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.