Skip to content

Add support for 24-bit and 32-bit audio output.#75

Draft
AliceLR wants to merge 1 commit intolibxmp:masterfrom
AliceLR:add-32bit-output
Draft

Add support for 24-bit and 32-bit audio output.#75
AliceLR wants to merge 1 commit intolibxmp:masterfrom
AliceLR:add-32bit-output

Conversation

@AliceLR
Copy link
Contributor

@AliceLR AliceLR commented Jan 29, 2026

Patches necessary to actually use the 32-bit output support added by libxmp/libxmp#964 (see libxmp/libxmp#924). This is a work in progress and can be finished after libxmp 4.7.0 is out.

Drivers with 24-bit and 32-bit audio support:

  • ALSA
  • BSD
  • CoreAudio
  • NetBSD
  • OSS
  • PulseAudio
  • sndio
  • WinMM
  • Raw file
  • WAV file

Drivers that do not support 24-bit or 32-bit:

  • Sound Blaster

Drivers to verify:

  • AHI
  • AIFF file
  • AIX
  • ALSA 0.5
  • BeOS
  • DART
  • HP-UX
  • QNX
  • SGI
  • Solaris

@AliceLR AliceLR added this to the 4.2.1 milestone Jan 29, 2026
@AliceLR AliceLR marked this pull request as draft January 29, 2026 09:46
Drivers with 24-bit and 32-bit audio support:
- [x] ALSA
- [ ] BSD
- [ ] CoreAudio
- [ ] NetBSD
- [ ] OSS
- [x] PulseAudio
- [ ] sndio
- [x] Raw file
- [x] WAV file

Drivers that do not support 24-bit or 32-bit:
- [ ] Sound Blaster

Drivers to verify:
- [ ] AHI
- [ ] AIFF file
- [ ] AIX
- [ ] ALSA 0.5
- [ ] BeOS
- [ ] DART
- [ ] HP-UX
- [ ] QNX
- [ ] SGI
- [ ] Solaris
@sezero
Copy link
Collaborator

sezero commented Jan 29, 2026

Drivers with 24-bit and 32-bit audio support:

* [ ]  OSS

I think it's possible with new (4.x) oss versions, e.g. freebsd: See their sys/soundcard. h at https://cgit.freebsd.org/src/tree/sys/sys/soundcard.h#n175 for AFMT_S32_NE and AFMT_S24_NE, for e.g.

* [ ]  ALSA 0.5

Can't we just remove that prehistoric backend?

@AliceLR
Copy link
Contributor Author

AliceLR commented Jan 29, 2026

I think it's possible with new (4.x) oss versions, e.g. freebsd: See their sys/soundcard. h at https://cgit.freebsd.org/src/tree/sys/sys/soundcard.h#n175 for AFMT_S32_NE and AFMT_S24_NE, for e.g.

I think this is correct, but I didn't look that closely. The current lists were kind of just guessing based on the defines I could easily search. The only drivers I looked at with any depth are the ones that are updated and working, so far. (Also, I forgot to put WinMM in the list—seems that like WAV, it works but you need to use WAVEFORMATEXTENSIBLE?)

Can't we just remove that prehistoric backend?

Not sure; I think if that happens, it should wait for a later release. (I think anything that only supports ancient ALSA should also have OSS?)

unsigned char a, b;
int i;

for (i = 0; i < buffer_bytes; i+= 4) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

style


/* Downmix 32-bit to 24-bit unaligned (in-place).
* Returns the new number of useful bytes in the buffer. */
int downmix_32_to_24_unaligned(unsigned char *buffer, int buffer_bytes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"packed" may be better than "unaligned" in this context?

fmt = format & XMP_FORMAT_8BIT ?
SND_PCM_FORMAT_S8 : SND_PCM_FORMAT_S16;
fmt = format & XMP_FORMAT_UNSIGNED ?
SND_PCM_FORMAT_U8 : SND_PCM_FORMAT_S8;
Copy link
Contributor Author

@AliceLR AliceLR Jan 29, 2026

Choose a reason for hiding this comment

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

SND_PCM_FORMAT_S8 played as if it was using the wrong signedness the last time I tested it, may need investigation. (This may be a PipeWire bug or something else, though.)

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.

2 participants