4.6 KiB
4.6 KiB
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_submitqueues 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 tomodules/audio_decoders/linux/decoders.a—build.jaiauto-rebuilds when the .c source is newer). Decoded to s16 PCM and handed to Sound_Player asSound_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_assetcallback firingtrack_finished. - Pause/resume via
user_volume_scalemute 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_assetcallback should calldecoder_freefor MP3/FLAC paths andfreefor OGG/WAV — currently it only flipstrack_finished. Track allocation type per-Sound_Data so the release knows which allocator to use. audio_toggle_pauseis 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
failedforever; no retry. Often that's right (item has no art) but transient network errors should retry once gfx/shaders.jaiis stillSimp.immediate_quad(mirrored bars + bass pulse, but no GLSL fragment shader yet)client.jaistill has the old synchttp_get/http_postandHttp_Response/build_auth_header— async.jai usesbuild_auth_headerso the helpers stay, but the sync wrappers are dead code now- Stream URL
/Audio/{id}/streamreturns the original file. If the original is something exotic (Opus, AAC, etc.) it'll fail. Could fall back to/Audio/{id}/universalwithaudioCodec=mp3or similar to force-transcode for unsupported formats.
Next likely tasks (in rough order)
Free the decoded buffer when the stream ends (fix the leak)— done via Track_Sound wrapper + release_asset callback.- 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 asOGG_COMPRESSED(streams from a decoder, no full PCM buffer). This kills the memory leak for real, lets us delete the entireaudio_decodersmodule (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 plainSound_Data. Only wrinkle: if the Jellyfin server is slow to transcode, first-play latency increases — acceptable trade-off. - 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 callsPOST /Users/{uid}/FavoriteItems/{id}/DELETE .... - Favourite button — heart/star button on now-playing screen that shows current favourite state and toggles it. Read
IsFavoritefrom track JSON, persist optimistically, sync with Jellyfin. - 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 asapp.palette [4] Vector4; the now-playing view and visualizer colour neon bars from the palette instead of the generic hue cycle. - 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.
Artist list alpha-jump— done. TEXT_INPUT events indraw_library_view→ linear scan → setartists_scroll.- Custom GLSL fragment shader for the visualizer (replaces the bar stack)
- Album-level "play all" button in the album column
- Real per-stream pause + seek
- Search bar above artists column