惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy International News Feed
WordPress大学
WordPress大学
Security Latest
Security Latest
Cyberwarzone
Cyberwarzone
K
Kaspersky official blog
Cisco Talos Blog
Cisco Talos Blog
Microsoft Security Blog
Microsoft Security Blog
G
GRAHAM CLULEY
N
News | PayPal Newsroom
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
美团技术团队
J
Java Code Geeks
I
Intezer
The Cloudflare Blog
SecWiki News
SecWiki News
S
Secure Thoughts
Microsoft Azure Blog
Microsoft Azure Blog
V2EX - 技术
V2EX - 技术
C
Cyber Attacks, Cyber Crime and Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Spread Privacy
Spread Privacy
D
DataBreaches.Net
S
Security Affairs
Help Net Security
Help Net Security
S
Securelist
F
Full Disclosure
C
Check Point Blog
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
人人都是产品经理
人人都是产品经理
博客园_首页
G
Google Developers Blog
Google Online Security Blog
Google Online Security Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
L
LINUX DO - 热门话题
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LangChain Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
XMusic: A 10MB Cross-Platform Music Player Built with C++
setoutsoft · 2026-05-06 · via DEV Community

In an era dominated by Electron and web technologies, we seem to have forgotten that desktop applications should be lighter and faster.

Have you ever encountered these frustrations?

  • ❌ Your simple music player takes 200+ MB of RAM
  • ❌ Startup time exceeds 5-10 seconds
  • ❌ Distribution requires bundling Chromium or heavy runtime libraries
  • ❌ Performance feels sluggish on older hardware

XMusic was born to solve these problems.

🚀 Performance That Speaks for Itself

Here's what makes XMusic stand out:

Metric XMusic Typical Electron App Qt Application
Memory Usage ~10 MB 200-500 MB 80-150 MB
Startup Time 710ms* 5-10s 2-5s
Binary Size 15-25 MB 100-300 MB 50-200 MB
Dependencies None (single file) Node.js + Chromium Qt runtime libs


*Note: 625ms is spent on SDL audio initialization; the UI itself launches in just **85ms.

All libraries are statically compiled into the final executable — one file handles everything.


🎯 Why XMusic Exists

The Problem with Modern Desktop Development

In today's landscape, developers often reach for Electron or web-based frameworks because:

  1. Rich ecosystem: npm packages, React/Vue components
  2. Familiar technology: HTML/CSS/JavaScript
  3. Rapid prototyping: Quick to build MVPs

But this comes at a cost:

  • Bloated binaries: Simple apps balloon to 100MB+
  • High memory footprint: Chromium instances consume resources
  • Slow startup: Loading entire browser engine for a music player?
  • Security concerns: Larger attack surface with web technologies

The Native C++ Alternative

XMusic demonstrates that modern C++ desktop development can be:

Lightweight: 10MB memory footprint

Fast: Sub-second startup

Cross-platform: Windows, Linux, macOS from one codebase

Simple: Single executable, no external dependencies


🏗️ Technical Architecture

Core Technology Stack

┌─────────────────────────────────────┐
│        UI Layer (SOUI4)             │
│  Declarative XML Layout + CSS-like  │
│  Data-driven rendering engine       │
└─────────────────────────────────────┘
                  ↓
┌─────────────────────────────────────┐
│     Audio Engine (SDL3)             │
│  SDL_mixer3 for format decoding     │
│  Ring buffer for low-latency play   │
└─────────────────────────────────────┘
                  ↓
┌─────────────────────────────────────┐
│    Metadata & Encoding              │
│  TagLib (ID3v2 editing)             │
│  LAME (MP3 encoding)                │
│  LRCLIB API (lyrics fetching)       │
└─────────────────────────────────────┘

Enter fullscreen mode Exit fullscreen mode

Key Technologies Explained

1. SOUI4: Modern Direct UI Framework

SOUI4 is a lightweight cross-platform UI framework that uses declarative XML layouts — similar to Android's approach but for desktop applications.

Advantages:

  • Separation of concerns: UI defined in XML, logic in C++
  • No traditional Win32/GDI bottlenecks: Direct rendering pipeline
  • Built-in high DPI support: Crisp on 4K displays
  • Multi-language: Automatic system locale detection
  • Animation system: Smooth transitions out of the box

Example XML layout:

<window width="800" height="600" title="XMusic">
  <window layout="vbox">
    <listView name="playlist" />
    <window layout="hbox">
      <button name="play" text="@string/play" />
      <button name="pause" text="@string/pause" />
      <slider name="volume" />
    </window>
  </window>
</window>

Enter fullscreen mode Exit fullscreen mode

2. SDL3 + SDL_mixer3: Audio Powerhouse

Instead of reinventing the wheel, XMusic leverages industry-standard libraries:

  • Format support: MP3, FLAC, OGG, WAV, MOD, OPUS, M4A/AAC, WMA
  • Low-latency playback: Optimized ring buffer implementation
  • Cross-platform audio backends: DirectSound, ALSA, PulseAudio, CoreAudio

3. TagLib: Complete Metadata Management

Full ID3v2 tag editing capabilities:

  • Read/write artist, album, year, genre
  • Album art extraction and display
  • Batch metadata operations

4. LAME Encoder: Industry-Standard MP3 Conversion

Built-in batch conversion tool:

  • Convert FLAC/OGG/WAV → MP3
  • Configurable bitrate (128-320 kbps)
  • Multi-threaded encoding for speed

5. LRCLIB API: Online Lyrics Integration

Automatic lyrics fetching:

  • Search by artist + title
  • LRC format with timestamp synchronization
  • Karaoke-style word-by-word highlighting

🌍 True Cross-Platform Support

XMusic runs natively on all major operating systems with zero code changes:

Windows (xp/7/8/10/11)

  • Native Win32 API integration
  • System tray support
  • Dark/light theme adaptation

Linux (Ubuntu, Fedora, Arch, etc.)

  • X11/Wayland compatibility
  • PulseAudio/PipeWire support
  • Single-file deployment: No .so dependencies to distribute

macOS (10.15+)

  • Native Cocoa integration via swinx compatibility layer
  • Metal-accelerated rendering
  • Retina display support

The Secret Sauce: Swinx

SOUI4's swinx module provides a Windows API compatibility layer for Linux/macOS, allowing:

  • Reuse existing Windows code without modification
  • Consistent behavior across platforms
  • Avoid platform-specific #ifdef spaghetti

This is similar to a lightweight Wine implementation, but designed specifically for GUI applications.


📦 Deployment Simplicity

Traditional Approach

A typical cross-platform app requires distributing:

MyApp/
├── MyApp.exe
├── qt5core.dll
├── qt5gui.dll
├── qt5widgets.dll
├── libssl.so.1.1
├── libcrypto.so.1.1
├── plugins/
│   ├── platforms/
│   ├── imageformats/
│   └── ...
└── translations/
    └── qt_en.qm

Enter fullscreen mode Exit fullscreen mode

XMusic Approach

Just one file:

XMusic.exe  (or xmusic_player on Linux/macOS)

Enter fullscreen mode Exit fullscreen mode

How It Works

  1. Resource embedding: All UI assets (XML, images, fonts) compiled into the binary via .rc files
  2. Static linking: Every dependency (SDL3, TagLib, LAME, SOUI4) linked statically
  3. Runtime extraction: Resources automatically extracted from PE/ELF sections at startup

This not only simplifies deployment but also improves security — resource files can't be tampered with or lost.


🤔 Why Not Qt or Electron?

Great question! Let's break it down:

Electron: Pros and Cons

Pros:

  • Massive frontend ecosystem (React, Vue, Angular)
  • Rapid development with web technologies
  • Easy to hire developers (everyone knows JavaScript)

Cons:

  • Huge binary size: 100-300 MB for simple apps
  • Memory hog: 200-500 MB RAM usage
  • Slow startup: 5-10 seconds to load Chromium
  • Overkill: Do you really need a full browser for a music player?

When to use Electron:

  • Complex web-based features needed
  • Team already skilled in web development
  • Rapid prototyping prioritized over performance

Qt: Pros and Cons

Pros:

  • Mature, battle-tested framework
  • Excellent documentation
  • Powerful QML for declarative UI

Cons:

  • Steep learning curve: Hundreds of classes to master
  • Large binaries: 50-200 MB even for simple apps
  • Complex dependencies: Multiple .dll/.so files
  • Licensing concerns: LGPL/commercial licenses

When to use Qt:

  • Large-scale enterprise applications
  • Need extensive widget library
  • Team experienced with C++/Qt

SOUI4: The Sweet Spot

Pros:

  • Lightweight: 15-25 MB binary, 10-50 MB RAM
  • Easy to learn: Familiar to Win32/MFC developers
  • Fast development: XML layouts + C++ logic
  • Zero dependencies: Single-file deployment
  • Free for commercial use: No licensing headaches

Cons:

  • Smaller community than Qt/Electron
  • Fewer third-party plugins
  • Documentation primarily in Chinese (improving!)

When to use SOUI4:

  • Medium-sized desktop applications
  • Performance and size matter
  • Existing Windows codebase to port to Linux/macOS
  • Prefer native C++ over web technologies

💡 What XMusic Demonstrates

XMusic proves that modern C++ desktop development is still viable and advantageous for certain use cases:

1. Performance Matters

For applications where responsiveness is critical (audio playback, real-time visualization), native code wins:

  • Low-latency audio: Direct hardware access via SDL
  • Smooth animations: GPU-accelerated rendering
  • Instant startup: No VM or interpreter overhead

2. Resource Efficiency

Not every user has a beefy machine:

  • Runs smoothly on older hardware
  • Doesn't monopolize system RAM
  • Suitable for embedded systems or thin clients

3. Simplified Distribution

One file to rule them all:

  • No installer needed
  • Portable (run from USB drive)
  • Easy to version control and distribute

4. Developer Productivity

Despite being C++, development is fast:

  • Declarative UI: Change XML, see results immediately
  • Hot reload: Some SOUI4 setups support live UI updates
  • Modular architecture: Easy to extend with new features

🛠️ Building XMusic

Getting started is straightforward:

Prerequisites

  • CMake 3.16+
  • C++17 compiler (MSVC, GCC, Clang)
  • Git (for submodules)

Build Steps

# Clone with submodules
git clone --recursive https://gitee.com/setoutsoft/xmusic.git
cd XMusic

# Build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

# Run
./bin/xmusic_player  # Linux/macOS
..\bin\Release\XMusic.exe  # Windows

Enter fullscreen mode Exit fullscreen mode

That's it! CMake automatically handles:

  • Downloading SDL3, SDL_mixer, TagLib, LAME, SOUI4
  • Compiling all dependencies as static libraries
  • Embedding UI resources into the binary

No manual dependency installation required.


🎨 Feature Showcase

Core Playback

  • Multi-format support (MP3, FLAC, OGG, WAV, etc.)
  • Gapless playback
  • Playlist management with drag-and-drop

Advanced Audio

  • Multi-band equalizer: Presets for Pop, Rock, Classical
  • Spectrum visualization: Real-time FFT animation
  • Volume normalization: Consistent loudness across tracks

Metadata & Tags

  • ID3v2 tag editor
  • Album art display
  • Batch metadata operations

Lyrics System

  • Auto-detect .lrc files
  • Online search via LRCLIB API
  • Karaoke-mode word highlighting
  • Smooth scale-fade transitions between lines

User Experience

  • Modern dark theme (#1a1a1a background, #e60026 accent)
  • System tray integration
  • Global hotkeys
  • Multi-language (auto-detects system locale)

📊 Real-World Use Cases

XMusic's architecture makes it suitable for:

✅ Personal Music Players

Lightweight alternative to bloated commercial players

✅ Digital Signage

Low-resource audio playback for kiosks

✅ Embedded Systems

Runs on Raspberry Pi, embedded Linux devices

✅ Educational Projects

Demonstrates modern C++ best practices

✅ Legacy App Modernization

Template for porting old Win32 apps to cross-platform


🚧 Future Roadmap

Planned enhancements:

  • [ ] Podcast support: RSS feed integration
  • [ ] Streaming: Internet radio stations
  • [ ] Cloud sync: Playlist backup to cloud storage
  • [ ] Mobile ports: iOS/Android via SOUI4 mobile backend
  • [ ] Plugin system: Third-party visualizations and effects

🤝 Contributing

XMusic is open-source and welcomes contributions!

Ways to help:

  • Report bugs on Gitee Issues
  • Submit pull requests for new features
  • Improve documentation and translations
  • Test on different Linux distributions

Development guidelines:

  • Follow C++11 standards
  • Maintain cross-platform compatibility
  • Add comments for complex logic
  • Test on Windows + Linux before submitting

📚 Learn More

Resources


🎯 Conclusion

XMusic demonstrates that native C++ desktop development is far from dead. In fact, for applications prioritizing:

  • Performance: Low latency, smooth animations
  • 💾 Efficiency: Minimal memory and disk usage
  • 📦 Simplicity: Single-file deployment
  • 🌍 Portability: True cross-platform support

...there's no better choice than going native.

While Electron and web technologies dominate the conversation, projects like XMusic prove that traditional approaches, modernized, still have their place.

If you're building a desktop application where performance matters, consider giving native C++ another look. You might be surprised by how productive and enjoyable it can be with the right framework.


Enjoyed this article?

Happy coding! 🎵


🔗 Related Articles


Tags: #cpp #crossplatform #desktop #opensource #performance #soui4 #sdl #linux #windows #macos