XboxDev / nxdk-sdl

SDL2 (adapted for original Xbox / nxdk toolchain)
Other
20 stars 8 forks source link

audio: Inherit dummy driver as xbox driver #16

Closed JayFoxRox closed 4 years ago

JayFoxRox commented 4 years ago

I noticed that this fails: SDL_Init(SDL_INIT_AUDIO).

This shouldn't happen as I already added dummy drivers in #9. Unfortunately, it was incomplete (which I didn't know at the time).

There were 2 independent problems which break SDL audio:

As a solution, I add a source file which includes the dummy driver; however, the dummy backend with demand_only = 1 is never registered itself. Instead it is registered as another backend ("xbox") with demand_only = 0. Accordingly, I use SDL_AUDIO_DRIVER_XBOX in our config.

I'm not sure about the commit title - suggestions welcome.


I have smoke-tested this by using this in the SDL sample main function:

if (SDL_Init(SDL_INIT_AUDIO) == -1) {
  assert(0); // Triggered on master due to "missing" audio backend; doesn't trigger with this PR
}

(needs #include <assert.h>)

Please confirm that this works correctly (my nxdk and SDL trees also had other changes at the time).

JayFoxRox commented 4 years ago

Actually opening the audio device fails with "Couldn't create mixer lock" though

Good feedback! I never actually tested this beyond init.

My main test-case is Neverball, which just exits early with the master revision. This PR makes Neverball go to the mainloop. I did not check if it might cause errors.

Is there any reason why it isn't being merged yet? Are we waiting for #15? I'm fine eitherway as I keep a hacky branch for Neverball anyway: https://github.com/JayFoxRox/nxdk-sdl/pull/1

thrimbor commented 4 years ago

Is there any reason why it isn't being merged yet? Are we waiting for #15?

Nah I think it's fine to merge this before #15. Merging.