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 API to (auto) switch output device on lwjgl3 #6973

Merged
merged 5 commits into from May 17, 2023

Conversation

Berstanio
Copy link
Contributor

@Berstanio Berstanio commented Aug 19, 2022

This pr adds support for three main things (only for lwjgl3):

  1. Auto switching the Output device if e.g. a headphone gets disconnected. This is mainly relevant on windows, because before that the audio just died.
  2. It reevaluates the default device, if a new device gets connected, and therefor maybe switches to it (the os decides)
  3. It adds a API to specifically select a output device. This API supports swapping too, so if the device gets disconnected and reconected, it will be choosen again.

I also added a Test for this.

@Berstanio
Copy link
Contributor Author

This is now ready to get reviewed, since libGDX got updated to lwjgl3 3.3.2.

Copy link
Member

@SimonIT SimonIT left a comment

Choose a reason for hiding this comment

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

Works from what I tested:

  • Manually setting the device
  • Disconnecting a device changes the device
  • Re-connecting changes the device back

Copy link
Contributor

@HydrolienF HydrolienF left a comment

Choose a reason for hiding this comment

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

It's working as intended for me (Windows 11, bluetooth earphones)

@SimonIT SimonIT merged commit 0a785d1 into libgdx:master May 17, 2023
2 checks passed
@SomeTroglodyte
Copy link
Contributor

Umm... A little late to butt in, but isn't it possible to have the first alcOpenDevice fail because at instantiation the box actually had no sound device, meaning noDevice gets set, then when you connect an USB headphone later it's too late because that flag disables a lot of the functionality for the instance lifetime? (can I repeat 'late' a little more?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants