This commit implements a new audio source that reads from pmoplaylist
and streams tracks continuously, along with a resampling node to
normalize sample rates.
## New Components
### PlaylistSource (pmoaudio-ext)
- New source in pmoaudio-ext/src/sources/playlist_source.rs
- Reads from pmoplaylist ReadHandle
- Decodes tracks from audio cache (pmoaudiocache)
- Emits PCM with heterogeneous sample_rate and bit_depth
- Polls playlist when empty (configurable interval, default 100ms)
- Emits TrackBoundary markers between tracks
- Graceful shutdown with EndOfStream on stop
- Gated behind 'playlist' feature flag
**Design Philosophy:**
- Keeps each node simple (single responsibility)
- Emits raw PCM without format normalization
- Pipeline designer chooses how to handle heterogeneity
- Ideal for Radio Paradise (homogeneous streams)
- Requires ResamplingNode + ToI24Node for mixed playlists
### ResamplingNode (pmoaudio)
- Generic resampling node in pmoaudio/src/nodes/resampling_node.rs
- Normalizes variable sample rates to a target rate
- Uses libsoxr for high-quality resampling
- Automatically detects sample rate changes
- Recreates resampler as needed
- Preserves chunk type (I16/I24/I32/F32/F64)
- Quality adapts to bit depth (Medium/High/Very High)
## Architecture
PlaylistSource is placed in pmoaudio-ext to avoid circular dependencies:
- pmoaudio-ext depends on: pmoaudio, pmoplaylist, pmoaudiocache
- No reverse dependencies = clean dependency graph
## Configuration
### pmoaudio-ext/Cargo.toml
- Updated 'playlist' feature to include pmoaudiocache, pmocache, pmoflac
- Added sources module export
### pmoaudio
- Added resampling_node module
- Public export: ResamplingNode
## System Requirements
⚠️ **IMPORTANT**: libsoxr-dev must be installed for compilation
See INSTALL_NOTES.md for installation instructions per platform.
## Usage Example
```rust
// Radio Paradise (homogeneous 44.1kHz/16bit)
let mut source = PlaylistSource::new(playlist, cache);
let to_i24 = ToI24Node::new();
source.register(Box::new(to_i24));
// Mixed playlist (needs normalization)
let mut source = PlaylistSource::new(playlist, cache);
let mut resampler = ResamplingNode::new(48000); // Force 48kHz
let to_i24 = ToI24Node::new();
source.register(Box::new(resampler));
resampler.register(Box::new(to_i24));
```
## Files Changed
- pmoaudio-ext/Cargo.toml: Update playlist feature
- pmoaudio-ext/src/lib.rs: Add sources module
- pmoaudio-ext/src/sources/mod.rs: New sources module
- pmoaudio-ext/src/sources/playlist_source.rs: New PlaylistSource (580 lines)
- pmoaudio/src/nodes/resampling_node.rs: New ResamplingNode (350 lines)
- pmoaudio/src/nodes/mod.rs: Register resampling_node
- pmoaudio/src/lib.rs: Export ResamplingNode
- INSTALL_NOTES.md: System requirements documentation
## Future Work
- GapInsertionNode (inserts silence between tracks)
- CrossfadeNode (fade-in/fade-out mixing)
- Examples (deferred until implementation validated)
71 lines
1.5 KiB
Markdown
71 lines
1.5 KiB
Markdown
# Notes d'installation pour PMOMusic
|
|
|
|
## Prérequis système
|
|
|
|
### libsoxr (obligatoire pour pmoaudio)
|
|
|
|
La bibliothèque `libsoxr` est requise pour le resampling audio dans `pmoaudio`.
|
|
|
|
**Installation** :
|
|
|
|
```bash
|
|
# Debian/Ubuntu
|
|
sudo apt-get install libsoxr-dev
|
|
|
|
# Fedora/RHEL
|
|
sudo dnf install libsoxr-devel
|
|
|
|
# Arch Linux
|
|
sudo pacman -S libsoxr
|
|
|
|
# macOS (Homebrew)
|
|
brew install libsoxr
|
|
|
|
# Alpine Linux
|
|
apk add soxr-dev
|
|
```
|
|
|
|
**Sans privilèges root** : Si vous n'avez pas les droits sudo, demandez à l'administrateur système d'installer `libsoxr-dev`.
|
|
|
|
---
|
|
|
|
## Nouveaux composants
|
|
|
|
### PlaylistSource (pmoaudio-ext)
|
|
|
|
Source audio qui lit une playlist `pmoplaylist` et diffuse les pistes en continu.
|
|
|
|
**Feature** : `playlist`
|
|
|
|
```bash
|
|
# Compiler avec la feature playlist
|
|
cargo build --package pmoaudio-ext --features playlist
|
|
```
|
|
|
|
**⚠️ Important** : Cette source émet du PCM avec sample_rate et bit_depth **variables**. Pour un flux homogène, ajoutez dans le pipeline :
|
|
- `ResamplingNode` (normalise le sample_rate)
|
|
- `ToI24Node` / `ToI16Node` (normalise la profondeur de bits)
|
|
|
|
### ResamplingNode (pmoaudio)
|
|
|
|
Nœud générique qui normalise le sample_rate vers une valeur cible fixe.
|
|
|
|
**Usage** :
|
|
```rust
|
|
let mut resampler = ResamplingNode::new(48000); // Force 48kHz
|
|
```
|
|
|
|
---
|
|
|
|
## Compilation
|
|
|
|
```bash
|
|
# Compiler tout le workspace (nécessite libsoxr)
|
|
cargo build
|
|
|
|
# Compiler sans pmoaudio (si libsoxr manque)
|
|
cargo build --package pmoplaylist
|
|
cargo build --package pmoaudiocache
|
|
# etc.
|
|
```
|