ctrmus icon indicating copy to clipboard operation
ctrmus copied to clipboard

[REQUEST] Show current time and total time of current playing song

Open StupidRepo opened this issue 2 years ago • 5 comments

I'd like it if on the bottom screen at the bottom, it shows the current time in the song (e.g. 05:58) on the bottom left, the title of the file (and make it scroll slowly when pressing R button if the text goes off screen/is too long) on the bottom center, and the total time of the song on the bottom right (e.g. 05:59).

Concept image below (sorry the font isn't the exact same): ooh And a concept video I just made (took me about 30 minutes):

https://github.com/deltabeard/ctrmus/assets/69256931/50b5a44e-9858-4f4e-9e9c-05b1516e9af8

StupidRepo avatar Jul 06 '23 19:07 StupidRepo

Notes for my future self: The number of samples read is already obtained in ctrmus, so the time played can already be deduced using the sample rate. So only the total number of samples for the file needs to be added.

  • mpg123 uses mpg123_length() and mpg123_tell() to obtain the number of samples in the music file and the number of samples decoded.
  • dr_flac: drflac_open_and_read_pcm_frames_s16 returns totalPCMFrameCount, drflac_read_pcm_frames_s16 reads the number of samples decoded, so this would need to be added.
  • opusfile: op_pcm_total to obtain the number of samples in the file.
  • wav: this could be calculated from the file size. But I think that this should be made to use dr_wav.

If the number of samples in the file isn't available, then the length of the music won't be displayed.

My 3DS has collected dust; it's been 6 years since the last release of ctrmus. I last worked on a UI for it in 2021 that used LVGL, but it was slow and clunky so I abandoned it.

deltabeard avatar Jul 07 '23 10:07 deltabeard

:eyes: Are you going to update ctrmus though to add this? If not, I can always try my best to make something but I suck at coding 3DS apps/games and I just generally suck at C/C++ a lot.

StupidRepo avatar Jul 07 '23 16:07 StupidRepo

Added in cdf49f8dcf6ad00adaa559aabb2e0dcb1539df01. Could you please test the build attached? ctrmus.zip

deltabeard avatar Jul 08 '23 15:07 deltabeard

:eyes: Of course I will test it! :grin: Thank you for updating it! (and sorry for the late reply!)

StupidRepo avatar Jul 17 '23 06:07 StupidRepo

did it work?

tntgamer3690 avatar Jan 18 '24 20:01 tntgamer3690