CUE/BIN audio CDs in QEMU: CD-DA for ide-cd, digital and analog

Three patches that let QEMU's IDE/AHCI CD-ROM read .cue/.bin images with audio tracks and play them — by digital extraction for Windows XP and by analog PLAY AUDIO for DOS and Windows 9x games.

Repository The patches Combined retro build

If you landed here from a search engine, this is probably what you are seeing:

1. Why QEMU has no CD audio

QEMU's ATAPI emulation (hw/ide/atapi.c) treats every disc as 2048-byte data sectors. There is no track list beyond one data track, no READ CD for 2352-byte audio frames, no PLAY AUDIO, no sub-channel position, and the capabilities page tells the guest the drive cannot do CD-DA at all. The block layer does not parse .cue sheets either, so the image the drive sees is a text file.

A real drive offers audio two ways, and old guests depend on both:

2. What the patches add

AreaAdded
Image formatNative .cue sheets with single or split .bin files: MODE1/2048, MODE1/2352, MODE2/2048, MODE2/2336, MODE2/2352, AUDIO, INDEX 00/01, PREGAP/POSTGAP. Referenced files are resolved next to the .cue, case-insensitively.
Digital (DAE)READ TOC formats 0/1/2, READ CD and READ CD MSF with 2352-byte PCM, READ DISC INFORMATION, and the CD-DA / CD-DA Accurate bits in MODE SENSE 0x2A.
AnalogPLAY AUDIO (10), (12) and MSF, PAUSE/RESUME, STOP, READ SUB-CHANNEL, READ HEADER, and the volume page (MODE SENSE/SELECT 0x0E), rendered at 44.1 kHz stereo through a QEMU audiodev.
Disc changesPlayback state is reset on every media change, so CD Player sees the new disc.

Plain .iso images keep the unmodified upstream code path.

3. Which path each guest uses

Guest OS / audio driverDigital (DAE)AnalogNotes
DOS (MSCDEX)not availableworksNo DAE stack in the OS; games send PLAY AUDIO.
Windows 95not availableworksNo redbook.sys / WDM audio.
Windows 98 SE + Sound Blaster (VxD)not availableworksNo WDM mixer path, so the digital checkbox is greyed out. Analog is required.
Windows 98 SE + WDM driver (AC97)works (opt-in)works (default)Some old games keep better timing on analog.
Windows XPworks (recommended)worksDigital follows master volume and mute; enables WMP visualisation and ripping.

The DOS, Windows 95 and Sound Blaster rows follow from how those drivers work. The guests actually run are listed under Tested on.

4. Using it

git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
git checkout -b cue-bin 5f664cd37a     # tested base (QEMU 11.1.50)
git am /path/to/qemu-cue-bin/patches/000[1-3]-*.patch
./configure --target-list=i386-softmmu --enable-pipewire
ninja -C build

./build/qemu-system-i386 -enable-kvm -M pc -m 512 \
  -audiodev pipewire,id=pw0 \
  -device AC97,audiodev=pw0 \
  -hda win98.qcow2 \
  -cdrom /path/to/game.cue

5. Windows XP refuses “Enable digital CD audio”

This happens on an existing XP VM that was installed or booted on an unpatched QEMU. On those boots redbook.sys read the capabilities page, saw no CD-DA support, and cached the answer. XP never probes again, so the patched drive is still reported as unable:

HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}\0000\DigitalAudio
    CDDASupported = 0
    CDDAAccurate  = 0

Fix it one of two ways:

  1. Re-detect the drive (recommended). In Device Manager, right-click QEMU DVD-ROM under DVD/CD-ROM drives → Uninstall, then Action → Scan for hardware changes (or reboot). Tick the checkbox again.
  2. Clear the cache. Delete the DigitalAudio subkey (the 0000 instance number may differ), or set both values to 1, and reboot.

A fresh XP install on the patched QEMU is not affected.

6. Verifying it without a game

The repository's tests/ boots a minimal Linux guest that drives the CD-ROM through the kernel's CD ioctls: the TOC, the ISO9660 data track, a DAE read compared byte for byte with the host .bin, the volume page, and analog PLAY AUDIO MSF through playing → paused → playing → completed. The host captures the analog output with the wav audiodev and checks that it is not silent. A script builds a synthetic disc (a data track plus a 20-second tone), so no game image is needed.

cd tests
./fetch-deps.sh
python3 make-test-disc.py
QEMU=/path/to/qemu-system-i386 ./run-linux-test.sh "" pc     # IDE
QEMU=/path/to/qemu-system-i386 ./run-linux-test.sh "" q35    # AHCI

Not submitted upstream

QEMU declines contributions that include or derive from AI-generated content. These patches were written with Claude, so they are not in QEMU. They are offered as-is under QEMU's licence (GPL-2.0-or-later).

Tested on

QEMU 11.1.50 (5f664cd37a) on Ubuntu 26.04 with KVM.

The patches apply cleanly together with the Wayland scaler and parallel-port series; see the combined build guide.