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

Add mixer.get_driver #2741

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Add mixer.get_driver #2741

merged 2 commits into from
Mar 19, 2024

Conversation

ankith26
Copy link
Member

@ankith26 ankith26 commented Mar 7, 2024

While working on #2733 I realised that we don't actually have the mixer analogue to display.get_driver(). This PR adds mixer.get_driver to find out the current audio driver being used.

@ankith26 ankith26 requested a review from a team as a code owner March 7, 2024 16:55
Copy link
Member

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

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

Seems legit, looks good

  • API isn't changing in SDL3 ✔️ (well, the SDL_AUDIODRIVER env is moving to SDL_AUDIO_DRIVER, but we can put in a note for that)
  • API doesn't already exist in _sdl2.audio ✔️
  • Test passes locally ✔️
  • Exhaustive list of drivers checks out against a skim of source code ✔️

Should get SDL_GetAudioDriver and SDL_GetNumAudioDrivers be ported too, into a method to get a list of available drivers? That way a user setting SDL_AUDIODRIVER could see what the options are.

@Starbuck5 Starbuck5 added New API This pull request may need extra debate as it adds a new class or function to pygame mixer pygame.mixer labels Mar 13, 2024
@Starbuck5
Copy link
Member

Should get SDL_GetAudioDriver and SDL_GetNumAudioDrivers be ported too, into a method to get a list of available drivers? That way a user setting SDL_AUDIODRIVER could see what the options are.

It seems like this would help test #2733

Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Tested with:

import pygame

pygame.init()
print(pygame.mixer.get_driver())
>> wasapi

@MyreMylar MyreMylar merged commit d7abcbb into main Mar 19, 2024
30 checks passed
@ankith26 ankith26 added this to the 2.5.0 milestone Mar 21, 2024
@ankith26 ankith26 deleted the ankith26-mixer-get-driver branch March 21, 2024 05:15
@ankith26
Copy link
Member Author

Should get SDL_GetAudioDriver and SDL_GetNumAudioDrivers be ported too, into a method to get a list of available drivers? That way a user setting SDL_AUDIODRIVER could see what the options are.

Sounds like a good idea. We could also give display the same treatment. Maybe we could export this as a list, instead of having to export two separate functions.

@Starbuck5
Copy link
Member

That's what I had in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mixer pygame.mixer New API This pull request may need extra debate as it adds a new class or function to pygame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants