Last Music Player
A fast native Windows music player for local libraries, with optional remote playback through your own Music API. Offline playback comes first. Remote search, radio, lyrics, and imports stay behind a small provider contract you control.
Overview
Last Music Player is a high-performance, native Windows music player built specifically for local music enthusiasts. It features native integration with the Windows Shell, seamless playback management, SQLite-backed library indexing, and a contract-driven structure allowing users to hook up external audio streaming servers (Music APIs) via plain HTTP endpoints.
Key Features
- Local-First Play standard local formats (MP3, FLAC, M4A, WAV, Opus) with a blazing-fast startup time.
- Gapless Engine Multi-source native queue manager fetches the next song block in advance for zero gap clicks.
- Library Browser Browse by songs, albums, artists, and genres with SQLite-backed indexing.
- Playlists & Mixes Build manual playlists and use auto-generated mixes.
- Synced Lyrics Time-synced lyrics display when a Music API provider is configured.
- Windows Shell Sync Integrates natively with SMTC (System Media Transport Controls), media keys, and system flyouts.
- Google Cast Optional Cast output engine for streaming to Chromecast and Google Nest speakers.
- Discord Rich Presence Optional now-playing status on Discord.
- Music API Provider User-supplied remote catalog for search, streaming, radio, lyrics, and link imports via a simple HTTP contract.
Installation & Setup
Click the Download button above to get the latest release installer. Run the installer to configure the environment. Requires Windows 10 (2004+) or Windows 11.
Building from Visual Studio
To compile and build the client application locally:
- Clone the repository recursively to fetch submodules:
git clone --recursive - Open
Last Music Player.slnxin Visual Studio 2022. - NuGet packages should restore automatically. If not, right-click the solution and choose Restore NuGet Packages.
- Set the active architecture configuration to x64 (Debug or Release).
- Build and run. The output binaries will write to the build directories.
Building from Command Line
Use the MSBuild toolchain from the Visual Studio Developer Command Prompt to compile the project headless:
MSBuild.exe "Last Music Player.vcxproj" /t:Build /p:Configuration=Release /p:Platform=x64
The release binaries will write directly to: x64/Release/Last_Music_Player.exe
Custom Secrets (AppSecrets)
For optional features like Discord Rich Presence, the developer API secrets are excluded from Git to prevent leakage. You can configure them locally for custom builds.
AppSecrets.local.h is absent during compilation, the client falls back to AppSecrets.example.h and automatically disables Discord integrations.
Configuration Steps
- Navigate to the
Backend/directory. - Copy the template file
AppSecrets.example.hand name the new fileAppSecrets.local.h. - Open
AppSecrets.local.hand insert your custom API client IDs.
#pragma once
// Discord Application Client ID for Rich Presence integrations.
// Replace with your custom Discord Developer Portal Application ID.
#define LMP_DISCORD_CLIENT_ID "your-discord-app-id-here"
Architecture & Component Layout
Last Music Player separates components into distinct native layers. The Frontend manages the WinUI 3 presentation structure, while the Backend handles state, cache, hardware playback queues, and SQLite interactions.
Core Code Directory Structure
| Directory | Responsibility & Module Info |
|---|---|
App.xaml* |
Main entry-point, WinUI life-cycle management, shell configuration, and application boot. |
MainWindow/ |
Views, library browsers, playlists, now playing controls, queue visuals, and settings UI panels. |
Backend/ |
Audio playback engine, SQLite integration, Google Cast client, Discord RPC client, settings, and lyrics services. |
Frontend/ |
Navigation logic wrappers and converters, visual and layout helpers. |
ThirdParty/sqlite/ |
Vendored SQLite database engine (amalgamated source). |
installer/ |
Setup packaging configuration written for Inno Setup. |
Gapless Playback Engine Flow
The AudioPlayer.cpp class manages smooth transitions by utilizing the native Windows.Media.Playback.MediaPlaybackList API. When gapless playback is enabled:
- The currently playing track sits at index 0 of the playlist queue.
- A lookahead worker pre-loads the next song, configuring the audio stream into index 1 of the list in advance.
- When the current song terminates, the player transitions to the next track instantly without closing and reopening the audio channel.
SQLite Database Schema
Last Music Player manages the library metadata and user interactions locally using SQLite. The database stores local tracks scanned from disk, remote tracks resolving from the Provider API, local playlists, and configuration logs.
| Column Name | Data Type | Constraints & Metadata | Description |
|---|
-- SQL query will display here
Database Versions & Schema Migration
The DB engine implements a version-gate check using PRAGMA user_version. The schema is currently at Version 6.
| DB Version | Migration Change Log |
|---|---|
| v2 | Added column helpers to support remote media integrations (SourceKey, SourceKind, Provider, SourceUrl, etc.). Added playlist schema, and unique indices on source tracking components. |
| v4 | Dropped columns supporting volume normalizations (ReplayGainDb) since that feature was deprecated, optimization clean-up. |
| v5 | Rebranded default labels for remote imports: modified DateAddedText values matching remote source indicators to say "Music API" to prevent UI leakage. |
| v6 | Schema version baseline optimization to prevent repetitive migration iterations, improving initialization speed. |
Music API Provider Contract
If you configure a custom Music API Provider under settings, the player offloads catalog searching, album indexing, streaming, related radio, and synchronized lyrics requests to your provider base URL via HTTP.
Endpoint description details.
| Parameter | Type | Status | Description |
|---|
-- Code snippet loader
Authentication Standard
The client app communicates the API key configured in settings in two ways:
- JSON Endpoints: Rest query API calls from the client pass the key as an HTTP Authorization Bearer token header:
Authorization: Bearer <api_key> - Media Streams & Artworks: Since Windows Media and image rendering pipelines perform native queries direct from the OS stack where custom headers cannot be attached, keys are passed via query strings:
?access_token=<api_key>
Troubleshooting & FAQ
Common issues encountered during development, installation, or configuration of Last Music Player client and provider stacks.
MediaPlayer instance inside AudioPlayer.cpp is not initialized during static/global variable setup. The constructor runs before init_apartment() has been called, causing ABI proxy failures. Ensure the client player instantiation is called lazily (e.g. on UI thread initialization).
EqualizerEffect.cpp, but the UI is deactivated pending fine-tuning of the biquad audio filter coefficients to avoid crackling noise during playback adjustments.
/v1/stream) which does not enforce this timeout constraint.
MainWindow.LibraryScan.cpp) runs background tasks that recursively crawl configured directories. It parses audio file headers for embedded tags (ID3, Vorbis, MP4 metadata) and saves them to the local SQLite catalog. Track cover artwork is extracted, written to the local app data folder, and referenced as the track's ArtworkUrl.
StreamCache.cpp) which writes remote audio stream segments to temporary disk storage during active playback. If a track's sourceUrl is requested again, the client redirects the media pipeline to fetch bytes directly from local cache, saving bandwidth and preventing network latency gaps.
MediaPlaybackList, the AudioPlayer listens to item transitions. When the current track approaches its end, a lookahead thread resolves the stream URL of the next queue item, pre-loads it at index 1 of the playback list, and switches streams seamlessly when index 0 finishes.
Licensing & Contribution Terms
Last Music Player is distributed as a source-available project, not open-source. Using, modifying, or redistributing the application codebase is governed by specific licensing guidelines.
License Summary
The code is subject to the custom Last Projects License 1.0. Key tenets include:
- Personal Use: Free for natural persons studying, building, or modifying the software for strictly personal and non-commercial purposes.
- Modified Source: If you modify the codebase, you are required to publish the modified source code in a qualifying public Git repository within seven calendar days.
- Organizational Restrictions: Non-profits, companies, government institutions, and schools require a separately negotiated commercial license.
- Dataset Constraints: Using the source code or binary outputs for AI training datasets is strictly prohibited without explicit written consent.
Contributor Agreement (CLA)
By submitting code patches or pull requests to the project, you agree to grant ownership and redistribution rights to Last Projects. You can review the details in CLA.md.
For organization license requests or questions, reach out to: info@lastprojects.com.