Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio: Inherit dummy driver as xbox driver #16

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

JayFoxRox
Copy link
Member

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:

  • Audio was disabled, and no backend was enabled: Config had SDL_AUDIO_DISABLED 1 with a misleading comment (implying the dummy would be active); it should be SDL_AUDIO_DRIVER_DUMMY.
  • Even if the audio is enabled, no backend would be found: The dummy backend has demand_only = 1. This means will be rejected unless explicitly requested through environment variables (which are always NULL in nxdk at the moment).

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).

Copy link
Member

@thrimbor thrimbor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the code and tried the above code sample, and it seems to work fine. Actually opening the audio device fails with "Couldn't create mixer lock" though - I assume #15 will fix this, since it hooks up all the thread and mutex stuff.

@JayFoxRox
Copy link
Member Author

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: JayFoxRox#1

@thrimbor
Copy link
Member

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.

@thrimbor thrimbor merged commit c7aa1b1 into XboxDev:nxdk Dec 20, 2019
@JayFoxRox JayFoxRox deleted the dummy-xbox-audio branch December 20, 2019 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants