Skip to content

Revamp the codebase#5

Merged
nots1dd merged 137 commits into
mainfrom
develop
Feb 19, 2026
Merged

Revamp the codebase#5
nots1dd merged 137 commits into
mainfrom
develop

Conversation

@nots1dd

@nots1dd nots1dd commented Jan 1, 2026

Copy link
Copy Markdown
Owner

Current codebase is quite messy and interoperates between the frontend and backend hastily that become harder to fix and add features to.

With this branch (develop), the entire model of being changed with:

  • Clear distinction between frontend (TUI/GUI/CLI,etc.) and backend (song map creation, serialize-deserialize, audio engine, etc.)
  • Much more intuitive and readable API design for frontend
  • Better debugging and trace support
  • Fix A LOT of problems and shortcomings in the initial codebase without compromising on speed and reliability
  • Ditched miniaudio with ALSA + FFmpeg (libav) for pure native linux audio management (abstraction in MA was quite unnecessary)
  • Add lots of cool features of an audio player that I would love to have.

There is still quite some work that needs to go into this, but a small PoC is ready in the project that will gradually be worked upon until a stable TUI emerges.

Things pending:

TODO (IMPORTANT):

  • Stable TUI with basic music player controls
  • Integrate config (keybinds and colors) and other screens to FTXUI
  • Docs for inLimbo-core, MPRIS and frontend interfaces (with and without Doxygen)
  • Unit testing for core components and utilities (SmallString only tested and benched so far)
  • Add a minimum playback time to register into telemetry (currently as soon as we hit play it will count it)

TO BE DONE (TBD) (in the future after draft reaches stable):

  • Explore ALSA API for more audio backend magic
  • Add a basic AudioVisualizer with fftw3 with frontend agnostic visualization capabilities
  • Have seamless audio device swapping (without using any audio backend interfaces like pavucontrol)
  • Memory profiling to optimize current mem usage (TODO in future)
  • Add more telemetry data collection and analysis, catered toward the user like playlist gen, weekly charts, wrapped maybe?
  • Add stable FFI in C

DONE:

  • Add lyrics fetcher via simple HTTPSClient through lrclib.net's API (along with a logical cache flow to avoid query spam)
  • Audio backend interface for more backends like pipewire, pulseaudio, etc. (alsa is set by default)
  • Modular taglib parser setup for easy addition of other audio files like OGG, M4A, etc (MP3 & FLAC are done)
  • Initial groundwork on complex song map sorting (artist / album / track wise, etc.) with realtime load in frontend
  • Basic telemetry and analysis with easy extensions for the future along with cache gen
  • Add true gapless playback
  • Intuitive cmd line arg parsing using CLI11 (with subcommands)
  • Fuzzy search for string queries (title, artist, album, etc. compliant) with custom max distance threshold
  • Add hot-reloadable config for keybinds and colors and misc configs (from config.toml)
  • Frontends as plugins with stable ABI
  • Support for MPRIS via dbus-1
  • Test and implement gapless playback between songs
  • Adding testing and benchmarking for inLimbo-core
  • Simple build commands using Makefile
  • Seamless and no lag seek
  • Instantaneous metadata fetch and faster cache gen
  • Distinction between inLimbo-core API and frontend
  • Logging with custom presets + neat stack trace
  • Easy to use singular Makefile for everything pertaining to the project (fmt, tidy, install-deps, etc.)

KNOWN BUGS:

  • Upon seek spamming near the end of a song, the gapless next logic breaks and keeps adding tracks to the audio buffer without playing anything - buffer stays in previous tid but metadata (by default MPRIS) and ring buffer contains far more looked ahead songs. (seems to be a frontend implementation and logical flaw). Note that this happens sometimes even without seeking but that is quite rare and I have only found this like once or twice.

A bit more about the above issue since that is really the only issue I have found so far: I have added more atomic guards to the function resposible for auto next and within the status loop of the frontend there is a forceful check if the position of the song is GTE to length of the current track, if so disregard the auto next just play the damn song. This should have fixed it idk there is still a goldilocks zone sometimes where I dont even seek and just let it play, but it just gets stuck? Not sure how else to explain it.

There was a problem with double advances due to releasing the mutex when invoking getSoundPtrMut, getSoundPtr, which was releasing, so fixed it by not releasing the lock and using an atomic var to find if track has ended by AudioEngine

It seems to be working fine I have not encounted any issues after testing.

  • Not really a bug, but RSS and PSS segments of memory usage spike at the beginning and stay like that for while (~5-10m?) before it plateaus drastically (frontend independent issue - for ex: cmdline takes ~45-47MiB initially, drops to <15MiB). Goal is to find why and how does the memory spike decrease to maybe find and fix some alloc / free problems

My guess on this is that there are a lot of "hot" allocs that happen at the beginning particularly std::string and the like along with maps (ankerl). This slowly reduces over time as those allocs are freed and only the frontend is invoking allocs and logic? Again this is just my guess and I will do a thorough massif / heaptrack check with this to understand more possibly.

  • During updating telemetry, it sometimes goes to fallback <unknown> field

Not all fields go to fallback (ex: song title will be correct but artist will default to fallback or vice-versa). So not really sure how this error occurs.

SOLUTION:

Did not map SongID to ArtistID so ofc it didnt work. Needed to add a umap for that - although in the future if we want to create more relations the no of maps required will become N * M, so realistically we will focus on the following relations:

SongID -> ArtistID [DONE]
SongID -> GenreID [TBD]

This project is moving forward only as per my free time and motivation, so turbulence in commits and progress is to be expected.

very big commit ik but whats done is done
It is not justified for release binaries as it takes up ~20MiB of RAM.
If UB or any RTE were to occur it is logical to move onto a debug build
with INLIMBO_STACK_TRACE_DUMP=1 to print it.
from this commit on the default place for logs will be
~/.cache/inLimbo/logs/core.log. Also it was stupid to have LOG_ERROR for
a small but essential util like getHomePath, it now throws RTE instead.
Some other misc refactors were made.
@nots1dd nots1dd marked this pull request as draft February 12, 2026 17:53
Accidentally added some webview frontend test code, reverted in this
commit.
instead of creating a stupid x dimensional table, we are going to
flatten it to 1D instead.

Removed some template instantiations too but more can be done to better
this.
future commits i will add a flag to enable different frontend builds
this is annoying
Added isTrackFinished method in AudioEngine that will let us know when
playback is over, then we can simply invoke gapless or forceful next
track.

resolved double advances due to releasing mutex due to `getSoundPtrMut`
and such methods.

Removed the TID + EPS all that logic

Complete overhaul on ftxui UI and new screens
future commits will also keep adding docs via comments or markdown.
now telemetry requires a minimum playback event time so it commits plays
based on this requirement. (if playback time <= required then it drops
listen and thus isnt counted for analysis)
previous commit changed how total listen time was calculated (it only
worked as a committed metric) which was useless, so reverted that
change.
@nots1dd nots1dd marked this pull request as ready for review February 19, 2026 14:03
@nots1dd nots1dd merged commit 2bc4be0 into main Feb 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant