40 lines
4.6 KiB
Markdown
40 lines
4.6 KiB
Markdown
# Todo / scratch
|
||
|
||
## What works now
|
||
|
||
- Login → server hits `/Users/AuthenticateByName`, token+user_id persisted to `~/.config/player/config.json`
|
||
- Subsequent launches skip login, jump straight to library
|
||
- Library view: 3 columns (artists / albums / tracks), scrollable, click-to-drill
|
||
- **All HTTP is async** — `http_submit` queues a worker thread; `http_pump()` runs once per frame and fires callbacks on the main thread. UI no longer freezes during fetches or downloads.
|
||
- **MP3 + FLAC playback** via vendored `dr_mp3.h` / `dr_flac.h` (compiled to `modules/audio_decoders/linux/decoders.a` — `build.jai` auto-rebuilds when the .c source is newer). Decoded to s16 PCM and handed to Sound_Player as `Sound_Data.LINEAR_SAMPLE_ARRAY`.
|
||
- OGG + WAV continue through `Sound.load_audio_data` (Sound_Player's native path).
|
||
- Click a track → downloads (async) → decodes → plays. Auto-advance via Sound_Player's `release_asset` callback firing `track_finished`.
|
||
- Pause/resume via `user_volume_scale` mute trick (still not a real pause)
|
||
- Now-playing screen with title/artist/album, transport buttons, scrub bar
|
||
- Logout button on library top-right clears `config.json`
|
||
|
||
## Known stubs / rough edges
|
||
|
||
- **Memory leak**: each played track leaks its decoded PCM buffer (~50 MB for a 5-min FLAC). The `release_asset` callback should call `decoder_free` for MP3/FLAC paths and `free` for OGG/WAV — currently it only flips `track_finished`. Track allocation type per-Sound_Data so the release knows which allocator to use.
|
||
- `audio_toggle_pause` is volume-mute, not real pause — cursor keeps advancing
|
||
- No real seek (scrub bar is read-only)
|
||
- Image cache never evicts — hold for thousands of items but unbounded over a long session (low priority)
|
||
- Failed image fetches stay marked `failed` forever; no retry. Often that's right (item has no art) but transient network errors should retry once
|
||
- `gfx/shaders.jai` is still `Simp.immediate_quad` (mirrored bars + bass pulse, but no GLSL fragment shader yet)
|
||
- `client.jai` still has the old sync `http_get`/`http_post` and `Http_Response` / `build_auth_header` — async.jai uses `build_auth_header` so the helpers stay, but the sync wrappers are dead code now
|
||
- Stream URL `/Audio/{id}/stream` returns the original file. If the original is something exotic (Opus, AAC, etc.) it'll fail. Could fall back to `/Audio/{id}/universal` with `audioCodec=mp3` or similar to force-transcode for unsupported formats.
|
||
|
||
## Next likely tasks (in rough order)
|
||
|
||
1. ~~Free the decoded buffer when the stream ends (fix the leak)~~ — done via Track_Sound wrapper + release_asset callback.
|
||
2. **Transcode everything to OGG via Jellyfin** — change the stream URL to `/Audio/{id}/universal?container=ogg&audioCodec=vorbis&maxStreamingBitrate=192000&userId=...`. Jellyfin re-encodes anything exotic; Sound_Player handles OGG natively via stb_vorbis as `OGG_COMPRESSED` (streams from a decoder, no full PCM buffer). This kills the memory leak for real, lets us delete the entire `audio_decoders` module (dr_mp3/dr_flac), and gives consistent 192 kbps quality regardless of source format. The Track_Sound/release_asset machinery can be simplified back to a plain `Sound_Data`. Only wrinkle: if the Jellyfin server is slow to transcode, first-play latency increases — acceptable trade-off.
|
||
2. **Shuffle mode + shuffle-favourites mode** — shuffle toggle in the now-playing transport bar; a second mode that restricts the shuffle pool to favourited tracks only. Jellyfin favourite status lives on the item (`UserData.IsFavorite`); toggling calls `POST /Users/{uid}/FavoriteItems/{id}` / `DELETE ...`.
|
||
3. **Favourite button** — heart/star button on now-playing screen that shows current favourite state and toggles it. Read `IsFavorite` from track JSON, persist optimistically, sync with Jellyfin.
|
||
4. **Cover-art palette theming** — on track change, sample the album art texture (already loaded as a `Simp.Texture`) to extract 3–4 dominant colours via k-means or a simple median-cut on a downsampled copy of the image pixels. Store as `app.palette [4] Vector4`; the now-playing view and visualizer colour neon bars from the palette instead of the generic hue cycle.
|
||
5. **New default theme** — less corner rounding, richer/darker base colours (near-black backgrounds, jewel-toned accents), tighter padding. Replace or supplement the current GetRect theme proc.
|
||
6. ~~**Artist list alpha-jump**~~ — done. TEXT_INPUT events in `draw_library_view` → linear scan → set `artists_scroll`.
|
||
6. Custom GLSL fragment shader for the visualizer (replaces the bar stack)
|
||
7. Album-level "play all" button in the album column
|
||
8. Real per-stream pause + seek
|
||
9. Search bar above artists column
|