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

Use PulseAudio for BSD #154

Open
hajimehoshi opened this issue Oct 24, 2021 · 17 comments
Open

Use PulseAudio for BSD #154

hajimehoshi opened this issue Oct 24, 2021 · 17 comments
Milestone

Comments

@hajimehoshi
Copy link
Collaborator

ALSA is not listed in OpenBSD package list

https://ftp.openbsd.org/pub/OpenBSD/7.0/packages/amd64/

@hajimehoshi
Copy link
Collaborator Author

Just using PulseAudio might solve this:

hajimehoshi/ebiten@13e84f0

@hajimehoshi hajimehoshi changed the title Support OpenBSD with non-ALSA Use PulseAudio for BSD Oct 24, 2021
@divVerent
Copy link
Contributor

Yeah. FreeBSD has ALSA in the ports collection, and technically it wouldn't be much work to at least ship a pulseaudio-only-supporting ALSA userspace for OpenBSD or NetBSD... but it's not in their ports and pkgsrc.

I sure would like to see support for all the BSDs, though. Whether that means a pulseaudio or BSD audio / OSS-ish backend I do not really care.

@divVerent
Copy link
Contributor

Actually, I may be wrong - apparently NetBSD has some ALSA stuff in its pkgsrc now. Gotta try that out. That would still leave OpenBSD though.

@reezer
Copy link

reezer commented Mar 2, 2022

It's actually a bit more complicated than that for FreeBSD. One is able to configure how ports are compiled, so you might be using one of these and probably more:

  • OSS directly
  • PulseAudio (if the user decides so)
  • Sndio (if the user decides so)

OSS should always work on FreeBSD. The same is true for DragonFly BSD.

For OpenBSD one can safely assume that sndio will always work. It has a pretty simple interface.

I think the ALSA parts you refer to might be the Linux compatibility layer, that FreeBSD offers, which technically isn't really running on FreeBSD.

For pkgsrc one also has to be careful to not mix things up. pkgsrc is also used by the MINIX 3, some Solaris/illumos distributions and also is compatible with Linux and other operating systems.

I am not completely sure about NetBSD. I think OSS is a safe option here as well.

All of them also support pulseaudio, if it is installed. So that's always an option.

@midnadimple-zz
Copy link

pulse is prob best option, since most people, regardless of what os they're using, will have it installed already. how difficult would it be to transition?

@hajimehoshi
Copy link
Collaborator Author

The implementation is not difficult. Actually there was an implementation hajimehoshi/ebiten@13e84f0

The problem is that I don't have an environment to test this.

@midnadimple-zz
Copy link

huh, it just so happens that I do. ill test it out

@hajimehoshi
Copy link
Collaborator Author

Thanks, I'll queue this task to my task list... Stay tuned

@divVerent
Copy link
Contributor

divVerent commented Apr 13, 2022 via email

@hajimehoshi
Copy link
Collaborator Author

This sounds a good idea, but the affected environment is only FreeBSD, and this is originally not well tested to be honest. So, I think it is ok not to have a transition period.

@divVerent
Copy link
Contributor

divVerent commented Apr 14, 2022 via email

@hajimehoshi hajimehoshi added this to the v3.1.0 milestone Jul 30, 2023
@hajimehoshi hajimehoshi modified the milestones: v3.1.0, v3.2.0 Sep 18, 2023
@Kimapr
Copy link

Kimapr commented Jan 3, 2024

I use exclusively PulseAudio on my Linux device, and the use of ALSA here makes AAAAXY play sound on the wrong device (I want it to play over HDMI but it plays on laptop speakers instead) with no obvious way to fix this.
P.S. solved by installing pulseaudio-alsa, which makes ALSA go through PulseAudio.

@hajimehoshi
Copy link
Collaborator Author

I'm not sure the convention in Linux. ALSA is a kind of lower-level thing than PulseAudio, but probably am I misunderstanding?

@karlpip
Copy link

karlpip commented Jan 3, 2024

I would like to ask if it's possible to leave the ALSA implementation in the code in case you want to implement Pulseaudio support. So one can chose between them somehow, maybe with an ENV var?

Currently i am using Oto on a machine which does not need Pulseaudio because there is only one sound emitting program at a time. In my case installing Pulseaudio would only be unnecessary bloat and energy waste as it starts user services.

@hajimehoshi
Copy link
Collaborator Author

Enabling to choose PluseAudio sounds an interesting idea. Let me think...

@divVerent
Copy link
Contributor

divVerent commented Jan 3, 2024

I'm not sure the convention in Linux. ALSA is a kind of lower-level thing than PulseAudio, but probably am I misunderstanding?

It's complicated. It technically is, but PulseAudio can use ALSA as a backend and ALSA can use PulseAudio as a backend.

The point of this bug is rather the fact that PulseAudio (and the protocol-compatible Pipewire) exists on more operating systems than ALSA.

@reezer
Copy link

reezer commented Jan 3, 2024

I hope this is helpful and might also be interesting to people coming here searching. There is a very cross-platform C library that does support pretty much all of Go's supported platforms called miniaudio. There is a Go library interfacing with it, called malgo. I am writing it because it's a great overview of what could be done and which platforms support which backends. Unless many other options it also doesn't require much to set it up and get it building on all the platforms.

Maybe something to steal ideas or even code (miniaudio is public domain) from.

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

No branches or pull requests

6 participants