Holy Snail Player
A light, fast, always-on-top audio player in one native exe: music files, audiobooks with chapters, internet radio with time-shift, podcasts and audio CDs. No installer, no DLLs of its own, no runtime to install.
At a glance
Measured on Windows 11 Pro with the v0.11 Release build. Full measurements are in the budget table below. Sizes are binary: 1 KiB is 1,024 bytes and 1 MiB is 1,048,576 bytes.
What it plays
| Source | Formats | How |
|---|---|---|
| Music files | MP3, WAV, FLAC, M4A (AAC and Apple Lossless), WMA (Standard, Pro, Lossless, Voice) | Gapless, sample-exact joins. Titles from ID3v1/v2, WAV INFO and id3 chunks, FLAC comments, MP4 tags and WMA (ASF) tags; legacy Cyrillic tags detected. Protected (DRM) WMA files are refused with a message. |
| Audiobooks, long files | M4B, long MP3 | Streamed from disk. ID3 CHAP/CTOC and MP4 chapters as seek bar ticks and a Chapters menu; Prev/Next move by chapter; resume positions for anything 20 minutes or longer. |
| Internet radio | MP3 and AAC streams (AAC-LC, HE-AAC, HE-AAC v2 in ADTS), .pls and .m3u links | The codec is told by the Content-Type or, when the server sends none, by the first bytes. ICY titles shown when their song is reached. Pause keeps buffering (up to 20 minutes) so Play carries on behind live. |
| Podcasts | RSS feeds, MP3, M4A and WMA episodes | Episodes stream over HTTP Range requests, nothing is downloaded; resume positions and heard marks. |
| Audio CD | CD-DA | Table of contents and CD-Text read through the CD-ROM driver; raw sector reads played gaplessly; bad sectors retried, then silenced. |
Audiobook mode keeps a separate one-book list. Every jump asks first, a listening log records play, pause, jumps and 30-second checkpoints, the place is recovered after a crash, and "Back to" undoes the last jump.
Stack
- C++20 and raw Win32, wide-character APIs only, standard common controls (comctl32 v6). No MFC, ATL, WTL, Qt or other UI layer. Built with MSVC and CMake.
- miniaudio, vendored as a single header, using only its low-level API (
ma_decoder,ma_device) on WASAPI. It is compiled with the engine, node graph, resource manager, encoders, Vorbis and every other backend switched off. Its embedded dr_mp3, dr_wav and dr_flac decoders handle MP3, WAV and FLAC. - Windows itself for everything else: WinHTTP (radio, podcasts), Media Foundation (AAC, ALAC and WMA files, AAC stations), XmlLite (feeds), System Media Transport Controls through C++/WinRT (media keys and flyout), dwmapi (title bar color on Windows 11).
- Static C runtime, so the exe needs no Visual C++ redistributable.
WinHTTP, Media Foundation, XmlLite, dwmapi, oleaut32 and the WinRT imports are delay-loaded: none of them loads before the window is painted, and most only load when their feature is first used. C++/WinRT is confined to smtc.cpp and Media Foundation to mf.cpp.
Threads and how they talk
Eight kinds of thread (UI, audio, loader, scanner, stream reader, radio, feed lister, disc lister), with no shared locks between the audio thread and anything else. Workers report to the UI thread by posted messages; the audio thread is fed by atomic pointer exchanges and lock-free rings.
- The audio thread never allocates, frees, locks, logs, calls Win32 or throws. It reads the current track (from memory, or from a ring filled by a reader thread) and a handful of atomics, and nothing else.
- Ownership moves by atomic exchange. Whoever receives a Track pointer owns it. The UI thread never touches a Track after handing it over; it keeps its own copy of what it displays.
- Only the UI thread touches windows. Workers post a message whose heap payload the UI thread frees.
- Paths stay wide. No path is ever narrowed or handed to miniaudio: the player reads files itself and decodes from memory or through its own read callbacks.
- Every length and offset is checked against the bytes actually present before use: tags, MP3 headers, WAV chunks, MP4 atoms, ASF headers, ADTS frames, ICY metadata, HTTP headers, CD-Text packs.
Gapless playback
The engine holds three slots: next (the preloaded following track), switchTo (play this now: a jump, a new folder) and a small ring of retired tracks. Each audio callback first applies a pending switchTo or seek, then reads frames from the current track. When a track ends partway through a buffer, the engine takes next, retires the old track and keeps filling the same buffer. That is the whole gapless mechanism. Repeat One seeks the current track back to its start instead.
Decoders produce the file's own sample rate. A single linear resampler converts to the device rate and keeps its state across track changes, so joins stay sample-exact even when resampled.
A 200 ms UI timer runs only while playing. It reads the published track id, position and change counter, moves the seek bar, frees retired tracks and asks the loader for the next preload after each change.
Memory model
| What | How it is held | Measured cost |
|---|---|---|
| Files up to 64 MiB | Read whole into memory and decoded on the fly; the next track preloaded the same way | 0.68 MiB over idle + both files |
| Larger files, M4A/M4B, WMA, podcast episodes, CD tracks | A reader thread per track decodes into a 10-second float ring | 4.56 MiB over idle (143 MiB MP3) |
| AAC, ALAC and WMA through Media Foundation | Same ring, plus Media Foundation's own state | 6.4 to 8.8 MiB over idle (60 min files) |
| Radio | Up to 20 minutes of 16-bit audio, committed as it fills and released once played | about 11 MiB per buffered minute; an AAC station adds about 1.2 MiB for its decoder |
When paused or stopped, the UI timer is killed and the audio device is stopped, so the player uses no CPU. Two deliberate exceptions: a paused radio station keeps downloading for time-shift (1 to 3 ms of CPU per second), and a stream reader with a full ring checks it twice a second.
Windows integration
- Media keys and the flyout through the System Media Transport Controls, with title, artist and chapter. The player has no keyboard shortcuts of its own by design; Tab navigation is standard.
- Per-monitor DPI (v2): fonts, layout and owner-drawn parts rebuild on a move between monitors with different scaling.
- Single instance: a second launch forwards its files to the open window and exits.
- Theme: the holysnail.org palette (deep green, parchment, gold) on owner-drawn buttons, custom-drawn sliders, list rows and scroll bar, Palatino Linotype text, Segoe Fluent Icons glyphs, and a colored title bar on Windows 11. High contrast mode switches everything to system colors live.
- Window modes: always on top, a one-row mini mode with volume, a list button that hides the track list and leaves a window of just the controls, and opacity presets from 100 to 50 percent.
Hardening
Control Flow Guard (/guard:cf), CET shadow stack compatibility (/CETCOMPAT), static imports resolved from System32 only (/DEPENDENTLOADFLAG:0x800) and SetDefaultDllDirectories limited to System32 at startup, so a DLL dropped next to the exe is never loaded. The exe carries no build paths.
State on disk
%LOCALAPPDATA%\HolySnailPlayer\settings.ini, UTF-16 so that non-ASCII paths survive: the window and its modes, the music list's folder, track and position, the book's path, track and position, stations, podcasts, resume positions and heard episodes. Audiobook mode adds listening.log beside it. Nothing is written to the registry; removing the exe and that folder removes the player.
Budgets and measurements
| Metric | Budget | v0.11 | Status |
|---|---|---|---|
| Release exe size | 1 MiB (1,048,576 bytes) | 1,018,368 bytes (30,208 under), byte for byte the same when rebuilt from the source download | met |
| Launch to first paint (empty folder, empty settings) | 100 ms | 37 ms | met |
| Private memory, idle, 10,000 tracks | 12 MiB | 5.08 MiB | met |
| Playing a folder | idle + files + 2 MiB | +0.72 MiB | met |
| Playing a streamed file | idle + next + 12 MiB | +4.56 MiB (v0.1) | met |
| Playing through Media Foundation (60 min AAC, ALAC, WMA; 60 s of 192 kHz ALAC) | idle + next + 20 MiB | +6.44 to +8.83 MiB; +18.73 MiB at 192 kHz | met |
| AAC radio station | idle + audio buffered + 5 MiB | about +3.2 MiB | met |
| CPU while playing | under 1% | 16 ms per 20 s (v0.1); 0.02 to 0.04% on Media Foundation files | met |
| CPU while paused | about 0 | 0 ms per 20 s | met |
| Track to track | gapless | sample-exact | met |
Testing
- 160 unit tests cover the playlist and shuffle bag, tag, MP4, ASF, ADTS, CD-Text and feed parsers against hand-built and malformed bytes, the loader and stream reader, radio's ICY parsing and ring, AAC frames captured from real stations, settings round trips and the listening log.
- 42 scripted failure cases run through the real app against a local test radio server: refused and dropped connections, stalls, 404 episodes, truncated, corrupt and protected files, an ejected disc, a lost audio device.
- Soak test: 400 rounds of switching between stations and files. Memory levels off at about 7.6 MiB after round 175 and stays there.
Building
Visual Studio 2022 or newer with the C++ build tools and the Windows SDK, plus CMake 3.21 or newer. No package manager and nothing to download.
cmake -S . -B build -A x64
cmake --build build --config Release
build\Release\Player_tests.exe
Release builds compile warning-free at /W4 with whole-program optimization.
Source map
| File | Role |
|---|---|
main.cpp | Entry point, single instance, command line |
ui.cpp, theme.cpp | Window, controls, layout, DPI, mini mode, menus; colors and owner drawing |
app.cpp | App state: music and book lists, transport, session restore, worker messages |
audio.cpp | Device, audio callback, track handoff, resampling |
loader.cpp, stream.cpp | Path to playable Track; reader threads and PCM rings |
scanner.cpp, playlist.cpp | Folder walk and tag titles; list, natural sort, shuffle bag, history |
tags.cpp, mp4.cpp, mf.cpp | ID3, WAV and FLAC tags and chapters; MP4 atoms; Media Foundation (AAC, ALAC, WMA) |
asf.cpp, adts.cpp | WMA (ASF) headers: titles and DRM detection; ADTS framing of AAC stations |
radio.cpp, http.cpp, podcast.cpp | Stations and ICY; bounded GET and Range reads; RSS and station links |
cd.cpp, booklog.cpp, settings.cpp | Audio CD; Audiobook mode's log; the INI file |
smtc.cpp | Media keys and flyout (the only C++/WinRT file) |
License
The source code is licensed under the Apache License, Version 2.0. The name "Holy Snail Player", the snail icon and the holysnail.org look are not covered by that license; forks are welcome under a name and icon of their own. The only bundled library, miniaudio with its dr_libs decoders, is public domain or MIT No Attribution; C++/WinRT is MIT.
Download v0.11
The player itself, ready to run on Windows 10 and 11 (x64). No installer: put it in any folder and start it.
SHA-256f3db70217fab8d1465f4fc389ac703c60692fb8152058eef95f02e8095e9f07b
The user guide, how to check your downloads, the developer guide, the license and notice, trademarks and third-party notices, as plain text.
SHA-256350960157e73403604ca859987742f5192c5d99512578e32925db10405d30b13
The complete source with its tests and build files. Built as described in DEVELOPERS.txt, it gives an exe identical byte for byte to the one above.
SHA-2563dafd522a97cf87595ba1ee0dd95844e4075e283063095605f9507f41c77f82f
- Check before the first run: compare the download's SHA-256 with the one above (also in SHA256SUMS.txt) and scan it for viruses. CHECKING-DOWNLOADS.txt shows how; both take about a minute.
- The exe is not code-signed, so Windows SmartScreen may warn the first time: choose "More info", then "Run anyway".
- Free under the Apache License 2.0 (LICENSE.txt). Third-party code and its licenses: THIRD-PARTY-NOTICES.txt.
- Previous release: v0.1 stays available: exe, SHA256SUMS.txt, README.txt. What changed is listed under "New in v0.11" in the README above.
- Bug reports and feature requests: contact@holysnail.org. Please mention your Windows version and, for a playback problem, the kind of file or the station or feed address.
Holy Snail Player v0.11 · Workshop of The Holy Snail