public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: GitHub pull_request - opened <github@alsa-project.org>
To: alsa-devel@alsa-project.org
Subject: Utils: cplay: Fix WAV header parsing for multi-channel (5.1/7.1) formats
Date: Wed, 11 Mar 2026 12:08:05 +0100 (CET)	[thread overview]
Message-ID: <189bc4d1a8975a00-webhooks-bot@alsa-project.org> (raw)
In-Reply-To: <alsa-project/tinycompress/pr/32@alsa-project.org>

alsa-project/tinycompress pull request #32 was opened from singalsu:

Multi-channel WAV files (>2 channels) use WAVE_FORMAT_EXTENSIBLE (type 0xFFFE) with a larger fmt chunk that includes a channel mask and subformat GUID. The existing parser only handled basic PCM (type 0x0001), causing several issues with 5.1 (6ch) and 7.1 (8ch) content:

 - The fixed-size fread of struct wave_header (44 bytes) misaligned the data chunk read when the fmt chunk was larger than 16 bytes, resulting in audio data being read from the wrong file offset.

 - No chunk scanning was performed, so intermediate chunks (fact, LIST, PEAK) between fmt and data caused parse failures.

 - The WAV channel mask (speaker positions FL, FR, FC, LFE, BL, BR, SL, SR) was never extracted, so firmware received ch_mode=0 and could not determine the correct channel-to-speaker routing.

Add parse_wave_file() that properly scans chunks, handles both basic PCM and WAVE_FORMAT_EXTENSIBLE formats, extracts the channel mask, and positions the file pointer at the start of audio data. For basic PCM files with >2 channels, a standard default channel mask is generated per the Microsoft WAV specification.

The channel mask is passed to firmware via snd_codec.ch_mode so it can correctly map channels to speaker positions. Also add 24-bit sample format support (SNDRV_PCM_FORMAT_S24_LE).

Request URL   : https://github.com/alsa-project/tinycompress/pull/32
Patch URL     : https://github.com/alsa-project/tinycompress/pull/32.patch
Repository URL: https://github.com/alsa-project/tinycompress

           reply	other threads:[~2026-03-11 11:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <alsa-project/tinycompress/pr/32@alsa-project.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=189bc4d1a8975a00-webhooks-bot@alsa-project.org \
    --to=github@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox